summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/super_good/solidus_taxjar.rb4
-rw-r--r--lib/super_good/solidus_taxjar/calculator_helper.rb6
-rw-r--r--lib/super_good/solidus_taxjar/tax_calculator.rb2
-rw-r--r--lib/super_good/solidus_taxjar/tax_rate_calculator.rb2
4 files changed, 6 insertions, 8 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb
index bdd2dcd..f45db80 100644
--- a/lib/super_good/solidus_taxjar.rb
+++ b/lib/super_good/solidus_taxjar.rb
@@ -25,6 +25,10 @@ module SuperGood
attr_accessor :taxable_address_check
attr_accessor :taxable_order_check
attr_accessor :test_mode
+
+ def api
+ ::SuperGood::SolidusTaxJar::API.new
+ end
end
self.cache_duration = 3.hours
diff --git a/lib/super_good/solidus_taxjar/calculator_helper.rb b/lib/super_good/solidus_taxjar/calculator_helper.rb
index f8690b5..c4803a4 100644
--- a/lib/super_good/solidus_taxjar/calculator_helper.rb
+++ b/lib/super_good/solidus_taxjar/calculator_helper.rb
@@ -3,12 +3,6 @@ module SuperGood
module CalculatorHelper
extend ActiveSupport::Concern
- class_methods do
- def default_api
- ::SuperGood::SolidusTaxJar::API.new
- end
- end
-
def incomplete_address?(address)
return true if address.is_a?(Spree::Tax::TaxLocation)
diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb
index 520fffe..88eee2a 100644
--- a/lib/super_good/solidus_taxjar/tax_calculator.rb
+++ b/lib/super_good/solidus_taxjar/tax_calculator.rb
@@ -3,7 +3,7 @@ module SuperGood
class TaxCalculator
include CalculatorHelper
- def initialize(order, api: self.class.default_api)
+ def initialize(order, api: SuperGood::SolidusTaxJar.api)
@order = order
@api = api
end
diff --git a/lib/super_good/solidus_taxjar/tax_rate_calculator.rb b/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
index 8f513a5..f9c996c 100644
--- a/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
+++ b/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
@@ -2,7 +2,7 @@ module SuperGood
module SolidusTaxJar
class TaxRateCalculator
include CalculatorHelper
- def initialize(address, api: self.class.default_api)
+ def initialize(address, api: SuperGood::SolidusTaxJar.api)
@address = address
@api = api
end