shoptet 0.0.52 → 0.0.54
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 +6 -7
- 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: 0d1540eac2f1805254cc70fd81b16e333368bfa2b14344361e9531e4890637d0
|
4
|
+
data.tar.gz: 0200d1d0258da7d2014bb49e4b8092eb85f006ac0bbb52898ddff77269f62e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 570517fe21155f6fd7d28d701885acb996e2842b46a603f03c6f92d011f34d5037bc90d8347e12ce844b5ada429733762a532d38fa93c548167ca83c96d427ce
|
7
|
+
data.tar.gz: 44a5b9002f63a7518c3a3964f62585734dceaff60e3c3ce2b144997825995c3eadec69a21049432770666b41c1a9412b3685e4d802221b3694eefcaafd7859ac
|
data/lib/shoptet.rb
CHANGED
@@ -18,6 +18,7 @@ class Shoptet
|
|
18
18
|
class NonJSONResponse < StandardError; end
|
19
19
|
class ProjectNotFound < StandardError; end
|
20
20
|
class TooManyRequests < StandardError; end
|
21
|
+
class UrlLocked < StandardError; end
|
21
22
|
|
22
23
|
EXPIRED_TOKEN_CODE = 'expired-token'
|
23
24
|
INVALID_TOKEN_CODE = 'invalid-token'
|
@@ -28,7 +29,7 @@ class Shoptet
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.version
|
31
|
-
'0.0.
|
32
|
+
'0.0.54'
|
32
33
|
end
|
33
34
|
|
34
35
|
def self.ar_on_token_error(model)
|
@@ -80,13 +81,13 @@ class Shoptet
|
|
80
81
|
|
81
82
|
attr_accessor :api_token
|
82
83
|
|
83
|
-
def initialize
|
84
|
+
def initialize(oauth_url:, oauth_token:, shop_url:, client_id:, api_token: nil, on_token_error: nil)
|
84
85
|
@oauth_url = oauth_url
|
85
86
|
@oauth_token = oauth_token
|
86
87
|
@shop_url = shop_url
|
87
88
|
@client_id = client_id
|
88
|
-
@api_token = api_token
|
89
89
|
@on_token_error = on_token_error || ON_TOKEN_ERROR
|
90
|
+
@api_token = api_token || @on_token_error.call(self)
|
90
91
|
end
|
91
92
|
|
92
93
|
def endpoints api_params = {}
|
@@ -234,10 +235,6 @@ class Shoptet
|
|
234
235
|
enumerize("https://api.myshoptet.com/api/webhooks", api_params)
|
235
236
|
end
|
236
237
|
|
237
|
-
def endpoints(api_params={})
|
238
|
-
enumerize("https://api.myshoptet.com/api/system/endpoints", api_params)
|
239
|
-
end
|
240
|
-
|
241
238
|
def new_api_token
|
242
239
|
headers = { 'Authorization' => "Bearer #{@oauth_token}" }
|
243
240
|
|
@@ -389,6 +386,8 @@ class Shoptet
|
|
389
386
|
raise MaxPageReached.new(result)
|
390
387
|
elsif errors.any? { |err| err["errorCode"] == 'too-many-requests' }
|
391
388
|
raise TooManyRequests.new(result)
|
389
|
+
elsif errors.any? { |err| err["errorCode"] == 'locked' }
|
390
|
+
raise UrlLocked.new(result)
|
392
391
|
else
|
393
392
|
raise Error.new(result)
|
394
393
|
end
|
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.54
|
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
|