duty_calculator 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +61 -1
- data/lib/duty_calculator/calculation.rb +2 -2
- data/lib/duty_calculator/category.rb +2 -1
- data/lib/duty_calculator/configuration.rb +0 -2
- data/lib/duty_calculator/currency.rb +2 -1
- data/lib/duty_calculator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a22c51c44f8c687b5a3602941b120fcd4212fc
|
4
|
+
data.tar.gz: 4d80165200d37694f00b2eb78d416d08c9cfd1f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cd7c8c5f67dc351de335a0f94e4e6eedf96be835c6eac740efaa9e02633a96045ea3fe78ef2c41937e5c8e0143a71a4271787823ca9258813a3ac959cde686a
|
7
|
+
data.tar.gz: f05624803174c7ad03b25c41af4b1feda73eec76fabedda4ecb4214e8df2f521de115877843def49f6fb5d3f117310957e77e54834ede982f31862e18c5be521
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -21,7 +21,67 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
24
|
+
### Initializer
|
25
|
+
|
26
|
+
If using rails you can create an initializer that sets the configuration for the client.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
DutyCalculator.configure do |config|
|
30
|
+
config.api_key = '###############'
|
31
|
+
# optional default overrides
|
32
|
+
config.api_root = 'http://something.com'
|
33
|
+
config.api_version = 'v3.0'
|
34
|
+
config.sandbox = true
|
35
|
+
config.debug = true
|
36
|
+
end
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
### Listing Categories
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
2.1.2 :008 > DutyCalculator::Category.list_all
|
44
|
+
{
|
45
|
+
"categories"=>{
|
46
|
+
"category"=>{
|
47
|
+
"name"=>"Health & Beauty",
|
48
|
+
"id"=>"L1-84",
|
49
|
+
"subcategory"=>{
|
50
|
+
"name"=>"Bath & Shower",
|
51
|
+
"id"=>"L2-278",
|
52
|
+
"item"=>[
|
53
|
+
{
|
54
|
+
"id"=>"522",
|
55
|
+
"__content__"=>"Hydrotherapy Spa Bath"
|
56
|
+
},
|
57
|
+
...
|
58
|
+
]
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
```
|
64
|
+
|
65
|
+
### Listing Currencies
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
2.1.2 :009 > DutyCalculator::Currency.list_all
|
69
|
+
{
|
70
|
+
"currencies"=>{
|
71
|
+
"currency"=>[
|
72
|
+
{
|
73
|
+
"code"=>"EUR",
|
74
|
+
"__content__"=>"Euro "
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"code"=>"GBP",
|
78
|
+
"__content__"=>"£ Sterling"
|
79
|
+
},
|
80
|
+
...
|
81
|
+
]
|
82
|
+
}
|
83
|
+
}
|
84
|
+
```
|
25
85
|
|
26
86
|
## Contributing
|
27
87
|
|
@@ -45,12 +45,12 @@ module DutyCalculator
|
|
45
45
|
#
|
46
46
|
=end
|
47
47
|
def self.get(params={})
|
48
|
-
|
49
48
|
uri = Addressable::URI.new
|
50
49
|
uri.query_values = validate_params(params)
|
51
50
|
|
52
51
|
conn = DutyCalculator::Client.new
|
53
|
-
conn.get "#{DutyCalculator::Client.api_base}/calculation"
|
52
|
+
resp = conn.get "#{DutyCalculator::Client.api_base}/calculation"
|
53
|
+
resp.body
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -4,7 +4,8 @@ module DutyCalculator
|
|
4
4
|
class Currency
|
5
5
|
def self.list_all
|
6
6
|
conn = DutyCalculator::Client.new
|
7
|
-
conn.get "#{DutyCalculator::Client.api_base}/supported-currencies"
|
7
|
+
resp = conn.get "#{DutyCalculator::Client.api_base}/supported-currencies"
|
8
|
+
resp.body
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Hanley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|