Skip to content

Commit 78477a6

Browse files
committed
Merged in feature/tests-and-updates (pull request #2)
Feature/tests and updates
2 parents 62c0987 + c000571 commit 78477a6

File tree

10 files changed

+393
-83
lines changed

10 files changed

+393
-83
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
.dart_tool/
33
.packages
44
.flutter-plugins
5+
.flutter-plugins-dependencies
6+
.idea/
57

68
# Conventional directory for build outputs.
79
build/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
shopify: ^1.0.0
18+
woosignal_shopify: ^1.0.0
1919
```
2020

2121
### Usage example #
@@ -31,7 +31,7 @@ import 'package:woosignal_shopify/woosignal_shopify.dart';
3131
3232
...
3333
34-
// EXAMPLE GET PRODUCTS
34+
// EXAMPLE GET PRODUCT
3535
_getProducts() async {
3636
3737
// Step 1 - Initialize WooSignal

dart_test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tags:
2+
products:
3+
get-products:

example/lib/main.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:woosignal/woosignal_shopify.dart';
3-
import 'package:woosignal/models/response/product.dart';
2+
import 'package:woosignal_shopify/woosignal_shopify.dart';
43

54
void woosignalWoocommerceExample() => runApp(MyApp());
65

@@ -33,10 +32,10 @@ class _MyHomePageState extends State<MyHomePage> {
3332
// CREATING AN INSTANCE FOR WOOSIGNAL
3433
await WooSignal.instance.init(appKey: "your app key");
3534

36-
List<Product> products = await WooSignal.instance.getProducts();
37-
if (products.isNotEmpty) {
38-
_productName = products[0].name ?? "";
39-
}
35+
// ProductResponse? product = await WooSignal.instance.getProducts();
36+
// if (products.isNotEmpty) {
37+
// _productName = products[0].name ?? "";
38+
// }
4039
setState(() {});
4140
}
4241

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dev_dependencies:
1313
flutter_test:
1414
sdk: flutter
1515

16-
woosignal:
16+
woosignal_shopify:
1717
path: ../
1818

1919
flutter:

lib/models/links.dart

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,3 @@
1313
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1414
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1515

16-
import 'package:woosignal/models/collection.dart';
17-
import 'package:woosignal/models/self.dart';
18-
19-
class Links {
20-
List<Self>? self;
21-
List<Collection>? collection;
22-
List<Collection>? up;
23-
List<Collection>? describes;
24-
25-
Links({this.self, this.collection, this.up});
26-
27-
Links.fromJson(Map<String, dynamic> json) {
28-
if (json['self'] != null) {
29-
self = [];
30-
json['self'].forEach((v) {
31-
self!.add(Self.fromJson(v));
32-
});
33-
}
34-
if (json['collection'] != null) {
35-
collection = [];
36-
json['collection'].forEach((v) {
37-
collection!.add(Collection.fromJson(v));
38-
});
39-
}
40-
if (json['up'] != null) {
41-
up = [];
42-
json['up'].forEach((v) {
43-
up!.add(Collection.fromJson(v));
44-
});
45-
}
46-
if (json['describes'] != null) {
47-
describes = [];
48-
json['describes'].forEach((v) {
49-
describes!.add(Collection.fromJson(v));
50-
});
51-
}
52-
}
53-
54-
Map<String, dynamic> toJson() {
55-
final Map<String, dynamic> data = <String, dynamic>{};
56-
if (self != null) {
57-
data['self'] = self!.map((v) => v.toJson()).toList();
58-
}
59-
if (collection != null) {
60-
data['collection'] = collection!.map((v) => v.toJson()).toList();
61-
}
62-
if (up != null) {
63-
data['up'] = up!.map((v) => v.toJson()).toList();
64-
}
65-
if (describes != null) {
66-
data['describes'] = describes!.map((v) => v.toJson()).toList();
67-
}
68-
return data;
69-
}
70-
}

0 commit comments

Comments
 (0)