shoptet 0.0.53 → 0.0.55
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 +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3973988132bd7183d479a1e86cca5aea7ea6ac436390806c06bd1f62865f12f7
|
4
|
+
data.tar.gz: 897b12f9a8dae2f05f79369854ae04181980ebb854741b7802047634e5f0fbb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
32
|
+
'0.0.55'
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.ar_on_token_error(model)
|
@@ -81,13 +81,13 @@ class Shoptet
|
|
81
81
|
|
82
82
|
attr_accessor :api_token
|
83
83
|
|
84
|
-
def initialize
|
84
|
+
def initialize(oauth_url:, oauth_token:, shop_url:, client_id:, api_token: nil, on_token_error: nil)
|
85
85
|
@oauth_url = oauth_url
|
86
86
|
@oauth_token = oauth_token
|
87
87
|
@shop_url = shop_url
|
88
88
|
@client_id = client_id
|
89
|
-
@api_token = api_token
|
90
89
|
@on_token_error = on_token_error || ON_TOKEN_ERROR
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoptet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Premysl Donat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|