taxjar-ruby 2.4.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,15 +26,25 @@ module Taxjar
26
26
  end
27
27
 
28
28
  def perform
29
- options_key = @request_method == :get ? :params : :json
30
- response = HTTP.timeout(@http_timeout).headers(headers)
31
- .request(request_method, uri.to_s, options_key => @options)
32
- response_body = symbolize_keys!(response.parse)
33
- fail_or_return_response_body(response.code, response_body)
29
+ options_key = [:get, :delete].include?(@request_method) ? :params : :json
30
+ response = build_http_client.request(request_method, uri.to_s, options_key => @options)
31
+ response_body =
32
+ begin
33
+ symbolize_keys!(response.parse(:json))
34
+ rescue JSON::ParserError
35
+ nil
36
+ end
37
+ fail_or_return_response_body(response, response_body)
34
38
  end
35
39
 
36
40
  private
37
41
 
42
+ def build_http_client
43
+ http_client = HTTP.timeout(@http_timeout).headers(headers)
44
+ http_client = http_client.via(*client.http_proxy) if client.http_proxy
45
+ http_client
46
+ end
47
+
38
48
  def set_request_headers(custom_headers = {})
39
49
  @headers = {}
40
50
  @headers[:user_agent] = client.user_agent
@@ -62,16 +72,15 @@ module Taxjar
62
72
  object
63
73
  end
64
74
 
65
- def fail_or_return_response_body(code, body)
66
- e = extract_error(code, body)
67
- fail(e) if e
68
- body[object_key.to_sym]
69
- end
70
-
71
- def extract_error(code, body)
72
- klass = Taxjar::Error::ERRORS[code]
73
- if !klass.nil?
74
- klass.from_response(body)
75
+ def fail_or_return_response_body(response, body)
76
+ if body.nil?
77
+ fail(Taxjar::Error.for_json_parse_error(response.code))
78
+ elsif response.status.success?
79
+ body[object_key.to_sym]
80
+ elsif !(klass = Taxjar::Error::ERRORS[response.code]).nil?
81
+ fail(klass.from_response(body))
82
+ else
83
+ fail(Taxjar::Error.from_response_code(response.code))
75
84
  end
76
85
  end
77
86
  end
data/lib/taxjar/client.rb CHANGED
@@ -16,6 +16,7 @@ module Taxjar
16
16
  attr_accessor :api_key
17
17
  attr_accessor :api_url
18
18
  attr_accessor :headers
19
+ attr_accessor :http_proxy
19
20
 
20
21
  def initialize(options = {})
21
22
  options.each do |key, value|
@@ -37,7 +38,14 @@ module Taxjar
37
38
  end
38
39
 
39
40
  def user_agent
40
- "TaxjarRubyGem/#{Taxjar::Version}"
41
+ def platform
42
+ (`uname -a` || '').strip
43
+ rescue Errno::ENOENT, Errno::ENOMEM
44
+ ''
45
+ end
46
+ ruby_version = "ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
47
+ openSSL_version = OpenSSL::OPENSSL_LIBRARY_VERSION
48
+ "TaxJar/Ruby (#{platform}; #{ruby_version}; #{openSSL_version}) taxjar-ruby/#{Taxjar::Version}"
41
49
  end
42
50
  end
43
51
  end
data/lib/taxjar/error.rb CHANGED
@@ -61,6 +61,15 @@ module Taxjar
61
61
  new(message, code)
62
62
  end
63
63
 
64
+ def from_response_code(code)
65
+ message = HTTP::Response::Status::REASONS[code] || "Unknown Error"
66
+ new(message, code)
67
+ end
68
+
69
+ def for_json_parse_error(code)
70
+ ServerError.new("Couldn't parse response as JSON.", code)
71
+ end
72
+
64
73
  end
65
74
 
66
75
  def initialize(message = '', code = nil)
data/lib/taxjar/order.rb CHANGED
@@ -3,10 +3,12 @@ require 'taxjar/base'
3
3
  module Taxjar
4
4
  class Order < Taxjar::Base
5
5
  extend ModelAttribute
6
-
6
+
7
7
  attribute :transaction_id, :string
8
8
  attribute :user_id, :integer
9
9
  attribute :transaction_date, :string
10
+ attribute :provider, :string
11
+ attribute :exemption_type, :string
10
12
  attribute :from_country, :string
11
13
  attribute :from_zip, :string
12
14
  attribute :from_state, :string
data/lib/taxjar/refund.rb CHANGED
@@ -3,11 +3,13 @@ require 'taxjar/base'
3
3
  module Taxjar
4
4
  class Refund < Taxjar::Base
5
5
  extend ModelAttribute
6
-
6
+
7
7
  attribute :transaction_id, :string
8
8
  attribute :user_id, :integer
9
9
  attribute :transaction_date, :string
10
10
  attribute :transaction_reference_id, :string
11
+ attribute :provider, :string
12
+ attribute :exemption_type, :string
11
13
  attribute :from_country, :string
12
14
  attribute :from_zip, :string
13
15
  attribute :from_state, :string
data/lib/taxjar/tax.rb CHANGED
@@ -12,6 +12,7 @@ module Taxjar
12
12
  attribute :has_nexus, :boolean
13
13
  attribute :freight_taxable, :boolean
14
14
  attribute :tax_source, :string
15
+ attribute :exemption_type, :string
15
16
 
16
17
  object_attr_reader Taxjar::Jurisdictions, :jurisdictions
17
18
  object_attr_reader Taxjar::Breakdown, :breakdown
@@ -2,11 +2,11 @@ module Taxjar
2
2
  module Version
3
3
  module_function
4
4
  def major
5
- 2
5
+ 3
6
6
  end
7
7
 
8
8
  def minor
9
- 4
9
+ 0
10
10
  end
11
11
 
12
12
  def patch
@@ -3,6 +3,8 @@
3
3
  "transaction_id": "123",
4
4
  "user_id": 10649,
5
5
  "transaction_date": "2015-05-14T00:00:00Z",
6
+ "provider": "api",
7
+ "exemption_type": "non_exempt",
6
8
  "from_country": "US",
7
9
  "from_zip": "93107",
8
10
  "from_state": "CA",
@@ -4,6 +4,8 @@
4
4
  "user_id": 10649,
5
5
  "transaction_date": "2015-05-14T00:00:00Z",
6
6
  "transaction_reference_id": "123",
7
+ "provider": "api",
8
+ "exemption_type": "non_exempt",
7
9
  "from_country": "US",
8
10
  "from_zip": "93107",
9
11
  "from_state": "CA",
@@ -8,6 +8,7 @@
8
8
  "has_nexus": true,
9
9
  "freight_taxable": true,
10
10
  "tax_source": "destination",
