taxjar-ruby 1.6.0 → 1.6.2

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
  SHA1:
3
- metadata.gz: e9adee0198596906af12330e1955674f4ac57bf7
4
- data.tar.gz: fde4261b6505e019557f14a24a5733996c706247
3
+ metadata.gz: 6cc9e160223c601f42dd22ce69d919328ddbecb1
4
+ data.tar.gz: 18ed031c988b339e226f2e9f84ea32bb3a9f9bea
5
5
  SHA512:
6
- metadata.gz: d6379a1d7f112fefc52bfb43c2b2b8e2357f319254eb2d6580b862fb3a493cc4db0b28983679bf87f0ec64850a4dab3e790ec25b5f415cd9616025ace9d27e02
7
- data.tar.gz: caaa54167ae736de86485c79c153becab2dbf7847b88e8dd7a0baacafccbab227bc8a4e66ca3624891a6bb71422e11fe13e484b1f06b8f5526e7c23e6e7a76d0
6
+ metadata.gz: 664dbd3a33f8b753ad156a4b96c72a853de193570d7400e2c5fdb68ce60b5d94a6a6cfa0814eca6c807f07fe9454ce58503c15bb9ddad206a65ebb8e10de3592
7
+ data.tar.gz: 2d62663bd4ae0908ac442b5d6323a258a3dd65a7b368f25f997d044a4ed91d439ac6b0e13a4fdc32a64c3979052de744391249fc92a0712ce09c056e6eac5999
data/README.md CHANGED
@@ -71,17 +71,17 @@ client.categories
71
71
 
72
72
  ```ruby
73
73
  [
74
- #<Taxjar::Category:0x007f081dc3e278 @attrs={
74
+ #<Taxjar::Category:0x00000a @attrs={
75
75
  :name => 'Digital Goods',
76
76
  :product_tax_code => 31000,
77
77
  :description => 'Digital products transferred electronically.'
78
78
  }>,
79
- #<Taxjar::Category:0x007f081dc3de90 @attrs={
79
+ #<Taxjar::Category:0x00000a @attrs={
80
80
  :name => 'Clothing',
81
81
  :product_tax_code => 20010,
82
82
  :description => 'All human wearing apparel suitable for general use'
83
83
  }>,
84
- #<Taxjar::Category:0x007f081dc3da80 @attrs={
84
+ #<Taxjar::Category:0x00000a @attrs={
85
85
  :name => 'Non-Prescription',
86
86
  :product_tax_code => 51010,
87
87
  :description => 'Drugs for human use without a prescription'
@@ -127,7 +127,7 @@ rates = client.rates_for_location('00150', {
127
127
  #### Example Response
128
128
 
129
129
  ```ruby
130
- #<Taxjar::Rate:0x007fc47056a928 @attrs={
130
+ #<Taxjar::Rate:0x00000a @attrs={
131
131
  :zip => '90002',
132
132
  :state => 'CA',
133
133
  :state_rate => 0.065,
@@ -136,21 +136,23 @@ rates = client.rates_for_location('00150', {
136
136
  :city => 'WATTS',
137
137
  :city_rate => 0,
138
138
  :combined_district_rate => 0.015,
139
- :combined_rate => 0.09
139
+ :combined_rate => 0.09,
140
+ :freight_taxable => false
140
141
  }>
141
142
 
142
- #<Taxjar::Rate:0x007fc47056a928 @attrs={
143
+ #<Taxjar::Rate:0x00000a @attrs={
143
144
  :zip => 'V5K0A1',
144
145
  :city => 'Vancouver',
145
146
  :state => 'BC',
146
147
  :country => 'CA',
147
- :combined_rate => '0.12'
148
+ :combined_rate => 0.12,
149
+ :freight_taxable => true
148
150
  }>
149
151
 
150
- #<Taxjar::Rate:0x007fc47056a928 @attrs={
152
+ #<Taxjar::Rate:0x00000a @attrs={
151
153
  :country => 'FI',
152
154
  :name => 'Finland',
153
- :standard_rate => '0.24',
155
+ :standard_rate => 0.24,
154
156
  :reduced_rate => nil,
155
157
  :super_reduced_rate => nil,
156
158
  :parking_rate => nil,
