diff options
author | Adnan Abdulally <adnan.abdulally@printivity.com> | 2021-01-29 10:27:06 -0800 |
---|---|---|
committer | Noah Silvera <noah@super.gd> | 2021-03-17 07:11:08 -0700 |
commit | 37fa5e7c81ee44012c86eabb140db760d55eae3b (patch) | |
tree | 0d8b8b9efe31b8999f06b3d18ea5f6f50049ef96 /lib/super_good | |
parent | 51ff05c3de3500fdc6aee55e2919646028055286 (diff) |
Rename classes that have API in their name to Api
This done so Zeitwerk can correctly can correctly load the class
from the filename.
Co-authored-by: Nick Van Doorn <nick@super.gd>
Diffstat (limited to 'lib/super_good')
-rw-r--r-- | lib/super_good/solidus_taxjar.rb | 4 | ||||
-rw-r--r-- | lib/super_good/solidus_taxjar/api.rb | 16 | ||||
-rw-r--r-- | lib/super_good/solidus_taxjar/api_params.rb | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb index 9c773be..36b5d85 100644 --- a/lib/super_good/solidus_taxjar.rb +++ b/lib/super_good/solidus_taxjar.rb @@ -28,14 +28,14 @@ module SuperGood attr_accessor :test_mode def api - ::SuperGood::SolidusTaxjar::API.new + ::SuperGood::SolidusTaxjar::Api.new end end self.cache_duration = 3.hours self.cache_key = ->(record) { record_type = record.class.name.demodulize.underscore - APIParams.send("#{record_type}_params", record).to_json + ApiParams.send("#{record_type}_params", record).to_json } self.custom_order_params = ->(order) { {} } self.discount_calculator = ::SuperGood::SolidusTaxjar::DiscountCalculator diff --git a/lib/super_good/solidus_taxjar/api.rb b/lib/super_good/solidus_taxjar/api.rb index c9cc99f..ca6ff6c 100644 --- a/lib/super_good/solidus_taxjar/api.rb +++ b/lib/super_good/solidus_taxjar/api.rb @@ -1,6 +1,6 @@ module SuperGood module SolidusTaxjar - class API + class Api def self.default_taxjar_client ::Taxjar::Client.new( api_key: ENV.fetch("TAXJAR_API_KEY"), @@ -16,7 +16,7 @@ module SuperGood end def tax_for(order) - taxjar_client.tax_for_order(APIParams.order_params(order)).tap do |taxes| + taxjar_client.tax_for_order(ApiParams.order_params(order)).tap do |taxes| next unless SuperGood::SolidusTaxjar.logging_enabled Rails.logger.info( @@ -26,19 +26,19 @@ module SuperGood end def tax_rate_for(address) - taxjar_client.tax_for_order(APIParams.tax_rate_address_params(address)).rate + taxjar_client.tax_for_order(ApiParams.tax_rate_address_params(address)).rate end def tax_rates_for(address) - taxjar_client.rates_for_location(*APIParams.address_params(address)) + taxjar_client.rates_for_location(*ApiParams.address_params(address)) end def create_transaction_for(order) - taxjar_client.create_order APIParams.transaction_params(order) + taxjar_client.create_order ApiParams.transaction_params(order) end def update_transaction_for(order) - taxjar_client.update_order APIParams.transaction_params(order) + taxjar_client.update_order ApiParams.transaction_params(order) end def delete_transaction_for(order) @@ -46,11 +46,11 @@ module SuperGood end def create_refund_for(reimbursement) - taxjar_client.create_refund APIParams.refund_params(reimbursement) + taxjar_client.create_refund ApiParams.refund_params(reimbursement) end def validate_spree_address(spree_address) - taxjar_client.validate_address APIParams.validate_address_params(spree_address) + taxjar_client.validate_address ApiParams.validate_address_params(spree_address) end private diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb index ac6abf4..ebf034d 100644 --- a/lib/super_good/solidus_taxjar/api_params.rb +++ b/lib/super_good/solidus_taxjar/api_params.rb @@ -1,6 +1,6 @@ module SuperGood module SolidusTaxjar - module APIParams + module ApiParams class << self def order_params(order) {} |