shopify_unlimited 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module ::ShopifyUnlimited
2
- class CreditUsed
3
- SHOPIFY_CREDIT_LIMIT_PERIOD = 5.minutes
2
+
3
+ class CreditUsed
4
4
 
5
5
  attr_accessor :time, :used
6
6
  def initialize(used)
@@ -9,11 +9,11 @@ module ::ShopifyUnlimited
9
9
  end
10
10
 
11
11
  def stale?(used)
12
- (@used > used) || ((Time.now - @time) > SHOPIFY_CREDIT_LIMIT_PERIOD)
12
+ (@used > used) || ((Time.now - @time) > ShopifyUnlimited::SHOPIFY_CREDIT_LIMIT_PERIOD)
13
13
  end
14
14
 
15
15
  def estimated_time_until_reset
16
- est = SHOPIFY_CREDIT_LIMIT_PERIOD - (Time.now - @time)
16
+ est = ShopifyUnlimited::SHOPIFY_CREDIT_LIMIT_PERIOD - (Time.now - @time)
17
17
  [est, 0].max
18
18
  end
19
19
 
@@ -32,7 +32,7 @@ module ::ActiveResource
32
32
  used = shopify_credit_header.split('/').shift.to_i
33
33
 
34
34
  if @shopify_credit.nil?
35
- cached_time = ::ShopifyUnlimited.cached_time(SHOPIFY_CREDIT_LIMIT_PERIOD)
35
+ cached_time = ::ShopifyUnlimited.cached_time(ShopifyUnlimited::SHOPIFY_CREDIT_LIMIT_PERIOD)
36
36
  @shopify_credit = ::ShopifyUnlimited::CreditUsed.new(used)
37
37
  @shopify_credit.time = cached_time
38
38
  elsif @shopify_credit.stale?(used)
@@ -1,3 +1,3 @@
1
1
  module ShopifyUnlimited
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -3,6 +3,8 @@ require 'shopify_unlimited/active_resource/base_extensions'
3
3
  require 'shopify_unlimited/active_resource/connection_extensions'
4
4
 
5
5
  module ShopifyUnlimited
6
+ SHOPIFY_CREDIT_LIMIT_PERIOD = 5.minutes
7
+
6
8
  class << self
7
9
  attr_accessor :use_memcached
8
10
  def memcached
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_unlimited
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  segments:
143
143
  - 0
144
- hash: -3723036348275054820
144
+ hash: -2004155460497678589
145
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  none: false
147
147
  requirements:
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: -3723036348275054820
153
+ hash: -2004155460497678589
154
154
  requirements: []
155
155
  rubyforge_project:
156
156
  rubygems_version: 1.8.25