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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3c4b31932cae832814571496bd4b0507a0454ad
4
- data.tar.gz: c840f6489f535e44ba51128efffb1160f36c5aee
3
+ metadata.gz: a9a22c51c44f8c687b5a3602941b120fcd4212fc
4
+ data.tar.gz: 4d80165200d37694f00b2eb78d416d08c9cfd1f3
5
5
  SHA512:
6
- metadata.gz: 6d2d67347a93c14d79f75c271c4339f8ee2140bdc5121b36391a34c7fa2b26415f628336dc23d3b1c2e4884753a5229b36da794bfc8133cfae9508bd1e3e6f72
7
- data.tar.gz: 43c34e3cb1bc5ad7d6c3135c7664eb0a87ae534b61baf09048b5c143292604f066dc6b842417ef9b7ab77f52396fc30cb7c89dc63cdfb59bdc00d0be11a9357a
6
+ metadata.gz: 9cd7c8c5f67dc351de335a0f94e4e6eedf96be835c6eac740efaa9e02633a96045ea3fe78ef2c41937e5c8e0143a71a4271787823ca9258813a3ac959cde686a
7
+ data.tar.gz: f05624803174c7ad03b25c41af4b1feda73eec76fabedda4ecb4214e8df2f521de115877843def49f6fb5d3f117310957e77e54834ede982f31862e18c5be521
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ /*.gem
data/README.md CHANGED
@@ -21,7 +21,67 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- TODO: Write usage instructions here
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 Category
5
5
  def self.list_all
6
6
  conn = DutyCalculator::Client.new
7
- conn.get "#{DutyCalculator::Client.api_base}/categories"
7
+ resp = conn.get "#{DutyCalculator::Client.api_base}/categories"
8
+ resp.body
8
9
  end
9
10
  end
10
11
  end
@@ -10,9 +10,7 @@ module DutyCalculator
10
10
  defaults = load_defaults
11
11
  @api_root = defaults[:api_root]
12
12
  @api_version = defaults[:api_version]
13
-
14
13
  @sandbox = defaults[:sandbox]
15
-
16
14
  @debug = defaults[:debug]
17
15
  end
18
16
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DutyCalculator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  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.1
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 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler