shoptet 0.0.54 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shoptet.rb +7 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d1540eac2f1805254cc70fd81b16e333368bfa2b14344361e9531e4890637d0
4
- data.tar.gz: 0200d1d0258da7d2014bb49e4b8092eb85f006ac0bbb52898ddff77269f62e57
3
+ metadata.gz: 3973988132bd7183d479a1e86cca5aea7ea6ac436390806c06bd1f62865f12f7
4
+ data.tar.gz: 897b12f9a8dae2f05f79369854ae04181980ebb854741b7802047634e5f0fbb0
5
5
  SHA512:
6
- metadata.gz: 570517fe21155f6fd7d28d701885acb996e2842b46a603f03c6f92d011f34d5037bc90d8347e12ce844b5ada429733762a532d38fa93c548167ca83c96d427ce
7
- data.tar.gz: 44a5b9002f63a7518c3a3964f62585734dceaff60e3c3ce2b144997825995c3eadec69a21049432770666b41c1a9412b3685e4d802221b3694eefcaafd7859ac
6
+ metadata.gz: 2c2016f22a74cab724d270950a0e7fac3005ad3e827321f5998c4c45c0c383cd7355b3ac11fca89e07fb9f56ea32c1a51171e55ba4b92b23f1b9610c3025d3cf
7
+ data.tar.gz: 5a5d57ddaac9532ce0585d9ef13242c328f26c5ae0ccaec74daaced9f52bf9881f3469681278e535eb0638a190de899fed203b9039b68427fb8a3643469e05cb
data/lib/shoptet.rb CHANGED
@@ -29,7 +29,7 @@ class Shoptet
29
29
  end
30
30
 
31
31
  def self.version
32
- '0.0.54'
32
+ '0.0.55'
33
33
  end
34
34
 
35
35
  def self.ar_on_token_error(model)
@@ -87,7 +87,7 @@ class Shoptet
87
87
  @shop_url = shop_url
88
88
  @client_id = client_id
89
89
  @on_token_error = on_token_error || ON_TOKEN_ERROR
90
- @api_token = api_token || @on_token_error.call(self)
90
+ @api_token = api_token
91
91
  end
92
92
 
93
93
  def endpoints api_params = {}
@@ -245,6 +245,7 @@ class Shoptet
245
245
  end
246
246
 
247
247
  def get(url, api_params = {}, retry_on_token_error = true)
248
+ @api_token ||= @on_token_error.call(self)
248
249
  url = URI(url)
249
250
  url.query = URI.encode_www_form(api_params) if api_params.any?
250
251
 
@@ -267,6 +268,7 @@ class Shoptet
267
268
  end
268
269
 
269
270
  def patch(url, data, retry_on_token_error = true)
271
+ @api_token ||= @on_token_error.call(self)
270
272
  url = URI(url)
271
273
  headers = { 'Shoptet-Access-Token' => @api_token,
272
274
  'Content-Type' => 'application/vnd.shoptet.v1.0' }
@@ -286,6 +288,7 @@ class Shoptet
286
288
  end
287
289
 
288
290
  def post_json(url, data, retry_on_token_error = true)
291
+ @api_token ||= @on_token_error.call(self)
289
292
  url = URI(url)
290
293
  headers = { 'Shoptet-Access-Token' => @api_token,
291
294
  'Content-Type' => 'application/vnd.shoptet.v1.0' }
@@ -305,6 +308,7 @@ class Shoptet
305
308
  end
306
309
 
307
310
  def post_binary(url, data, retry_on_token_error = true)
311
+ @api_token ||= @on_token_error.call(self)
308
312
  url = URI(url)
309
313
  headers = { 'Shoptet-Access-Token' => @api_token,
310
314
  'Content-Type' => 'application/vnd.shoptet.v1.0' }
@@ -324,6 +328,7 @@ class Shoptet
324
328
  end
325
329
 
326
330
  def delete(url, retry_on_token_error = true)
331
+ @api_token ||= @on_token_error.call(self)
327
332
  url = URI(url)
328
333
  headers = { 'Shoptet-Access-Token' => @api_token,
329
334
  'Content-Type' => 'application/vnd.shoptet.v1.0' }
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.54
4
+ version: 0.0.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Premysl Donat