@@ -198,13 +200,13 @@ client.tax_for_order({
198
200
  #### Example Response
199
201
 
200
202
  ```ruby
201
- #<Taxjar::Tax:0x007f3945688fc8 @attrs={
203
+ #<Taxjar::Tax:0x00000a @attrs={
202
204
  :order_total_amount => 16.5,
203
205
  :amount_to_collect => 1.35,
204
206
  :has_nexus => true,
205
207
  :freight_taxable => false,
206
208
  :tax_source => 'destination',
207
- :breakdown => {
209
+ :breakdown => #<Taxjar::Breakdown:0x00000a @attrs={
208
210
  :state_taxable_amount => 15,
209
211
  :state_tax_collectable => 0.98,
210
212
  :county_taxable_amount => 15,
@@ -214,7 +216,7 @@ client.tax_for_order({
214
216
  :special_district_taxable_amount => 15,
215
217
  :special_district_tax_collectable => 0.22,
216
218
  :line_items => [
217
- {
219
+ #<Taxjar::BreakdownLineItem:0x00000a @attrs={
218
220
  :id => '1',
219
221
  :state_taxable_amount => 15,
220
222
  :state_sales_tax_rate => 0.065,
@@ -224,12 +226,12 @@ client.tax_for_order({
224
226
  :city_tax_rate => 0,
225
227
  :special_district_taxable_amount => 15,
226
228
  :special_tax_rate => 0.015
227
- }
229
+ }>
228
230
  ]
229
- }
231
+ }>
230
232
  }>
231
233
 
232
- #<Taxjar::Tax:0x007f3945688fc8 @attrs={
234
+ #<Taxjar::Tax:0x00000a @attrs={
233
235
  :order_total_amount => 27.12,
234
236
  :shipping => 1.5,
235
237
  :taxable_amount => 27.12,
@@ -285,7 +287,7 @@ client.show_order('123')
285
287
  #### Example Response
286
288
 
287
289
  ```ruby
288
- #<Taxjar::Order:0x007fd3e514a940 @attrs={
290
+ #<Taxjar::Order:0x00000a @attrs={
289
291
  :transaction_id => '123',
290
292
  :user_id => 11836,
291
293
  :transaction_date => '2015-05-14T00:00:00Z',
@@ -359,7 +361,7 @@ order = client.create_order({
359
361
  #### Example Response
360
362
 
361
363
  ```ruby
362
- #<Taxjar::Order:0x007f6d65b252d0 @attrs={
364
+ #<Taxjar::Order:0x00000a @attrs={
363
365
  :transaction_id => '20',
364
366
  :user_id => 11836,
365
367
  :transaction_date => '2015-05-14T00:00:00Z',
@@ -422,7 +424,7 @@ order = client.update_order({
422
424
  #### Example Response
423
425
 
424
426
  ```ruby
425
- #<Taxjar::Order:0x007f6d65b252d0 @attrs={
427
+ #<Taxjar::Order:0x00000a @attrs={
426
428
  :transaction_id => '123',
427
429
  :user_id => 11836,
428
430
  :transaction_date => '2015-05-14T00:00:00Z',
@@ -475,7 +477,7 @@ client.delete_order('123')
475
477
  #### Example Response
476
478
 
477
479
  ```ruby
478
- #<Taxjar::Order:0x007f6d65b252d0 @attrs={
480
+ #<Taxjar::Order:0x00000a @attrs={
479
481
  :transaction_id => '123',
480
482
  :user_id => 11836,
481
483
  :transaction_date => '2015-05-14T00:00:00Z',
@@ -552,7 +554,7 @@ client.show_refund('321')
552
554
  #### Example Response
553
555
 
554
556
  ```ruby
555
- #<Taxjar::Refund:0x007f6da40e33a0 @attrs={
557
+ #<Taxjar::Refund:0x00000a @attrs={
556
558
  :transaction_id => '321',
557
559
  :user_id => 11836,
558
560
  :transaction_date => '2015-06-14T00:00:00Z',
@@ -627,7 +629,7 @@ refund = client.create_refund({
627
629
  #### Example Response
628
630
 
629
631
  ```ruby
630
- #<Taxjar::Refund:0x007f6da40e33a0 @attrs={
632
+ #<Taxjar::Refund:0x00000a @attrs={
631
633
  :transaction_id => '321',
632
634
  :user_id => 11836,
633
635
  :transaction_date => '2015-06-14T00:00:00Z',
@@ -690,7 +692,7 @@ refund = client.update_refund({
690
692
  #### Example Response
691
693
 
692
694
  ```ruby
693
- #<Taxjar::Refund:0x007f6da40e33a0 @attrs={
695
+ #<Taxjar::Refund:0x00000a @attrs={
694
696
  :transaction_id => '321',
695
697
  :user_id => 11836,
696
698
  :transaction_date => '2015-06-14T00:00:00Z',
@@ -743,7 +745,7 @@ client.delete_refund('321')
743
745
  #### Example Response
744
746
 
745
747
  ```ruby
746
- #<Taxjar::Refund:0x007f6da40e33a0 @attrs={
748
+ #<Taxjar::Refund:0x00000a @attrs={
747
749
  :transaction_id => '321',
748
750
  :user_id => 11836,
749
751
  :transaction_date => '2015-06-14T00:00:00Z',
@@ -796,24 +798,24 @@ nexus_regions = client.nexus_regions
796
798
 
797
799
  ```ruby
798
800
  [
799
- {
801
+ #<Taxjar::NexusRegion:0x00000a @attrs={
800
802
  :country_code => 'US',
801
803
  :country => 'United States',
802
804
  :region_code => 'CA',
803
805
  :region => 'California'
804
- },
805
- {
806
+ }>,
807
+ #<Taxjar::NexusRegion:0x00000a @attrs={
806
808
  :country_code => 'US',
807
809
  :country => 'United States',
808
810
  :region_code => 'NY',
809
811
  :region => 'New York'
810
- },
811
- {
812
+ }>,
813
+ #<Taxjar::NexusRegion:0x00000a @attrs={
812
814
  :country_code => 'US',
813
815
  :country => 'United States',
814
816
  :region_code => 'WA',
815
817
  :region => 'Washington'
816
- }
818
+ }>
817
819
  ]
818
820
  ```
819
821
 
@@ -839,7 +841,7 @@ validation = client.validate({
839
841
  #### Example Response
840
842
 
841
843
  ```ruby
842
- #<Taxjar::Validation @attrs={
844
+ #<Taxjar::Validation:0x00000a @attrs={
843
845
  :valid => true,
844
846
  :exists => true,
845
847
  :vies_available => true,
@@ -875,7 +877,7 @@ summarized_rates = client.summary_rates
875
877
 
876
878
  ```ruby
877
879
  [
878
- {
880
+ #<Taxjar::SummaryRate:0x00000a @attrs={
879
881
  :country_code => 'US',
880
882
  :country => 'United States',
881
883
  :region_code => 'CA',
@@ -888,8 +890,8 @@ summarized_rates = client.summary_rates
888
890
  :label => 'Tax',
889
891
  :rate => 0.0827
890
892
  }
891
- },
892
- {
893
+ }>,
894
+ #<Taxjar::SummaryRate:0x00000a @attrs={
893
895
  :country_code => 'CA',
894
896
  :country => 'Canada',
895
897
  :region_code => 'BC',
@@ -902,8 +904,8 @@ summarized_rates = client.summary_rates
902
904
  :label => 'PST',
903
905
  :rate => 0.12
904
906
  }
905
- },
906
- {
907
+ }>,
908
+ #<Taxjar::SummaryRate:0x00000a @attrs={
907
909
  :country_code => 'UK',
908
910
  :country => 'United Kingdom',
909
911
  :region_code => nil,
@@ -916,7 +918,7 @@ summarized_rates = client.summary_rates
916
918
  :label => 'VAT',
917
919
  :rate => 0.2
918
920
  }
919
- }
921
+ }>
920
922
  ]
921
923
  ```
922
924
 
data/lib/taxjar/rate.rb CHANGED
@@ -13,10 +13,14 @@ module Taxjar
13
13
  attribute :city_rate, :float
14
14
  attribute :combined_district_rate, :float
15
15
  attribute :combined_rate, :float
16
+ attribute :freight_taxable, :boolean
16
17
 
17
18
  # International
18
19
  attribute :country, :string
19
20
  attribute :name, :string
21
+
22
+ # Australia / SST States
23
+ attribute :country_rate, :float
20
24
 
21
25
  # European Union
22
26
  attribute :standard_rate, :float
@@ -24,6 +28,5 @@ module Taxjar
24
28
  attribute :super_reduced_rate, :float
25
29
  attribute :parking_rate, :float
26
30
  attribute :distance_sale_threshold, :float
27
- attribute :freight_taxable, :boolean
28
31
  end
29
32
  end
@@ -10,7 +10,7 @@ module Taxjar
10
10
  end
11
11
 
12
12
  def patch
13
- 0
13
+ 2
14
14
  end
15
15
 
16
16
  def pre
@@ -8,6 +8,7 @@
8
8
  "city": "WATTS",
9
9
  "city_rate": "0.0",
10
10
  "combined_district_rate": "0.015",
11
- "combined_rate": "0.09"
11
+ "combined_rate": "0.09",
12
+ "freight_taxable": false
12
13
  }
13
14
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "rate": {
3
+ "zip": "2060",
4
+ "country": "AU",
5
+ "country_rate": "0.1",
6
+ "combined_rate": "0.1",
7
+ "freight_taxable": true
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "rate": {
3
+ "zip": "V5K0A1",
4
+ "city": "Vancouver",
5
+ "state": "BC",
6
+ "country": "CA",
7
+ "combined_rate": "0.12",
8
+ "freight_taxable": true
9
+ }
10
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ {
2
+ "rate": {
3
+ "zip": "05495-2086",
4
+ "country": "US",
5
+ "country_rate": "0.0",
6
+ "state": "VT",
7
+ "state_rate": "0.06",
8
+ "county": "CHITTENDEN",
9
+ "county_rate": "0.0",
10
+ "city": "WILLISTON",
11
+ "city_rate": "0.0",
12
+ "combined_district_rate": "0.01",
13
+ "combined_rate": "0.07",
14
+ "freight_taxable": true
15
+ }
16
+ }
@@ -48,14 +48,89 @@ describe Taxjar::API do
48
48
  expect(rates.city_rate).to eq(0.0)
49
49
  expect(rates.combined_district_rate).to eq(0.015)
50
50
  expect(rates.combined_rate).to eq(0.09)
51
+ expect(rates.freight_taxable).to eq(false)
52
+ end
53
+ end
54
+
55
+ describe '#rate_for_location (sst)' do
56
+ before do
57
+ @postal_code = "05495-2086"
58
+ stub_get("/v2/rates/#{@postal_code}").to_return(body: fixture('rates_sst.json'), headers: { content_type: 'application/json; charset=utf-8' })
59
+ end
60
+
61
+ it 'requests the right resource' do
62
+ @client.rates_for_location(@postal_code)
63
+ expect(a_get("/v2/rates/#{@postal_code}")).to have_been_made
64
+ end
65
+
66
+ it 'returns the requested rates' do
67
+ rates = @client.rates_for_location(@postal_code)
68
+ expect(rates).to be_a Taxjar::Rate
69
+ expect(rates.zip).to eq('05495-2086')
70
+ expect(rates.country).to eq('US')
71
+ expect(rates.country_rate).to eq(0.0)
72
+ expect(rates.state).to eq('VT')
73
+ expect(rates.state_rate).to eq(0.06)
74
+ expect(rates.county).to eq('CHITTENDEN')
75
+ expect(rates.county_rate).to eq(0.0)
76
+ expect(rates.city).to eq('WILLISTON')
77
+ expect(rates.city_rate).to eq(0.0)
78
+ expect(rates.combined_district_rate).to eq(0.01)
79
+ expect(rates.combined_rate).to eq(0.07)
80
+ expect(rates.freight_taxable).to eq(true)
81
+ end
82
+ end
83
+
84
+ describe '#rate_for_location (ca)' do
85
+ before do
86
+ @postal_code = "V5K0A1"
87
+ stub_get("/v2/rates/#{@postal_code}").to_return(body: fixture('rates_ca.json'), headers: { content_type: 'application/json; charset=utf-8' })
88
+ end
89
+
90
+ it 'requests the right resource' do
91
+ @client.rates_for_location(@postal_code)
92
+ expect(a_get("/v2/rates/#{@postal_code}")).to have_been_made
93
+ end
94
+
95
+ it 'returns the requested rates' do
96
+ rates = @client.rates_for_location(@postal_code)
97
+ expect(rates).to be_a Taxjar::Rate
98
+ expect(rates.zip).to eq('V5K0A1')
99
+ expect(rates.city).to eq('Vancouver')
100
+ expect(rates.state).to eq('BC')
101
+ expect(rates.country).to eq('CA')
102
+ expect(rates.combined_rate).to eq(0.12)
103
+ expect(rates.freight_taxable).to eq(true)
104
+ end
105
+ end
106
+
107
+ describe '#rate_for_location (au)' do
108
+ before do
109
+ @postal_code = "2060"
110
+ stub_get("/v2/rates/#{@postal_code}").to_return(body: fixture('rates_au.json'), headers: { content_type: 'application/json; charset=utf-8' })
111
+ end
112
+
113
+ it 'requests the right resource' do
114
+ @client.rates_for_location(@postal_code)
115
+ expect(a_get("/v2/rates/#{@postal_code}")).to have_been_made
116
+ end
117
+
118
+ it 'returns the requested rates' do
119
+ rates = @client.rates_for_location(@postal_code)
120
+ expect(rates).to be_a Taxjar::Rate
121
+ expect(rates.zip).to eq('2060')
122
+ expect(rates.country).to eq('AU')
123
+ expect(rates.country_rate).to eq(0.1)
124
+ expect(rates.combined_rate).to eq(0.1)
125
+ expect(rates.freight_taxable).to eq(true)
51
126
  end
52
127
  end
53
128
 
54
- describe '#rate_for_location (international)' do
129
+ describe '#rate_for_location (eu)' do
55
130
  before do
56
131
  @postal_code = "00150"
57
132
  @params = "city=Helsinki&country=FI"
58
- stub_get("/v2/rates/#{@postal_code}?#{@params}").to_return(body: fixture('rates_intl.json'), headers: { content_type: 'application/json; charset=utf-8' })
133
+ stub_get("/v2/rates/#{@postal_code}?#{@params}").to_return(body: fixture('rates_eu.json'), headers: { content_type: 'application/json; charset=utf-8' })
59
134
  end
60
135
 
61
136
  it 'requests the right resource' do
data/taxjar-ruby.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9.3'
22
22
 
23
- spec.add_dependency 'addressable', '~> 2.3.8'
23
+ spec.add_dependency 'addressable', '~> 2.3'
24
24
  spec.add_dependency 'http', '~> 0.9.4'
25
25
  spec.add_dependency 'memoizable', '~> 0.4.0'
26
26
  spec.add_dependency 'taxjar-model_attribute', '~> 3.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taxjar-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TaxJar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-30 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.8
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.8
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: http
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +136,10 @@ files:
136
136
  - spec/fixtures/order.json
137
137
  - spec/fixtures/orders.json
138
138
  - spec/fixtures/rates.json
139
- - spec/fixtures/rates_intl.json
139
+ - spec/fixtures/rates_au.json
140
+ - spec/fixtures/rates_ca.json
141
+ - spec/fixtures/rates_eu.json
142
+ - spec/fixtures/rates_sst.json
140
143
  - spec/fixtures/refund.json
141
144
  - spec/fixtures/refunds.json
142
145
  - spec/fixtures/summary_rates.json
@@ -173,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
176
  version: '0'
174
177
  requirements: []
175
178
  rubyforge_project:
176
- rubygems_version: 2.4.8
179
+ rubygems_version: 2.6.8
177
180
  signing_key:
178
181
  specification_version: 4
179
182
  summary: Ruby wrapper for Taxjar API
@@ -183,7 +186,10 @@ test_files:
183
186
  - spec/fixtures/order.json
184
187
  - spec/fixtures/orders.json
185
188
  - spec/fixtures/rates.json
186
- - spec/fixtures/rates_intl.json
189
+ - spec/fixtures/rates_au.json
190
+ - spec/fixtures/rates_ca.json
191
+ - spec/fixtures/rates_eu.json
192
+ - spec/fixtures/rates_sst.json
187
193
  - spec/fixtures/refund.json
188
194
  - spec/fixtures/refunds.json
189
195
  - spec/fixtures/summary_rates.json
@@ -199,4 +205,3 @@ test_files:
199
205
  - spec/taxjar/client_spec.rb
200
206
  - spec/taxjar/error_spec.rb
201
207
  - spec/taxjar/version_spec.rb
202
- has_rdoc: