uncomtrade 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/HISTORY.md +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +195 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/uncomtrade.rb +12 -0
- data/lib/uncomtrade/errors.rb +19 -0
- data/lib/uncomtrade/helpers/country.rb +37 -0
- data/lib/uncomtrade/helpers/iterator.rb +50 -0
- data/lib/uncomtrade/options.rb +53 -0
- data/lib/uncomtrade/query.rb +13 -0
- data/lib/uncomtrade/request.rb +34 -0
- data/lib/uncomtrade/response.rb +45 -0
- data/lib/uncomtrade/version.rb +3 -0
- data/uncomtrade.gemspec +29 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1bb614f87fe09f30d8b3542b0054672308f0f9ca
|
4
|
+
data.tar.gz: dd3ae6c6a18bb771d2fa2954d5575b7ccd08f9ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d8ab065950d5cb2403b22a002d789e5e88f61e0ca1aa6875758034bac8af3d933f161c56d656d6ad71082f073766a477f65abad0cc4b65ccc9b3d4bb354cd49
|
7
|
+
data.tar.gz: c30475b1e94dcf3937ff637e8a13b1e3e27bca17663c2414f3a85306e2a9cfe022d549a5a7f84bca92e7792ab655c21c7ad153126937668e78aca1669268cb76
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/HISTORY.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Rickard Sunden
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
# Uncomtrade
|
2
|
+
|
3
|
+
Simple gem for using the [UN Comtrade API][comtrade]. Their docs state the API can be changed at any moment, so use caution using this gem. I will try to keep it up-to-date as possible.
|
4
|
+
|
5
|
+
Basic objectives of gem:
|
6
|
+
* Keep parameter names and default values consistent with API.
|
7
|
+
* Convenience methods to make querying and processing data easier.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'uncomtrade'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install uncomtrade
|
24
|
+
|
25
|
+
## Basic Usage
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
request = Uncomtrade::Request.new(max: 2)
|
29
|
+
response = request.get_data
|
30
|
+
|
31
|
+
response.dataset
|
32
|
+
#=> [{"pfCode"=>"H4","yr"=>2014, ...}, ... ]
|
33
|
+
|
34
|
+
response.cherry_pick("period" => "period", "TradeValue" => "trade_amount")
|
35
|
+
#=> [{"period"=>2014, "trade_amount"=>5229972238}, ...]
|
36
|
+
```
|
37
|
+
|
38
|
+
## Detailed Usage
|
39
|
+
|
40
|
+
### Request object
|
41
|
+
|
42
|
+
CAUTION: Currently the API only supports the `type` parameter to equal `C`. In this gem you cannot change the `pmt` parameter from `json`.
|
43
|
+
|
44
|
+
#### Creating the object
|
45
|
+
|
46
|
+
In order to make a request to the API you'll need to create a request object. For convenience, all query parameters have defaults based on the [UN Comtrade API docs][comtrade]. View the current parameters for your request by calling `.params`.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
request = Uncomtrade::Request.new
|
50
|
+
request.params
|
51
|
+
#=> {:max=>500, :fmt=>"json", :r=>"all", :freq=>"A", :ps=>"now",
|
52
|
+
# :px=>"HS", :p=>0, :rg=>"all", :cc=>"TOTAL", :type=>"C"}
|
53
|
+
```
|
54
|
+
|
55
|
+
When you create a request object you can specify what parameters you want to set values for, ones that are not set will retain their default value.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
request = Uncomtrade::Request.new(max: 200, freq: "M", p: 528 )
|
59
|
+
request.params
|
60
|
+
#=> {:max=>200, :freq=>"M", :fmt=>"json", :r=>"all", :ps=>"now",
|
61
|
+
# :px=>"HS", :p=>528, :rg=>"all", :cc=>"TOTAL", :type=>"C"}
|
62
|
+
```
|
63
|
+
|
64
|
+
#### Retrieving the data
|
65
|
+
|
66
|
+
Call `.get_data` on the request object to return the data. See the [response object](#response-object) documentation on how to interact with data.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
request = Uncomtrade::Request.new(max: 200, freq: "M", p: 528 )
|
70
|
+
response = request.get_data
|
71
|
+
```
|
72
|
+
|
73
|
+
#### Error handling
|
74
|
+
|
75
|
+
The [UN Comtrade API][comtrade] hands back a status for every request. Any status other than `"Ok"` is treated as an error by the API. If you want to rescue the error:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
begin
|
79
|
+
request = Uncomtrade::Request.new(max: 200, freq: "M", p: 528 )
|
80
|
+
response = request.get_data
|
81
|
+
rescue Uncomtrade::ResponseError => error
|
82
|
+
puts error.status
|
83
|
+
puts error.description
|
84
|
+
puts error.message
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
`error.message` will probably be the most helpful in debugging your query.
|
89
|
+
|
90
|
+
|
91
|
+
#### Updating and resetting the request object
|
92
|
+
|
93
|
+
You can update a single parameter or multiple parameters after you've created the request object. You can also reset all of the parameters to their default values by calling `.reset`.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
request = Uncomtrade::Request.new
|
97
|
+
request.update(max: 200)
|
98
|
+
request.update(max: 300, freq: "M")
|
99
|
+
request.reset
|
100
|
+
```
|
101
|
+
|
102
|
+
#### Country finder helper
|
103
|
+
|
104
|
+
WARNING: TO BE SAFE, use the numbers listed in their docs. The API uses the wrong ISO number for France, 251, it should be 250. Not sure how many other errors there are. Also, API includes former countries like USSR, regions and some city states that do not exist in the countries gem. Will work on a better solution.
|
105
|
+
|
106
|
+
The [UN Comtrade API][comtrade] uses ISO numbers for identifying countries/regions. This gem uses the [countries gem][countries] to help you use two/three letter country codes, as well as country names to find the number for you. For a list of available countries/regions check the [UN Comtrade API][comtrade] docs. You can also just use the ISO number.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
# Netherlands
|
110
|
+
request = Uncomtrade::Request.new
|
111
|
+
request.update(p: "NLD")
|
112
|
+
request.update(r: "NL")
|
113
|
+
request.update(p: "netherlands")
|
114
|
+
request.update(p: 528)
|
115
|
+
```
|
116
|
+
|
117
|
+
If you're not specific enough or you write a bad country code, you will get the following exception.
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
request = Uncomtrade::Request.new(p: "u")
|
121
|
+
#=> Uncomtrade::CountryError: Could not find specified country/code: u
|
122
|
+
|
123
|
+
request = Uncomtrade::Request.new(p: "united")
|
124
|
+
#=> Uncomtrade::CountryError: Could not find specified country/code: united
|
125
|
+
```
|
126
|
+
|
127
|
+
### Response object
|
128
|
+
|
129
|
+
#### Data methods
|
130
|
+
|
131
|
+
Calling `.result` will hand back the entire JSON response.
|
132
|
+
Calling `.dataset` will hand back the value of the dataset key from the JSON response. (array of results)
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
|
136
|
+
request = Uncomtrade::Request.new(max: 2)
|
137
|
+
response = request.get_data
|
138
|
+
|
139
|
+
response.result
|
140
|
+
response.dataset
|
141
|
+
|
142
|
+
```
|
143
|
+
|
144
|
+
#### Convenience methods
|
145
|
+
|
146
|
+
To iterate over the dataset to only get the information you want, call `.cherry_pick`. The method allows you to rename keys if you want. See below.
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
|
150
|
+
request = Uncomtrade::Request.new(max: 2)
|
151
|
+
response = request.get_data
|
152
|
+
|
153
|
+
response.cherry_pick(:period => "Year", :TradeValue => "Value")
|
154
|
+
#=> [{"Year"=>2014, "Value"=>5229972238}, ...]
|
155
|
+
|
156
|
+
response.cherry_pick(period: :year, TradeValue: :trade_amount)
|
157
|
+
#=> [{:year=>2014, :trade_amount=>5229972238}, ...]
|
158
|
+
|
159
|
+
response.cherry_pick("period" => "period", "TradeValue" => "TradeValue")
|
160
|
+
#=> [{"period"=>2014, "TradeValue"=>5229972238}, ...]
|
161
|
+
|
162
|
+
```
|
163
|
+
|
164
|
+
Use `.to_csv` to save a csv file with data that you want. If you don't specify any selectors all data will be returned.
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
|
168
|
+
request = Uncomtrade::Request.new(max: 2)
|
169
|
+
response = request.get_data
|
170
|
+
|
171
|
+
selectors = { period: :period,
|
172
|
+
TradeValue: :trade_amount,
|
173
|
+
rtTitle: :reporter_country }
|
174
|
+
|
175
|
+
# ONLY DATA FROM SELECTORS
|
176
|
+
response.to_csv(file: "filepath.csv", selectors: selectors)
|
177
|
+
|
178
|
+
# ALL DATA
|
179
|
+
response.to_csv(file: "filepath.csv")
|
180
|
+
|
181
|
+
```
|
182
|
+
|
183
|
+
|
184
|
+
## Contributing
|
185
|
+
|
186
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sunrick/uncomtrade. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
187
|
+
|
188
|
+
|
189
|
+
## License
|
190
|
+
|
191
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
192
|
+
|
193
|
+
|
194
|
+
[comtrade]: http://comtrade.un.org/data/doc/api/
|
195
|
+
[countries]: https://github.com/hexorx/countries
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "uncomtrade"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/uncomtrade.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Uncomtrade
|
2
|
+
|
3
|
+
class CountryError < StandardError
|
4
|
+
def initialize(nation)
|
5
|
+
message = "Could not find specified country/code: #{nation}"
|
6
|
+
super(message)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class ResponseError < StandardError
|
11
|
+
attr_reader :status, :description
|
12
|
+
def initialize(status, description, msg)
|
13
|
+
@status = status
|
14
|
+
@description = description
|
15
|
+
super(msg)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../errors'
|
2
|
+
|
3
|
+
module Uncomtrade
|
4
|
+
|
5
|
+
module Helpers
|
6
|
+
|
7
|
+
class Country
|
8
|
+
|
9
|
+
def self.iso_code(nation)
|
10
|
+
if nation == 0
|
11
|
+
0 # countries gem has no number called 0, it is comtrade api number.
|
12
|
+
elsif nation == "all"
|
13
|
+
"all"
|
14
|
+
else
|
15
|
+
find_country(nation)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def self.find_country(nation)
|
22
|
+
if nation.is_a?(Integer)
|
23
|
+
nation
|
24
|
+
else
|
25
|
+
country = ISO3166::Country.find_country_by_name(nation) ||
|
26
|
+
ISO3166::Country.find_country_by_alpha3(nation) ||
|
27
|
+
ISO3166::Country.find_country_by_alpha2(nation)
|
28
|
+
raise CountryError, nation if country.nil?
|
29
|
+
country.number.to_i
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Uncomtrade
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
class Iterator
|
5
|
+
|
6
|
+
def initialize(array)
|
7
|
+
@array = array
|
8
|
+
end
|
9
|
+
|
10
|
+
def cherry_pick(selectors)
|
11
|
+
if !selectors.empty?
|
12
|
+
selectors = syms_to_strings(selectors)
|
13
|
+
array.map do |data|
|
14
|
+
hash = create_hash(data, selectors)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
array
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_csv(csv_path, selectors)
|
22
|
+
CSV.open(csv_path, "wb") do |csv|
|
23
|
+
picked_array = cherry_pick(selectors)
|
24
|
+
csv << picked_array.first.keys
|
25
|
+
picked_array.each do |hash|
|
26
|
+
csv << hash.values
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :array
|
34
|
+
|
35
|
+
def syms_to_strings(selectors)
|
36
|
+
selectors.map do |key, value|
|
37
|
+
[key.to_s, value]
|
38
|
+
end.to_h
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_hash(data, selectors)
|
42
|
+
selectors.inject({}) do |memo, selector|
|
43
|
+
memo.merge({selector.last => data[selector.first]})
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative 'helpers/country'
|
2
|
+
|
3
|
+
module Uncomtrade
|
4
|
+
|
5
|
+
class Options
|
6
|
+
|
7
|
+
attr_reader :options
|
8
|
+
|
9
|
+
def initialize(opts={})
|
10
|
+
set_options(opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(opts={})
|
14
|
+
opts.each do |key, value|
|
15
|
+
if [:p,:r].include?(key)
|
16
|
+
self.options[key] = iso_code(value)
|
17
|
+
else
|
18
|
+
self.options[key] = value if key != :fmt # don't let user update :fmt
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def reset
|
24
|
+
set_options
|
25
|
+
end
|
26
|
+
|
27
|
+
def list_options
|
28
|
+
options
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def set_options(options={})
|
34
|
+
options[:max] ||= 500
|
35
|
+
options[:fmt] = 'json' # only support json
|
36
|
+
options[:r] = options[:r].nil? ? 'all': iso_code(options[:r])
|
37
|
+
options[:freq] ||= 'A'
|
38
|
+
options[:ps] ||= 'now'
|
39
|
+
options[:px] ||= 'HS'
|
40
|
+
options[:p] = options[:p].nil? ? 0 : iso_code(options[:p])
|
41
|
+
options[:rg] ||= 'all'
|
42
|
+
options[:cc] ||= 'TOTAL'
|
43
|
+
options[:type] ||= 'C'
|
44
|
+
@options = options
|
45
|
+
end
|
46
|
+
|
47
|
+
def iso_code(country)
|
48
|
+
Helpers::Country.iso_code(country)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Uncomtrade
|
2
|
+
|
3
|
+
class Request
|
4
|
+
|
5
|
+
def initialize(opts={})
|
6
|
+
@options = Options.new(opts)
|
7
|
+
@query = Query.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_data
|
11
|
+
http_response = query.get_data(options.list_options)
|
12
|
+
Response.new(http_response)
|
13
|
+
end
|
14
|
+
|
15
|
+
def reset
|
16
|
+
options.reset
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def update(opts={})
|
21
|
+
options.update(opts)
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def params
|
26
|
+
options.list_options
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
attr_reader :options, :query
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'helpers/iterator'
|
2
|
+
require_relative 'errors'
|
3
|
+
|
4
|
+
module Uncomtrade
|
5
|
+
|
6
|
+
class Response
|
7
|
+
|
8
|
+
def initialize(response)
|
9
|
+
@response = JSON.parse(response.body)
|
10
|
+
check_status!
|
11
|
+
@iterator = Helpers::Iterator.new(dataset)
|
12
|
+
end
|
13
|
+
|
14
|
+
def result
|
15
|
+
response
|
16
|
+
end
|
17
|
+
|
18
|
+
def dataset
|
19
|
+
response["dataset"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def cherry_pick(options={})
|
23
|
+
iterator.cherry_pick(selectors)
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_csv(file:, selectors: {})
|
27
|
+
iterator.to_csv(file, selectors)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :response, :iterator
|
33
|
+
|
34
|
+
def check_status!
|
35
|
+
message = "Server error: #{response["Message"]}"
|
36
|
+
raise ResponseError.new(nil, nil, message) if response["Message"]
|
37
|
+
status = response["validation"]["status"]["name"]
|
38
|
+
description = response["validation"]["status"]["description"]
|
39
|
+
message = response["validation"]["message"]
|
40
|
+
raise ResponseError.new(status, description, message) if status != "Ok"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/uncomtrade.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'uncomtrade/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "uncomtrade"
|
8
|
+
spec.version = Uncomtrade::VERSION
|
9
|
+
spec.authors = ["Rickard Sunden"]
|
10
|
+
spec.email = ["rickard.sunden@outlook.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Simple ruby API wrapper for the UN COMTRADE Database.}
|
13
|
+
spec.description = %q{Simple ruby API wrapper for the UN COMTRADE Database.}
|
14
|
+
spec.homepage = "https://github.com/sunrick/uncomtrade"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "httparty", "~> 0.13.7"
|
23
|
+
spec.add_runtime_dependency "countries", "~> 1.1.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", '~> 3.3'
|
28
|
+
spec.add_development_dependency "pry", '~> 0.10.1'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: uncomtrade
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rickard Sunden
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: countries
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.1
|
97
|
+
description: Simple ruby API wrapper for the UN COMTRADE Database.
|
98
|
+
email:
|
99
|
+
- rickard.sunden@outlook.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- HISTORY.md
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/uncomtrade.rb
|
116
|
+
- lib/uncomtrade/errors.rb
|
117
|
+
- lib/uncomtrade/helpers/country.rb
|
118
|
+
- lib/uncomtrade/helpers/iterator.rb
|
119
|
+
- lib/uncomtrade/options.rb
|
120
|
+
- lib/uncomtrade/query.rb
|
121
|
+
- lib/uncomtrade/request.rb
|
122
|
+
- lib/uncomtrade/response.rb
|
123
|
+
- lib/uncomtrade/version.rb
|
124
|
+
- uncomtrade.gemspec
|
125
|
+
homepage: https://github.com/sunrick/uncomtrade
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.4.5
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Simple ruby API wrapper for the UN COMTRADE Database.
|
149
|
+
test_files: []
|