duty_calculator 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +30 -0
- data/duty_calculator.gemspec +3 -1
- data/lib/duty_calculator.rb +2 -0
- data/lib/duty_calculator/calculation.rb +5 -3
- data/lib/duty_calculator/response.rb +22 -0
- data/lib/duty_calculator/version.rb +1 -1
- data/spec/duty_calculator/calculation_spec.rb +91 -5
- data/spec/duty_calculator/response_spec.rb +27 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/support/vcr.rb +16 -0
- data/spec/vcr/calculate__nice_hash_for_multiple_products.yml +61 -0
- data/spec/vcr/calculate__nice_hash_for_single_product.yml +56 -0
- metadata +41 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3074281a85d5dd3f9b02fa22f529ec9950650a2f
|
4
|
+
data.tar.gz: ea02f8be01351e59884132c5b09327958bdb0c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b10a1295f4f29c9f5590024754a99bd93d96fb55932f011f6683fe0a1be2bbb9579426ec067fd3a50e61667ec5a96c56393b903c6e3b8b16dc13f7e5cda30615
|
7
|
+
data.tar.gz: 99923120a6705604b59beb285d78e984e2f0ce16baad6c2068f2c74b3aebe562f8be1bf070d68609c571e78728d9f96b4dc4d525cbbf32434205af9439965095
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,31 @@ end
|
|
37
37
|
|
38
38
|
```
|
39
39
|
|
40
|
+
### Get Calculation
|
41
|
+
|
42
|
+
```
|
43
|
+
duty_calculation = DutyCalculator::Calculation.get(params)
|
44
|
+
|
45
|
+
0> duty_calculation.keys
|
46
|
+
=> ["id", "item", "total_charges"]
|
47
|
+
|
48
|
+
0> duty_calculation.total_charges.keys
|
49
|
+
=> ["customs_value", "duty", "sales_tax", "total"]
|
50
|
+
|
51
|
+
0> duty_calculation.total_charges.customs_value
|
52
|
+
=> #<Hashie::Mash amount=#<Hashie::Mash currency="CAD" value=1556.0> name="FOB">
|
53
|
+
|
54
|
+
0> duty_calculation.total_charges.sales_tax
|
55
|
+
=> #<Hashie::Mash amount=#<Hashie::Mash currency="CAD" value=77.8> name="GST">
|
56
|
+
|
57
|
+
0> duty_calculation.total_charges.duty
|
58
|
+
=> #<Hashie::Mash amount=#<Hashie::Mash currency="CAD" value=0.0>>
|
59
|
+
|
60
|
+
0> duty_calculation.total_charges.total
|
61
|
+
=> #<Hashie::Mash amount=#<Hashie::Mash currency="CAD" value=77.8>>
|
62
|
+
|
63
|
+
```
|
64
|
+
|
40
65
|
### Listing Categories
|
41
66
|
|
42
67
|
```ruby
|
@@ -83,6 +108,11 @@ end
|
|
83
108
|
}
|
84
109
|
```
|
85
110
|
|
111
|
+
## TODO
|
112
|
+
|
113
|
+
- Port other objects to response nicer objects with `Hashie::Mash`
|
114
|
+
- Coerce sub `Array` for `item` to use `Response` object
|
115
|
+
|
86
116
|
## Contributing
|
87
117
|
|
88
118
|
1. Fork it ( https://github.com/[my-github-username]/duty_calculator/fork )
|
data/duty_calculator.gemspec
CHANGED
@@ -20,9 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "vcr", "~> 2.9"
|
24
|
+
spec.add_development_dependency "webmock", "~> 1.20"
|
23
25
|
spec.add_dependency "faraday", "~> 0.9"
|
24
26
|
spec.add_dependency "faraday_middleware", "~> 0.9"
|
25
|
-
spec.add_runtime_dependency "hashie", "~>
|
27
|
+
spec.add_runtime_dependency "hashie", "~> 3.3"
|
26
28
|
spec.add_runtime_dependency "multi_xml", "~> 0.5"
|
27
29
|
spec.add_runtime_dependency "addressable", "~> 2.3"
|
28
30
|
end
|
data/lib/duty_calculator.rb
CHANGED
@@ -3,10 +3,12 @@ require "duty_calculator/configuration"
|
|
3
3
|
require "duty_calculator/currency"
|
4
4
|
require "duty_calculator/category"
|
5
5
|
require "duty_calculator/calculation"
|
6
|
+
require "duty_calculator/response"
|
6
7
|
require "duty_calculator/error_messages"
|
7
8
|
|
8
9
|
require "faraday"
|
9
10
|
require "faraday_middleware"
|
11
|
+
require "hashie"
|
10
12
|
|
11
13
|
module DutyCalculator
|
12
14
|
class << self
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "duty_calculator/client"
|
2
|
+
require "duty_calculator/response"
|
2
3
|
require "addressable/uri"
|
3
4
|
module DutyCalculator
|
4
5
|
class Calculation
|
@@ -38,10 +39,11 @@ module DutyCalculator
|
|
38
39
|
transformed_params = transform_params(validate_params(params))
|
39
40
|
conn = DutyCalculator::Client.new
|
40
41
|
resp = conn.get "#{DutyCalculator::Client.api_base}/calculation", transformed_params
|
41
|
-
|
42
|
+
hashed_resp = DutyCalculator::Response.new(resp.to_hash)
|
43
|
+
resp = Hashie::Mash.new(hashed_resp)
|
44
|
+
raise Exception, "Duty Calculator Error: #{DutyCalculator::ErrorMessages.for_code(resp.body.error.code)}" if resp.body.error
|
42
45
|
raise Exception, "HTTP Status Code #{resp.status}" if resp.status.to_i != 200
|
43
|
-
|
46
|
+
resp.body.duty_calculation
|
44
47
|
end
|
45
|
-
|
46
48
|
end
|
47
49
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "hashie"
|
2
|
+
module DutyCalculator
|
3
|
+
class Response < Hash
|
4
|
+
include ::Hashie::Extensions::Coercion
|
5
|
+
coerce_value Hash, Response
|
6
|
+
|
7
|
+
def initialize(hash = {})
|
8
|
+
super
|
9
|
+
hash.each_pair do |k,v|
|
10
|
+
if k == '__content__' && v.to_s == 0.to_s
|
11
|
+
self['value'] = v.to_f
|
12
|
+
elsif k == '__content__' && v.to_i > 0
|
13
|
+
self['value'] = v.to_f
|
14
|
+
elsif k == '__content__'
|
15
|
+
self['value'] = v
|
16
|
+
else
|
17
|
+
self[k] = v
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module DutyCalculator
|
4
|
-
describe
|
4
|
+
describe Calculation do
|
5
5
|
describe ".transform_params" do
|
6
6
|
context "for a single product" do
|
7
7
|
let(:params) do
|
@@ -21,8 +21,8 @@ module DutyCalculator
|
|
21
21
|
it "makes a hash with numerical index keys for array values" do
|
22
22
|
transformed = DutyCalculator::Calculation.transform_params(params)
|
23
23
|
|
24
|
-
expect(transformed[
|
25
|
-
expect(transformed[
|
24
|
+
expect(transformed[:from]).to eq(params[:from])
|
25
|
+
expect(transformed[:cat]).to eq({ 0 => params[:cat].first })
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -44,8 +44,94 @@ module DutyCalculator
|
|
44
44
|
it "makes a hash with numerical index keys for array values" do
|
45
45
|
transformed = DutyCalculator::Calculation.transform_params(params)
|
46
46
|
|
47
|
-
expect(transformed[
|
48
|
-
expect(transformed[
|
47
|
+
expect(transformed[:from]).to eq(params[:from])
|
48
|
+
expect(transformed[:cat]).to eq({ 0 => params[:cat].first, 1 => params[:cat].last })
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
describe ".get" do
|
53
|
+
before do
|
54
|
+
DutyCalculator.configure do |config|
|
55
|
+
config.api_key = "DUTY_CALC"
|
56
|
+
config.sandbox = true
|
57
|
+
config.debug = true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
context "for a single product" do
|
61
|
+
let(:params) do
|
62
|
+
{
|
63
|
+
from: "US",
|
64
|
+
to: "CA",
|
65
|
+
shipping_mode: "USPS",
|
66
|
+
insurance: 0.0,
|
67
|
+
currency: "USD",
|
68
|
+
origin: "US",
|
69
|
+
reference: "ORD12345",
|
70
|
+
preferential_rates: 0,
|
71
|
+
detailed_result: 1,
|
72
|
+
incl_hs_codes: 1,
|
73
|
+
shipping: 10.0,
|
74
|
+
cat: ["522"],
|
75
|
+
hs: ["9019100020", "9019100020"],
|
76
|
+
country_of_hs_code: ["CN"],
|
77
|
+
desc: ["Hydrotherapy Spa Bath"],
|
78
|
+
weight: ["1.0"],
|
79
|
+
weight_unit: ["lb"],
|
80
|
+
value: [ "1234.00" ],
|
81
|
+
sku: [ "300101" ],
|
82
|
+
qty: [ 1 ],
|
83
|
+
commercial_importer: 0,
|
84
|
+
classify_by: 'cat',
|
85
|
+
}
|
86
|
+
end
|
87
|
+
it 'makes a nice hash' do
|
88
|
+
VCR.use_cassette('calculate__nice_hash_for_single_product') do
|
89
|
+
duty_calculation = DutyCalculator::Calculation.get(params)
|
90
|
+
expect(duty_calculation.item.id.class).to eq(String)
|
91
|
+
expect(duty_calculation.item.hs_code.class).to eq(String)
|
92
|
+
expect(duty_calculation.item.sales_tax.amount.value.class).to eq(Float)
|
93
|
+
expect(duty_calculation.total_charges.duty.amount.currency.class).to eq(String)
|
94
|
+
expect(duty_calculation.total_charges.sales_tax.name).to eq("GST")
|
95
|
+
expect(duty_calculation.total_charges.sales_tax.amount.value.class).to eq(Float)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
context "for multiple products" do
|
100
|
+
let(:params) do
|
101
|
+
{
|
102
|
+
from: "US",
|
103
|
+
to: "CA",
|
104
|
+
shipping_mode: "USPS",
|
105
|
+
insurance: 0.0,
|
106
|
+
currency: "USD",
|
107
|
+
origin: "US",
|
108
|
+
reference: "ORD12345",
|
109
|
+
preferential_rates: 0,
|
110
|
+
detailed_result: 1,
|
111
|
+
incl_hs_codes: 1,
|
112
|
+
shipping: 10.0,
|
113
|
+
cat: ["522","522"],
|
114
|
+
hs: ["9019100020", "9019100020"],
|
115
|
+
country_of_hs_code: ["CN", "DE"],
|
116
|
+
desc: ["Hydrotherapy Spa Bath", "Hydrotherapy Spa Bath"],
|
117
|
+
weight: ["1.0", "2.0"],
|
118
|
+
weight_unit: ["lb", "lb"],
|
119
|
+
value: [ "1234.00", "2345.67" ],
|
120
|
+
sku: [ "300101", "300102" ],
|
121
|
+
qty: [ 1, 2 ],
|
122
|
+
commercial_importer: 0,
|
123
|
+
classify_by: 'cat',
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'makes a nice hash' do
|
128
|
+
VCR.use_cassette('calculate__nice_hash_for_multiple_products') do
|
129
|
+
duty_calculation = DutyCalculator::Calculation.get(params)
|
130
|
+
expect(duty_calculation.item.size).to eq(2)
|
131
|
+
expect(duty_calculation.total_charges.duty.amount.currency.class).to eq(String)
|
132
|
+
expect(duty_calculation.total_charges.sales_tax.name).to eq("GST")
|
133
|
+
expect(duty_calculation.total_charges.sales_tax.amount.value.class).to eq(Float)
|
134
|
+
end
|
49
135
|
end
|
50
136
|
end
|
51
137
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module DutyCalculator
|
4
|
+
describe Response do
|
5
|
+
context ".initialize" do
|
6
|
+
it "coerces some uglyness" do
|
7
|
+
hash = {
|
8
|
+
"string_value" => "stringerific",
|
9
|
+
"__content__" => "should_be_string",
|
10
|
+
"nested_integer" => {
|
11
|
+
"__content__" => "1223"
|
12
|
+
},
|
13
|
+
"nested_zero" => {
|
14
|
+
"__content__" => "0"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
response = DutyCalculator::Response.new(hash)
|
18
|
+
expect(response["string_value"].class).to eq(String)
|
19
|
+
expect(response.keys.include?("value")).to eq(true)
|
20
|
+
expect(response.keys.include?("__content__")).to_not eq(true)
|
21
|
+
expect(response["value"].class).to eq(String)
|
22
|
+
expect(response["nested_integer"]["value"].class).to eq(Float)
|
23
|
+
expect(response["nested_zero"]["value"].class).to eq(Float)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,10 +5,14 @@ require "duty_calculator"
|
|
5
5
|
# loaded once.
|
6
6
|
#
|
7
7
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
8
|
+
ABS_PATH = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
9
|
+
Dir[File.join(ABS_PATH, "spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
8
11
|
RSpec.configure do |config|
|
9
12
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
10
13
|
config.run_all_when_everything_filtered = true
|
11
14
|
config.filter_run :focus
|
15
|
+
config.raise_errors_for_deprecations!
|
12
16
|
|
13
17
|
# Run specs in random order to surface order dependencies. If you find an
|
14
18
|
# order dependency and want to debug it, you can fix the order by providing
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'webmock'
|
3
|
+
|
4
|
+
VCR.configure do |c|
|
5
|
+
c.cassette_library_dir = File.join(ABS_PATH, "spec", "vcr")
|
6
|
+
c.hook_into :webmock
|
7
|
+
c.ignore_hosts '127.0.0.1', 'localhost'
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec.configure do |c|
|
11
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
c.around(:each, :vcr) do |example|
|
13
|
+
name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
|
14
|
+
VCR.use_cassette( name, :record => :new_episodes, :match_requests_on => [:query] ) { example.call }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.dutycalculator.com/api2.1/sandbox/DUTY_CALC/calculation?cat%5B%5D=522&cat%5B%5D=522&classify_by=cat&commercial_importer=0&country_of_hs_code%5B%5D=CN&country_of_hs_code%5B%5D=DE¤cy=USD&desc%5B%5D=Hydrotherapy%20Spa%20Bath&desc%5B%5D=Hydrotherapy%20Spa%20Bath&detailed_result=1&from=US&hs%5B%5D=9019100020&hs%5B%5D=9019100020&incl_hs_codes=1&insurance=0.0&origin=US&preferential_rates=0&qty%5B%5D=1&qty%5B%5D=2&reference=ORD12345&shipping=10.0&shipping_mode=USPS&sku%5B%5D=300101&sku%5B%5D=300102&to=CA&value%5B%5D=1234.00&value%5B%5D=2345.67&weight%5B%5D=1.0&weight%5B%5D=2.0&weight_unit%5B%5D=lb&weight_unit%5B%5D=lb
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx/1.6.1
|
23
|
+
Date:
|
24
|
+
- Mon, 30 Mar 2015 23:38:08 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/xml
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Powered-By:
|
32
|
+
- PHP/5.5.9-1ubuntu4.5
|
33
|
+
Set-Cookie:
|
34
|
+
- DebugLevel=0; expires=Wed, 29-Apr-2015 23:38:02 GMT; Max-Age=2592000; path=/
|
35
|
+
- PHPSESSID=r063q1h863c4k1590p9n4fbsm0; path=/
|
36
|
+
Expires:
|
37
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
38
|
+
Cache-Control:
|
39
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
40
|
+
Pragma:
|
41
|
+
- no-cache
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<duty-calculation id=\"191674998\">\n\t<item
|
45
|
+
id=\"522\" hs-code=\"9019100020\" reference=\"0\" quality-score=\"validated\">\n\t\t<customs-value
|
46
|
+
name=\"FOB\">\n\t\t\t<amount currency=\"CAD\">1556</amount>\n\t\t</customs-value>\n\t\t<duty>\n\t\t\t<amount
|
47
|
+
currency=\"CAD\">0</amount>\n\t\t</duty>\n\t\t<sales-tax name=\"GST\">\n\t\t\t<amount
|
48
|
+
currency=\"CAD\">77.8</amount>\n\t\t</sales-tax>\n\t\t<total>\n\t\t\t<amount
|
49
|
+
currency=\"CAD\">77.8</amount>\n\t\t</total>\n\t</item>\n\t<item id=\"522\"
|
50
|
+
hs-code=\"9019100020\" reference=\"1\" quality-score=\"validated\">\n\t\t<customs-value
|
51
|
+
name=\"FOB\">\n\t\t\t<amount currency=\"CAD\">5915.49</amount>\n\t\t</customs-value>\n\t\t<duty>\n\t\t\t<amount
|
52
|
+
currency=\"CAD\">0</amount>\n\t\t</duty>\n\t\t<sales-tax name=\"GST\">\n\t\t\t<amount
|
53
|
+
currency=\"CAD\">295.77</amount>\n\t\t</sales-tax>\n\t\t<total>\n\t\t\t<amount
|
54
|
+
currency=\"CAD\">295.77</amount>\n\t\t</total>\n\t</item>\n\t<total-charges>\n\t\t<customs-value
|
55
|
+
name=\"FOB\">\n\t\t\t<amount currency=\"CAD\">7471.49</amount>\n\t\t</customs-value>\n\t\t<duty>\n\t\t\t<amount
|
56
|
+
currency=\"CAD\">0</amount>\n\t\t</duty>\n\t\t<sales-tax name=\"GST\">\n\t\t\t<amount
|
57
|
+
currency=\"CAD\">373.57</amount>\n\t\t</sales-tax>\n\t\t<total>\n\t\t\t<amount
|
58
|
+
currency=\"CAD\">373.57</amount>\n\t\t</total>\n\t</total-charges>\n</duty-calculation>\n"
|
59
|
+
http_version:
|
60
|
+
recorded_at: Mon, 30 Mar 2015 23:35:40 GMT
|
61
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.dutycalculator.com/api2.1/sandbox/DUTY_CALC/calculation?cat%5B%5D=522&classify_by=cat&commercial_importer=0&country_of_hs_code%5B%5D=CN¤cy=USD&desc%5B%5D=Hydrotherapy%20Spa%20Bath&detailed_result=1&from=US&hs%5B%5D=9019100020&hs%5B%5D=9019100020&incl_hs_codes=1&insurance=0.0&origin=US&preferential_rates=0&qty%5B%5D=1&reference=ORD12345&shipping=10.0&shipping_mode=USPS&sku%5B%5D=300101&to=CA&value%5B%5D=1234.00&weight%5B%5D=1.0&weight_unit%5B%5D=lb
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx/1.6.1
|
23
|
+
Date:
|
24
|
+
- Mon, 30 Mar 2015 23:38:04 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/xml
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Powered-By:
|
32
|
+
- PHP/5.5.9-1ubuntu4.5
|
33
|
+
Set-Cookie:
|
34
|
+
- DebugLevel=0; expires=Wed, 29-Apr-2015 23:37:58 GMT; Max-Age=2592000; path=/
|
35
|
+
- PHPSESSID=39hst3dqjsj0pt69g6tij9j5r0; path=/
|
36
|
+
Expires:
|
37
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
38
|
+
Cache-Control:
|
39
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
40
|
+
Pragma:
|
41
|
+
- no-cache
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<duty-calculation id=\"191674997\">\n\t<item
|
45
|
+
id=\"522\" hs-code=\"9019100020\" reference=\"0\" quality-score=\"validated\">\n\t\t<customs-value
|
46
|
+
name=\"FOB\">\n\t\t\t<amount currency=\"CAD\">1556</amount>\n\t\t</customs-value>\n\t\t<duty>\n\t\t\t<amount
|
47
|
+
currency=\"CAD\">0</amount>\n\t\t</duty>\n\t\t<sales-tax name=\"GST\">\n\t\t\t<amount
|
48
|
+
currency=\"CAD\">77.8</amount>\n\t\t</sales-tax>\n\t\t<total>\n\t\t\t<amount
|
49
|
+
currency=\"CAD\">77.8</amount>\n\t\t</total>\n\t</item>\n\t<total-charges>\n\t\t<customs-value
|
50
|
+
name=\"FOB\">\n\t\t\t<amount currency=\"CAD\">1556</amount>\n\t\t</customs-value>\n\t\t<duty>\n\t\t\t<amount
|
51
|
+
currency=\"CAD\">0</amount>\n\t\t</duty>\n\t\t<sales-tax name=\"GST\">\n\t\t\t<amount
|
52
|
+
currency=\"CAD\">77.8</amount>\n\t\t</sales-tax>\n\t\t<total>\n\t\t\t<amount
|
53
|
+
currency=\"CAD\">77.8</amount>\n\t\t</total>\n\t</total-charges>\n</duty-calculation>\n"
|
54
|
+
http_version:
|
55
|
+
recorded_at: Mon, 30 Mar 2015 23:35:36 GMT
|
56
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duty_calculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Hanley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -39,6 +39,34 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: vcr
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '2.9'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '2.9'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: webmock
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.20'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.20'
|
42
70
|
- !ruby/object:Gem::Dependency
|
43
71
|
name: faraday
|
44
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +101,14 @@ dependencies:
|
|
73
101
|
requirements:
|
74
102
|
- - "~>"
|
75
103
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
104
|
+
version: '3.3'
|
77
105
|
type: :runtime
|
78
106
|
prerelease: false
|
79
107
|
version_requirements: !ruby/object:Gem::Requirement
|
80
108
|
requirements:
|
81
109
|
- - "~>"
|
82
110
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
111
|
+
version: '3.3'
|
84
112
|
- !ruby/object:Gem::Dependency
|
85
113
|
name: multi_xml
|
86
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,11 +161,16 @@ files:
|
|
133
161
|
- lib/duty_calculator/configuration.rb
|
134
162
|
- lib/duty_calculator/currency.rb
|
135
163
|
- lib/duty_calculator/error_messages.rb
|
164
|
+
- lib/duty_calculator/response.rb
|
136
165
|
- lib/duty_calculator/version.rb
|
137
166
|
- spec/duty_calculator/calculation_spec.rb
|
138
167
|
- spec/duty_calculator/configuration_spec.rb
|
139
168
|
- spec/duty_calculator/currency_spec.rb
|
169
|
+
- spec/duty_calculator/response_spec.rb
|
140
170
|
- spec/spec_helper.rb
|
171
|
+
- spec/support/vcr.rb
|
172
|
+
- spec/vcr/calculate__nice_hash_for_multiple_products.yml
|
173
|
+
- spec/vcr/calculate__nice_hash_for_single_product.yml
|
141
174
|
homepage: https://github.com/tjhanley/duty-calculator
|
142
175
|
licenses:
|
143
176
|
- MIT
|
@@ -166,4 +199,8 @@ test_files:
|
|
166
199
|
- spec/duty_calculator/calculation_spec.rb
|
167
200
|
- spec/duty_calculator/configuration_spec.rb
|
168
201
|
- spec/duty_calculator/currency_spec.rb
|
202
|
+
- spec/duty_calculator/response_spec.rb
|
169
203
|
- spec/spec_helper.rb
|
204
|
+
- spec/support/vcr.rb
|
205
|
+
- spec/vcr/calculate__nice_hash_for_multiple_products.yml
|
206
|
+
- spec/vcr/calculate__nice_hash_for_single_product.yml
|