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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c25e08acd0126a8756438b17836f64f13268628e32a9fc9f8a1375f75096626
4
- data.tar.gz: 2b998f5dd0df5d74a6c56be2b1fabfa4651d56efcbb276194f56b7aa8f62f10a
3
+ metadata.gz: 44764e9a3baef43fabb596f7702f030f9ee3b2d2ef3cd4cd7ec5e9de26622a69
4
+ data.tar.gz: cbf1cf85542a688455bb984d30db96986b9bc941ebffdb587e7b6bfbb423493e
5
5
  SHA512:
6
- metadata.gz: 13ba8bead9e42327929dd0bd25f64cc838ecbc52f4a26c506c379301da92d89053ec7189cd5dabee353c9220ae5a1941652690fdbcafcebe2e4c91c63a1d0cb9
7
- data.tar.gz: 8f34a681340f8ad9db35c242ae808b00e8b8062c84698dc46e735037a9b9c696d203402b1e77d0e4b5a116e2bb34507b4062a697ce2b1d36608ce43917f03bba
6
+ metadata.gz: d07510d07f5a1fd3bd6f91fac8f3cd1f932013c43c836ab9c5c34525ca926d6b251e88f41831abaaa0e46d726a206fbfd9c4ca473e8cdca1218050c1d2b7ecd0
7
+ data.tar.gz: fffebdf455902541dbf7aa8acd9c26ab66e454e391f622390b92364bcc787ef0ba25f362e137cc199b787a8b145da834b920e92a961f02c4ed0daec03eb7a470
@@ -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.11'
70
+ '0.0.12'
70
71
  end
71
72
 
72
73
  def self.ar_on_token_error(model)
@@ -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
- JSON.parse response.body
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoptet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Premysl Donat