pwinty 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pwinty/order.rb +14 -6
- data/lib/pwinty/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fb9342998514edb4c51d29d77f8572ca73baae3e213843151b8c24b14493952
|
4
|
+
data.tar.gz: 59acc7485eb5463db08ca457d55f60b273c670d5ded7a5b5277f808b68773267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b11e31df0970ad45537c2c9def49fdcc581a27ad260c6d39eb91fb8e03d067548f909434f3a721a42cf3ef89dfcf22134c03e2e81664e0ad7e8a81d21c9ae7c9
|
7
|
+
data.tar.gz: '03599d879d7b02cfadb975f8fb7544df05f391991051149c6f65e3ad8a36c93542686379c4a1e7740cc3b8c711413986f6ffe03708608e9d9c4aa97002058c44'
|
data/Gemfile.lock
CHANGED
data/lib/pwinty/order.rb
CHANGED
@@ -36,12 +36,20 @@ module Pwinty
|
|
36
36
|
attribute :invoiceCurrency, Types::String.optional
|
37
37
|
attribute :tag, Types::String.optional
|
38
38
|
|
39
|
-
def self.list
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
def self.list(page_size=50)
|
40
|
+
all_orders = list_each_page(page_size)
|
41
|
+
Pwinty.collate_results(all_orders, self)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.list_each_page(page_size, page_start=0, total_orders_count=nil)
|
45
|
+
all_orders = []
|
46
|
+
while total_orders_count.nil? or all_orders.count < total_orders_count
|
47
|
+
response = Pwinty.conn.get("orders?limit=#{page_size}&start=#{page_start}")
|
48
|
+
total_orders_count ||= response.body['data']['count']
|
49
|
+
all_orders = all_orders + response.body['data']['content']
|
50
|
+
page_start = page_start + page_size
|
51
|
+
end
|
52
|
+
all_orders
|
45
53
|
end
|
46
54
|
|
47
55
|
|
data/lib/pwinty/version.rb
CHANGED