super_good-solidus_taxjar 0.8.0 → 0.9.0

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: 585bf440ad21af1f0c08ebefd59103c358d8ab66afbf33ce2837295bc61bb0c6
4
- data.tar.gz: 37b7a8337ef47427c549daf5ad766d477d75266e7225689a2666bb991335a76d
3
+ metadata.gz: 1a82704376f8b817673d0c0565ec13285644b4317a9b303615c82584aebb226a
4
+ data.tar.gz: 0f033f36b7a588b8363af52917ccb58bc95379f3be780dd1f78a5f512bf082db
5
5
  SHA512:
6
- metadata.gz: 11a30860f370609adffde9015b1493bdadc774742c13809232898c8356e1578ebe49310bbde3fd905df3ffc8b3b994692328b9a25e622c0a269c7e671ea42ca5
7
- data.tar.gz: ce36bbd03e443a98914ba6459e6fc9a9cef4e15fe94face5e95a2eb89598cb30fbb22c20d352c690154eba0b9030df81a608327918c4e76d43d347d129b46b7d
6
+ metadata.gz: 695e4267b668489ad5c0a9f9a18000093cdb94e5ae53be5cfc95ea7024ea25dc8cb5a291404dfafd634942bd921524da94d05341f624cdf484c31193026daa70
7
+ data.tar.gz: 4aa9373711d1d614f0a188db24fffe4f329d43b069677d272aff3b2caf82a9eb4e3333a90d3b64a90d5931104fad8952673628c371aad34a270335935089bd96
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## master
4
+
5
+ ## v0.9.0
6
+
7
+ - Made response cache key and cache duration configurable.
8
+
3
9
  ## v0.8.0
4
10
 
5
11
  - Increased response caching time to 3 hours.
@@ -116,20 +116,17 @@ module SuperGood
116
116
 
117
117
  def cache
118
118
  if !Rails.env.test?
119
- Rails.cache.fetch(cache_key, expires_in: 3.hours) { yield }
119
+ Rails.cache.fetch(
120
+ cache_key,
121
+ expires_in: SuperGood::SolidusTaxJar.cache_duration
122
+ ) { yield }
120
123
  else
121
124
  yield
122
125
  end
123
126
  end
124
127
 
125
128
  def cache_key
126
- APIParams.order_params(order).transform_values do |value|
127
- case value
128
- when Array, Hash then value.hash
129
- else
130
- value
131
- end
132
- end
129
+ SuperGood::SolidusTaxJar.cache_key.(order)
133
130
  end
134
131
 
135
132
  def exception_handler
@@ -1,5 +1,5 @@
1
1
  module SuperGood
2
2
  module SolidusTaxJar
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -11,21 +11,33 @@ require "super_good/solidus_taxjar/discount_calculator"
11
11
  module SuperGood
12
12
  module SolidusTaxJar
13
13
  class << self
14
+ attr_accessor :cache_duration
15
+ attr_accessor :cache_key
14
16
  attr_accessor :discount_calculator
15
- attr_accessor :test_mode
16
17
  attr_accessor :exception_handler
17
- attr_accessor :taxable_address_check
18
- attr_accessor :shipping_tax_label_maker
19
18
  attr_accessor :line_item_tax_label_maker
19
+ attr_accessor :shipping_tax_label_maker
20
+ attr_accessor :taxable_address_check
21
+ attr_accessor :test_mode
20
22
  end
21
23
 
24
+ self.cache_duration = 3.hours
25
+ self.cache_key = ->(order) {
26
+ APIParams.order_params(order).transform_values do |value|
27
+ case value
28
+ when Array, Hash then value.hash
29
+ else
30
+ value
31
+ end
32
+ end
33
+ }
22
34
  self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator
23
- self.test_mode = false
24
35
  self.exception_handler = ->(e) {
25
36
  Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}"
26
37
  }
27
- self.taxable_address_check = ->(address) { true }
28
- self.shipping_tax_label_maker = ->(shipment, shipping_tax) { "Sales Tax" }
29
38
  self.line_item_tax_label_maker = ->(taxjar_line_item, spree_line_item) { "Sales Tax" }
39
+ self.shipping_tax_label_maker = ->(shipment, shipping_tax) { "Sales Tax" }
40
+ self.taxable_address_check = ->(address) { true }
41
+ self.test_mode = false
30
42
  end
31
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_good-solidus_taxjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core