lightspeed_ruby 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lightspeed/api/error.rb +12 -0
- data/lib/lightspeed/api/helpers/pagination.rb +11 -2
- data/lib/lightspeed/api/items.rb +1 -1
- data/lib/lightspeed/client.rb +1 -0
- data/lib/lightspeed/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34283a7c48e00ef4018116853b4d3ee6ffe04ab
|
4
|
+
data.tar.gz: efc454725299780d31abb0044d2bf3450d525a38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda45771b9be156c251935e2038c56b193ea82f70eb859de4abbe6ca38b396ac5b7fab0f5717a85fe1a0f1265a0f5bb701ac22b6f3d38bf7318d2006e64a40bd
|
7
|
+
data.tar.gz: a51fff917ad7cae09c526ebd644ce1ef98940bdb8f5a972708dd2f476d89d33407a41e6ad6a674a6e644c2fdbe6b79213a1fec6ef106f35339639c2544b914c1
|
@@ -9,10 +9,12 @@ module Lightspeed
|
|
9
9
|
count = Float::INFINITY
|
10
10
|
while offset < count
|
11
11
|
response = yield(options_string(offset, limit))
|
12
|
-
|
12
|
+
body = response.body
|
13
|
+
raise_error(response) unless response.success?
|
14
|
+
attributes = body.delete("@attributes")
|
13
15
|
count = attributes["count"].to_i
|
14
16
|
offset = attributes["offset"].to_i + limit
|
15
|
-
results <<
|
17
|
+
results << body.values
|
16
18
|
end
|
17
19
|
results.flatten
|
18
20
|
end
|
@@ -22,6 +24,13 @@ module Lightspeed
|
|
22
24
|
def options_string(offset, limit)
|
23
25
|
"offset=#{offset}&limit=#{limit}"
|
24
26
|
end
|
27
|
+
|
28
|
+
def raise_error(response)
|
29
|
+
raise Lightspeed::API::Error.new(
|
30
|
+
message: response.body["message"],
|
31
|
+
response: response,
|
32
|
+
)
|
33
|
+
end
|
25
34
|
end
|
26
35
|
end
|
27
36
|
end
|
data/lib/lightspeed/api/items.rb
CHANGED
data/lib/lightspeed/client.rb
CHANGED
data/lib/lightspeed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightspeed_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zamith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/lightspeed/api/accounts.rb
|
115
115
|
- lib/lightspeed/api/categories.rb
|
116
116
|
- lib/lightspeed/api/customers.rb
|
117
|
+
- lib/lightspeed/api/error.rb
|
117
118
|
- lib/lightspeed/api/helpers/pagination.rb
|
118
119
|
- lib/lightspeed/api/items.rb
|
119
120
|
- lib/lightspeed/api/items/custom_fields.rb
|