shopify_api_rate_limiter 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33a6a1a8a76f3bedb32b809f592bc15ed4f8194c
4
- data.tar.gz: 9958de8df28406f4dcb7757c48f2d5cf55132212
3
+ metadata.gz: 2e90c911f0de74607d1ab9baeb6544ca31e6431f
4
+ data.tar.gz: adaaf6350af34558329b6cb845b0c786307b317c
5
5
  SHA512:
6
- metadata.gz: c70f29561c5c7df1263fc9e37917d2e93efa8a9c6a83f22d5ef32398f69575819faea071b4eed11ff907d06798170fb03c8bba2ab751c262035b9a54eb621525
7
- data.tar.gz: ed33c9e985de6fe725768d8a390ab72ba44089848be272440c094f29d87aedc48dcd82645e2f23151609912522904d3db3aff101a1471544b669528a52d287a3
6
+ metadata.gz: 29254f53f4d9a0716b6a8edeae37f95647c1dca30bfd9e68c4c19f4a61a7ffa30e997d05ee38fa302ebf49434bb14f7544bfc9d0922f53357565bc2920628688
7
+ data.tar.gz: 45f896d133cacdff96f1cb37b877c129cd85628ec613e50999dc7cd29fb8f12b84eb470a670008eb6a4084d2c22779a5fccc6ec49e4edc136d3ff75619cd5766
@@ -1,4 +1,6 @@
1
1
  module ShopifyApiRateLimiter
2
+ class DailySkuLimitError < ::ActiveResource::ClientError ; end
3
+
2
4
  module ThrottledConnection
3
5
  SHOPIFY_SLEEP_TIME = 0.5
4
6
 
@@ -11,7 +13,9 @@ module ShopifyApiRateLimiter
11
13
  begin
12
14
  super
13
15
  rescue ActiveResource::ClientError => ex
14
- if ex&.response&.code&.to_s == '429'
16
+ if ex.response.body == '{"errors":{"product":["Daily SKU limit reached. Please try again later."]}}'
17
+ raise ShopifyApiRateLimiter::DailySkuLimitError, "Daily Sku Limit Reached for Shopify Admin API"
18
+ elsif ex&.response&.code&.to_s == '429'
15
19
  ShopifyApiRateLimiter.logger.info "Shopify returned 429 (Rate Limit Exceeded). Sleeping #{SHOPIFY_SLEEP_TIME}..."
16
20
  sleep(SHOPIFY_SLEEP_TIME)
17
21
  retry
@@ -1,3 +1,3 @@
1
1
  module ShopifyApiRateLimiter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api_rate_limiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Buehler
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.6.8
78
+ rubygems_version: 2.6.14.3
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Rate limits API requests to the Shopify API.