summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Van Doorn <vandoorn.nick@gmail.com>2021-02-24 14:51:18 -0800
committerNoah Silvera <noah@super.gd>2021-03-25 15:41:38 -0700
commitf7a9ee1c939e2e1bb85e59b9dd1a32c751cfb492 (patch)
treed86dbe3c41571083b88729134556b869a85a1ac7
parent7ed6f05c68e51369407b0d2fdb54b9f7fd298483 (diff)
Add nexus regions method to API
We want to start syncing nexus data from TaxJar to this extension. As such we start by implementing an API call to fetch nexus regions from TaxJar. Future commits should offer path for users to persist this data in their Solidus store. Co-authored-by: Noah Silvera <noah@super.gd> Co-authored-by: Adnan Abdulally <adnan.abdulally@printivity.com>
-rw-r--r--lib/super_good/solidus_taxjar/api.rb4
-rw-r--r--spec/super_good/solidus_taxjar/api_spec.rb15
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/api.rb b/lib/super_good/solidus_taxjar/api.rb
index 096994b..715eb5c 100644
--- a/lib/super_good/solidus_taxjar/api.rb
+++ b/lib/super_good/solidus_taxjar/api.rb
@@ -55,6 +55,10 @@ module SuperGood
taxjar_client.validate_address ApiParams.validate_address_params(spree_address)
end
+ def nexus_regions
+ taxjar_client.nexus_regions
+ end
+
private
attr_reader :taxjar_client
diff --git a/spec/super_good/solidus_taxjar/api_spec.rb b/spec/super_good/solidus_taxjar/api_spec.rb
index 94f214d..df46a11 100644
--- a/spec/super_good/solidus_taxjar/api_spec.rb
+++ b/spec/super_good/solidus_taxjar/api_spec.rb
@@ -202,4 +202,19 @@ RSpec.describe SuperGood::SolidusTaxjar::Api do
it { is_expected.to eq({some_kind_of: "response"}) }
end
+
+ describe "#nexus_regions" do
+ subject { api.nexus_regions }
+
+ let(:api) { described_class.new(taxjar_client: dummy_client) }
+ let(:dummy_client) { instance_double ::Taxjar::Client }
+
+ before do
+ allow(dummy_client)
+ .to receive(:nexus_regions)
+ .and_return({some_kind_of: "response"})
+ end
+
+ it { is_expected.to eq({some_kind_of: "response"}) }
+ end
end