lucid_shopify 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfdeb0dc25b60cdb4367ba807ac4adbe4ea7df1a1f47e99f86f2e4e24dd3e20d
4
- data.tar.gz: 8bab3d9b32537747d4fa06afd2e3779ecd28135d1ac7eebe3f7c68f13fb6911e
3
+ metadata.gz: d302ee03a14fad6032ab30eb06d07d858a085d3d1befa395716f5def19d999db
4
+ data.tar.gz: d773c4c5059b0fe0294ad708e5cefe1be1c3c978ca5ad1ca2b40a56467b13ec2
5
5
  SHA512:
6
- metadata.gz: 8538d7ea6ef1d29f3b11553e3224c366742f250827c1e5df83c4edf096b45363d60b11d32ed274023dc0d99e0e29a08e523f063245a0d20df30711fe775e3c87
7
- data.tar.gz: 28b1379260032703e6be037283874dae3e0da88138d24ad3373799edb222d3171236715a6da739347fe3bf8d4d88132a418793bfe665ae625281bbf5b3372756
6
+ metadata.gz: e6f5b158605a962be8cdac9bdde5f57bb0102baa1670b1dbd67aa9bcf4b89b74b47b674de44a2336ca3a8d0591246c98c26fe7cf91ce2a8cc81fe6d931173f4b
7
+ data.tar.gz: ee6ccfadededbe26459382419b8f530bfd09cbc0d85c1b18dedc613f0039f276a3c536b18ddac1f65a2dd2729b46c014ae556c8ba99179a5e7d7553e083005b8
@@ -9,19 +9,21 @@ module LucidShopify
9
9
  #
10
10
  # @see SendRequest#call
11
11
  #
12
- def call(*)
13
- interval
12
+ def call(request, attempts: default_attempts)
13
+ interval(build_interval_key(request))
14
14
 
15
- super
15
+ super(request, attempts: attempts)
16
16
  end
17
17
 
18
18
  #
19
19
  # Sleep for the difference if time since the last request is less than the
20
20
  # MINIMUM_INTERVAL.
21
21
  #
22
+ # @param interval_key [String]
23
+ #
22
24
  # @note Throttling is only maintained across a single thread.
23
25
  #
24
- private def interval
26
+ private def interval(interval_key)
25
27
  if Thread.current[interval_key]
26
28
  (timestamp - Thread.current[interval_key]).tap do |n|
27
29
  sleep(Rational(n, 1000)) if n < MINIMUM_INTERVAL
@@ -31,10 +33,12 @@ module LucidShopify
31
33
  Thread.current[interval_key] = timestamp
32
34
  end
33
35
 
36
+ #
37
+ # @param request [Request]
34
38
  #
35
39
  # @return [String]
36
40
  #
37
- private def interval_key
41
+ private def build_interval_key(request)
38
42
  '%s[%s].timestamp' % [self.class, request.credentials.myshopify_domain]
39
43
  end
40
44
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucidShopify
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid_shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelsey Judson