shoptet 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shoptet.rb +2 -1
- data/lib/shoptet/request.rb +7 -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: 44764e9a3baef43fabb596f7702f030f9ee3b2d2ef3cd4cd7ec5e9de26622a69
|
4
|
+
data.tar.gz: cbf1cf85542a688455bb984d30db96986b9bc941ebffdb587e7b6bfbb423493e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d07510d07f5a1fd3bd6f91fac8f3cd1f932013c43c836ab9c5c34525ca926d6b251e88f41831abaaa0e46d726a206fbfd9c4ca473e8cdca1218050c1d2b7ecd0
|
7
|
+
data.tar.gz: fffebdf455902541dbf7aa8acd9c26ab66e454e391f622390b92364bcc787ef0ba25f362e137cc199b787a8b145da834b920e92a961f02c4ed0daec03eb7a470
|
data/lib/shoptet.rb
CHANGED
@@ -8,6 +8,7 @@ class Shoptet
|
|
8
8
|
class AddonSuspended < StandardError; end
|
9
9
|
class AddonNotInstalled < StandardError; end
|
10
10
|
class InvalidTokenNoRights < StandardError; end
|
11
|
+
class EmptyRequestResponse < StandardError; end
|
11
12
|
|
12
13
|
DEFAULT_ON_TOKEN_ERROR = -> (api) do
|
13
14
|
api.api_token = api.new_api_token
|
@@ -66,7 +67,7 @@ class Shoptet
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def self.version
|
69
|
-
'0.0.
|
70
|
+
'0.0.12'
|
70
71
|
end
|
71
72
|
|
72
73
|
def self.ar_on_token_error(model)
|
data/lib/shoptet/request.rb
CHANGED
@@ -32,8 +32,14 @@ class Shoptet
|
|
32
32
|
end
|
33
33
|
|
34
34
|
response = http.request request
|
35
|
+
parsed_body = JSON.parse response.body
|
35
36
|
|
36
|
-
|
37
|
+
unless parsed_body
|
38
|
+
message = "Status code: #{response.code}, url: #{uri}"
|
39
|
+
fail Shoptet::EmptyRequestResponse.new(message)
|
40
|
+
end
|
41
|
+
|
42
|
+
parsed_body
|
37
43
|
rescue Net::OpenTimeout
|
38
44
|
retry if attempt < 4
|
39
45
|
end
|