shoptet 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/lib/shoptet.rb +4 -19
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5707a03aee00c4da7081d5240e584e722e3acd3223a4e0a58c224c98b9a7dc77
4
- data.tar.gz: d58ec4a17e917631a70bc2e662f5f16edeaf321b2a3f77df8a63450c17995380
3
+ metadata.gz: 9f2a8ff1331b90ddcd3421d6408b667643d3fe8b95643ea7833f192a8152103d
4
+ data.tar.gz: 8a87de0252b757023dd35c20f67885454d4cc85f72651b4b91c32a9430531805
5
5
  SHA512:
6
- metadata.gz: 4b0e431494bcbc05f7c75c8cf50e298cfece53d8421c74f63fcd424dd7efdaa6e4ed44d7bfc8c2a5846d2819eab620933bfa85700613bf83673fc00f4381da93
7
- data.tar.gz: 372d9d14962d9aefc387678197c7db28b95ccf9717a41a6517bd5043c1fe0a86b462f1935d2bf6c6fd261ffd637a8ef025500f1c6f2da9ee6d5ce2ba6a2c45a8
6
+ metadata.gz: 7b1cfa1f1fe0b8d57bb8df48793224a94dd970adad6af9438ada8bdbeb0ba62caa91578058c50582fdcf2f890970995ff6bb73c56358699b9fa2726dd5801520
7
+ data.tar.gz: 5d45e753e5a64158e0d1d21b2f1dbc6daea2c894a70c6a2b43e0eccdd3645fe2ae569f452865c7752fde2b3ea623e90c17dd83c8d005f95f1eb5175901ffa7bd
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /*.gem
@@ -17,7 +17,7 @@ class Shoptet
17
17
  end
18
18
 
19
19
  def self.version
20
- '0.0.1'
20
+ '0.0.2'
21
21
  end
22
22
 
23
23
  def self.ar_on_token_error(model)
@@ -106,22 +106,7 @@ class Shoptet
106
106
  headers = { 'Authorization' => "Bearer #{@oauth_token}" }
107
107
 
108
108
  result = Shoptet::Request.get @oauth_url, headers
109
- handle_errors result
110
-
111
- # error = result['error']
112
- # errors = result['errors'] || []
113
- #
114
- # #TODO: unite error handling with #request
115
- # if error || errors.any?
116
- # additional_data = {
117
- # uri: @oauth_url,
118
- # headers: scrub_sensitive_headers(headers)
119
- # }
120
- #
121
- # raise Error.new result, additional_data
122
- # else
123
- # result.fetch 'access_token'
124
- # end
109
+ handle_errors result, @oauth_url
125
110
 
126
111
  result.fetch 'access_token'
127
112
  end
@@ -160,7 +145,7 @@ class Shoptet
160
145
  'Content-Type' => 'application/vnd.shoptet.v1.0' }
161
146
 
162
147
  result = Shoptet::Request.get uri, headers
163
- token_errors = handle_errors result
148
+ token_errors = handle_errors result, uri
164
149
 
165
150
  if token_errors.any?
166
151
  @on_token_error.call self
@@ -170,7 +155,7 @@ class Shoptet
170
155
  end
171
156
  end
172
157
 
173
- def handle_errors result
158
+ def handle_errors result, uri
174
159
  error = result['error']
175
160
  errors = result['errors'] || []
176
161
  token_errors, non_token_errors = errors.partition { |err| ['invalid-token', 'expired-token'].include? err['errorCode'] }
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Premysl Donat