11
+ "exemption_type": "non_exempt",
11
12
  "jurisdictions": {
12
13
  "country": "US",
13
14
  "state": "NJ",
@@ -8,6 +8,7 @@
8
8
  "has_nexus": true,
9
9
  "freight_taxable": true,
10
10
  "tax_source": "destination",
11
+ "exemption_type": "non_exempt",
11
12
  "jurisdictions": {
12
13
  "country": "CA",
13
14
  "state": "ON"
@@ -8,6 +8,7 @@
8
8
  "has_nexus": true,
9
9
  "freight_taxable": true,
10
10
  "tax_source": "destination",
11
+ "exemption_type": "non_exempt",
11
12
  "jurisdictions": {
12
13
  "country": "FI"
13
14
  },
@@ -168,6 +168,7 @@ describe Taxjar::API do
168
168
  :to_zip => '07446',
169
169
  :amount => 16.50,
170
170
  :shipping => 1.5,
171
+ :exemption_type => 'non_exempt',
171
172
  :line_items => [{:line_item => {:id => '1',
172
173
  :quantity => 1,
173
174
  :unit_price => 15.0,
@@ -191,6 +192,7 @@ describe Taxjar::API do
191
192
  expect(tax.has_nexus).to eq(true)
192
193
  expect(tax.freight_taxable).to eq(true)
193
194
  expect(tax.tax_source).to eq('destination')
195
+ expect(tax.exemption_type).to eq('non_exempt')
194
196
  end
195
197
 
196
198
  it 'allows access to jurisdictions' do
@@ -275,6 +277,7 @@ describe Taxjar::API do
275
277
  expect(tax.has_nexus).to eq(true)
276
278
  expect(tax.freight_taxable).to eq(true)
277
279
  expect(tax.tax_source).to eq('destination')
280
+ expect(tax.exemption_type).to eq('non_exempt')
278
281
  end
279
282
 
280
283
  it 'allows access to jurisdictions' do
@@ -330,6 +333,7 @@ describe Taxjar::API do
330
333
  expect(tax.has_nexus).to eq(true)
331
334
  expect(tax.freight_taxable).to eq(true)
332
335
  expect(tax.tax_source).to eq('destination')
336
+ expect(tax.exemption_type).to eq('non_exempt')
333
337
  end
334
338
 
335
339
  it 'allows access to jurisdictions' do
@@ -28,7 +28,7 @@ describe Taxjar::API::Order do
28
28
 
29
29
  context "with parameters" do
30
30
  before do
31
- stub_get('/v2/transactions/orders?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31').
31
+ stub_get('/v2/transactions/orders?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31&provider=api').
32
32
  to_return(body: fixture('orders.json'),
33
33
  headers: {content_type: 'application/json; charset=utf-8'})
34
34
 
@@ -36,13 +36,15 @@ describe Taxjar::API::Order do
36
36
 
37
37
  it 'requests the right resource' do
38
38
  @client.list_orders(from_transaction_date: '2015/05/01',
39
- to_transaction_date: '2015/05/31')
40
- expect(a_get('/v2/transactions/orders?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31')).to have_been_made
39
+ to_transaction_date: '2015/05/31',
40
+ provider: 'api')
41
+ expect(a_get('/v2/transactions/orders?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31&provider=api')).to have_been_made
41
42
  end
42
43
 
43
44
  it 'returns the requested orders' do
44
45
  orders = @client.list_orders(from_transaction_date: '2015/05/01',
45
- to_transaction_date: '2015/05/31')
46
+ to_transaction_date: '2015/05/31',
47
+ provider: 'api')
46
48
  expect(orders).to be_an Array
47
49
  expect(orders.first).to be_a String
48
50
  expect(orders.first).to eq('123')
@@ -52,22 +54,24 @@ describe Taxjar::API::Order do
52
54
 
53
55
  describe "#show_order" do
54
56
  before do
55
- stub_get('/v2/transactions/orders/123').
57
+ stub_get('/v2/transactions/orders/123?provider=api').
56
58
  to_return(body: fixture('order.json'),
57
59
  headers: {content_type: 'application/json; charset=utf-8'})
58
60
  end
59
61
 
60
62
  it 'requests the right resource' do
61
- @client.show_order('123')
62
- expect(a_get('/v2/transactions/orders/123')).to have_been_made
63
+ @client.show_order('123', provider: 'api')
64
+ expect(a_get('/v2/transactions/orders/123?provider=api')).to have_been_made
63
65
  end
64
66
 
65
67
  it 'returns the requested order' do
66
- order = @client.show_order('123')
68
+ order = @client.show_order('123', provider: 'api')
67
69
  expect(order).to be_an Taxjar::Order
68
70
  expect(order.transaction_id).to eq('123')
69
71
  expect(order.user_id).to eq(10649)
70
72
  expect(order.transaction_date).to eq('2015-05-14T00:00:00Z')
73
+ expect(order.provider).to eq('api')
74
+ expect(order.exemption_type).to eq('non_exempt')
71
75
  expect(order.from_country).to eq('US')
72
76
  expect(order.from_zip).to eq('93107')
73
77
  expect(order.from_state).to eq('CA')
@@ -84,7 +88,7 @@ describe Taxjar::API::Order do
84
88
  end
85
89
 
86
90
  it 'allows access to line_items' do
87
- order = @client.show_order('123')
91
+ order = @client.show_order('123', provider: 'api')
88
92
  expect(order.line_items[0].id).to eq('1')
89
93
  expect(order.line_items[0].quantity).to eq(1)
90
94
  expect(order.line_items[0].product_identifier).to eq('12-34243-9')
@@ -103,6 +107,8 @@ describe Taxjar::API::Order do
103
107
 
104
108
  @order = {:transaction_id => '123',
105
109
  :transaction_date => '2015/05/14',
110
+ :provider => 'api',
111
+ :exemption_type => 'non_exempt',
106
112
  :to_country => 'US',
107
113
  :to_zip => '90002',
108
114
  :to_city => 'Los Angeles',
@@ -132,6 +138,8 @@ describe Taxjar::API::Order do
132
138
  expect(order.transaction_id).to eq('123')
133
139
  expect(order.user_id).to eq(10649)
134
140
  expect(order.transaction_date).to eq("2015-05-14T00:00:00Z")
141
+ expect(order.provider).to eq('api')
142
+ expect(order.exemption_type).to eq('non_exempt')
135
143
  expect(order.from_country).to eq('US')
136
144
  expect(order.from_zip).to eq('93107')
137
145
  expect(order.from_state).to eq('CA')
@@ -146,7 +154,7 @@ describe Taxjar::API::Order do
146
154
  expect(order.shipping).to eq(1.5)
147
155
  expect(order.sales_tax).to eq(0.95)
148
156
  end
149
-
157
+
150
158
  it 'allows access to line_items' do
151
159
  order = @client.create_order(@order)
152
160
  expect(order.line_items[0].id).to eq('1')
@@ -169,6 +177,7 @@ describe Taxjar::API::Order do
169
177
  @order = {:transaction_id => '123',
170
178
  :amount => 17.95,
171
179
  :shipping => 2.0,
180
+ :exemption_type => 'non_exempt',
172
181
  :line_items => [{:id => 1,
173
182
  :quantity => 1,
174
183
  :product_identifier => '12-34243-0',
@@ -191,6 +200,8 @@ describe Taxjar::API::Order do
191
200
  expect(order.transaction_id).to eq('123')
192
201
  expect(order.user_id).to eq(10649)
193
202
  expect(order.transaction_date).to eq("2015-05-14T00:00:00Z")
203
+ expect(order.provider).to eq('api')
204
+ expect(order.exemption_type).to eq('non_exempt')
194
205
  expect(order.from_country).to eq('US')
195
206
  expect(order.from_zip).to eq('93107')
196
207
  expect(order.from_state).to eq('CA')
@@ -205,7 +216,7 @@ describe Taxjar::API::Order do
205
216
  expect(order.shipping).to eq(1.5)
206
217
  expect(order.sales_tax).to eq(0.95)
207
218
  end
208
-
219
+
209
220
  it 'allows access to line_items' do
210
221
  order = @client.update_order(@order)
211
222
  expect(order.line_items[0].id).to eq('1')
@@ -221,22 +232,24 @@ describe Taxjar::API::Order do
221
232
 
222
233
  describe "#delete_order" do
223
234
  before do
224
- stub_delete('/v2/transactions/orders/123').
235
+ stub_delete('/v2/transactions/orders/123?provider=api').
225
236
  to_return(body: fixture('order.json'),
226
237
  headers: {content_type: 'application/json; charset=utf-8'})
227
238
  end
228
239
 
229
240
  it 'requests the right resource' do
230
- @client.delete_order('123')
231
- expect(a_delete('/v2/transactions/orders/123')).to have_been_made
241
+ @client.delete_order('123', provider: 'api')
242
+ expect(a_delete('/v2/transactions/orders/123?provider=api')).to have_been_made
232
243
  end
233
244
 
234
245
  it 'returns the deleted order' do
235
- order = @client.delete_order('123')
246
+ order = @client.delete_order('123', provider: 'api')
236
247
  expect(order).to be_an Taxjar::Order
237
248
  expect(order.transaction_id).to eq('123')
238
249
  expect(order.user_id).to eq(10649)
239
250
  expect(order.transaction_date).to eq("2015-05-14T00:00:00Z")
251
+ expect(order.provider).to eq('api')
252
+ expect(order.exemption_type).to eq('non_exempt')
240
253
  expect(order.from_country).to eq('US')
241
254
  expect(order.from_zip).to eq('93107')
242
255
  expect(order.from_state).to eq('CA')
@@ -251,9 +264,9 @@ describe Taxjar::API::Order do
251
264
  expect(order.shipping).to eq(1.5)
252
265
  expect(order.sales_tax).to eq(0.95)
253
266
  end
254
-
267
+
255
268
  it 'allows access to line items' do
256
- order = @client.delete_order('123')
269
+ order = @client.delete_order('123', provider: 'api')
257
270
  expect(order.line_items[0].id).to eq('1')
258
271
  expect(order.line_items[0].quantity).to eq(1)
259
272
  expect(order.line_items[0].product_identifier).to eq('12-34243-9')
@@ -28,7 +28,7 @@ describe Taxjar::API::Refund do
28
28
 
29
29
  context "with parameters" do
30
30
  before do
31
- stub_get('/v2/transactions/refunds?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31').
31
+ stub_get('/v2/transactions/refunds?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31&provider=api').
32
32
  to_return(body: fixture('refunds.json'),
33
33
  headers: {content_type: 'application/json; charset=utf-8'})
34
34
 
@@ -36,13 +36,15 @@ describe Taxjar::API::Refund do
36
36
 
37
37
  it 'requests the right resource' do
38
38
  @client.list_refunds(from_transaction_date: '2015/05/01',
39
- to_transaction_date: '2015/05/31')
40
- expect(a_get('/v2/transactions/refunds?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31')).to have_been_made
39
+ to_transaction_date: '2015/05/31',
40
+ provider: 'api')
41
+ expect(a_get('/v2/transactions/refunds?from_transaction_date=2015/05/01&to_transaction_date=2015/05/31&provider=api')).to have_been_made
41
42
  end
42
43
 
43
44
  it 'returns the requested refunds' do
44
45
  refunds = @client.list_refunds(from_transaction_date: '2015/05/01',
45
- to_transaction_date: '2015/05/31')
46
+ to_transaction_date: '2015/05/31',
47
+ provider: 'api')
46
48
  expect(refunds).to be_an Array
47
49
  expect(refunds.first).to be_a String
48
50
  expect(refunds.first).to eq('321')
@@ -52,23 +54,25 @@ describe Taxjar::API::Refund do
52
54
 
53
55
  describe "#show_refund" do
54
56
  before do
55
- stub_get('/v2/transactions/refunds/321').
57
+ stub_get('/v2/transactions/refunds/321?provider=api').
56
58
  to_return(body: fixture('refund.json'),
57
59
  headers: {content_type: 'application/json; charset=utf-8'})
58
60
  end
59
61
 
60
62
  it 'requests the right resource' do
61
- @client.show_refund('321')
62
- expect(a_get('/v2/transactions/refunds/321')).to have_been_made
63
+ @client.show_refund('321', provider: 'api')
64
+ expect(a_get('/v2/transactions/refunds/321?provider=api')).to have_been_made
63
65
  end
64
66
 
65
67
  it 'returns the requested refund' do
66
- refund = @client.show_refund('321')
68
+ refund = @client.show_refund('321', provider: 'api')
67
69
  expect(refund).to be_an Taxjar::Refund
68
70
  expect(refund.transaction_id).to eq('321')
69
71
  expect(refund.user_id).to eq(10649)
70
72
  expect(refund.transaction_date).to eq("2015-05-14T00:00:00Z")
71
73
  expect(refund.transaction_reference_id).to eq("123")
74
+ expect(refund.provider).to eql('api')
75
+ expect(refund.exemption_type).to eq('non_exempt')
72
76
  expect(refund.from_country).to eq('US')
73
77
  expect(refund.from_zip).to eq('93107')
74
78
  expect(refund.from_state).to eq('CA')
@@ -83,9 +87,9 @@ describe Taxjar::API::Refund do
83
87
  expect(refund.shipping).to eq(1.5)
84
88
  expect(refund.sales_tax).to eq(0.95)
85
89
  end
86
-
90
+
87
91
  it 'allows access to line_items' do
88
- refund = @client.show_refund('321')
92
+ refund = @client.show_refund('321', provider: 'api')
89
93
  expect(refund.line_items[0].id).to eq('1')
90
94
  expect(refund.line_items[0].quantity).to eq(1)
91
95
  expect(refund.line_items[0].product_identifier).to eq('12-34243-9')
@@ -105,6 +109,8 @@ describe Taxjar::API::Refund do
105
109
  @refund = {:transaction_id => '321',
106
110
  :transaction_date => '2015/05/14',
107
111
  :transaction_reference_id => '123',
112
+ :provider => 'api',
113
+ :exemption_type => 'non_exempt',
108
114
  :to_country => 'US',
109
115
  :to_zip => '90002',
110
116
  :to_state => 'CA',
@@ -135,6 +141,8 @@ describe Taxjar::API::Refund do
135
141
  expect(refund.user_id).to eq(10649)
136
142
  expect(refund.transaction_date).to eq("2015-05-14T00:00:00Z")
137
143
  expect(refund.transaction_reference_id).to eq("123")
144
+ expect(refund.provider).to eq('api')
145
+ expect(refund.exemption_type).to eq('non_exempt')
138
146
  expect(refund.from_country).to eq('US')
139
147
  expect(refund.from_zip).to eq('93107')
140
148
  expect(refund.from_state).to eq('CA')
@@ -149,7 +157,7 @@ describe Taxjar::API::Refund do
149
157
  expect(refund.shipping).to eq(1.5)
150
158
  expect(refund.sales_tax).to eq(0.95)
151
159
  end
152
-
160
+
153
161
  it 'allows access to line_items' do
154
162
  refund = @client.create_refund(@refund)
155
163
  expect(refund.line_items[0].id).to eq('1')
@@ -173,6 +181,7 @@ describe Taxjar::API::Refund do
173
181
  :amount => 17.95,
174
182
  :shipping => 2.0,
175
183
  :sales_tax => 0.95,
184
+ :exemption_type => 'non_exempt',
176
185
  :line_items => [{:quantity => 1,
177
186
  :product_identifier => '12-34243-9',
178
187
  :description => 'Heavy Widget',
@@ -195,6 +204,8 @@ describe Taxjar::API::Refund do
195
204
  expect(refund.user_id).to eq(10649)
196
205
  expect(refund.transaction_date).to eq("2015-05-14T00:00:00Z")
197
206
  expect(refund.transaction_reference_id).to eq("123")
207
+ expect(refund.provider).to eq('api')
208
+ expect(refund.exemption_type).to eq('non_exempt')
198
209
  expect(refund.from_country).to eq('US')
199
210
  expect(refund.from_zip).to eq('93107')
200
211
  expect(refund.from_state).to eq('CA')
@@ -209,7 +220,7 @@ describe Taxjar::API::Refund do
209
220
  expect(refund.shipping).to eq(1.5)
210
221
  expect(refund.sales_tax).to eq(0.95)
211
222
  end
212
-
223
+
213
224
  it 'allows access to line_items' do
214
225
  refund = @client.update_refund(@refund)
215
226
  expect(refund.line_items[0].id).to eq('1')
@@ -225,23 +236,25 @@ describe Taxjar::API::Refund do
225
236
 
226
237
  describe "#delete_refund" do
227
238
  before do
228
- stub_delete('/v2/transactions/refunds/321').
239
+ stub_delete('/v2/transactions/refunds/321?provider=api').
229
240
  to_return(body: fixture('refund.json'),
230
241
  headers: {content_type: 'application/json; charset=utf-8'})
231
242
  end
232
243
 
233
244
  it 'requests the right resource' do
234
- @client.delete_refund('321')
235
- expect(a_delete('/v2/transactions/refunds/321')).to have_been_made
245
+ @client.delete_refund('321', provider: 'api')
246
+ expect(a_delete('/v2/transactions/refunds/321?provider=api')).to have_been_made
236
247
  end
237
248
 
238
- it 'returns the delete refund' do
239
- refund = @client.delete_refund('321')
249
+ it 'returns the deleted refund' do
250
+ refund = @client.delete_refund('321', provider: 'api')
240
251
  expect(refund).to be_an Taxjar::Refund
241
252
  expect(refund.transaction_id).to eq('321')
242
253
  expect(refund.user_id).to eq(10649)
243
254
  expect(refund.transaction_date).to eq("2015-05-14T00:00:00Z")
244
255
  expect(refund.transaction_reference_id).to eq("123")
256
+ expect(refund.provider).to eq('api')
257
+ expect(refund.exemption_type).to eq('non_exempt')
245
258
  expect(refund.from_country).to eq('US')
246
259
  expect(refund.from_zip).to eq('93107')
247
260
  expect(refund.from_state).to eq('CA')
@@ -256,9 +269,9 @@ describe Taxjar::API::Refund do
256
269
  expect(refund.shipping).to eq(1.5)
257
270
  expect(refund.sales_tax).to eq(0.95)
258
271
  end
259
-
272
+
260
273
  it 'allows access to line_items' do
261
- refund = @client.delete_refund('321')
274
+ refund = @client.delete_refund('321', provider: 'api')
262
275
  expect(refund.line_items[0].id).to eq('1')
263
276
  expect(refund.line_items[0].quantity).to eq(1)
264
277
  expect(refund.line_items[0].product_identifier).to eq('12-34243-9')