fredapi 1.0.0 → 1.0.1.pre.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/.travis.yml +11 -6
- data/Gemfile +3 -2
- data/README.md +75 -0
- data/fredapi.gemspec +2 -2
- data/lib/fredapi/version.rb +1 -1
- metadata +6 -21
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzhhYzcyYzg1OWUxOTA2YWVhZWU0ODkxNWYzZDk2ODg4MGY2MGFmOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MWQ5YjExOTg0MjE4YzJlMjI2Y2VhNDY3NDIxN2JiNzE2NzA4ZTRlNg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YmNhNmE4MGE1MjM5ODk5YTc4M2UyYmZjMzBhZjU0NjNmYTc5NTA1YTI0ZmU0
|
10
|
+
MmJkYzkyZGE2YzJlNjlmNTFlYzMxNjZhYTczZGMxYjY0OTc5YzAyODZhZjkz
|
11
|
+
OWJmNmI3MTdmMjc1N2NlNjRhOWIzZmFiZmMwY2NhOWEwYTYxZTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjVhNmFkZjk4ZTM4M2I2MTIxYzQ0NjY2YjE2M2M4YjVhMjg4NTJlMTAxNDA2
|
14
|
+
Y2Y4MDliODM0NDdkMWE2MTBjNWE2MDM2MDQzODBkZjhjZGFmNWM3MmY5ZGY4
|
15
|
+
MjMxMjMxZWRkMGE3NjVhN2MxZTcwNmFmNGE2YzRkMDczN2Q3MWI=
|
data/.travis.yml
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
- 2.0.0
|
4
|
+
- 1.9.3
|
5
|
+
- 1.9.2
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
deploy:
|
8
|
+
provider: rubygems
|
9
|
+
api_key:
|
10
|
+
secure: Sp/4Xrahu59AP1NFDdf3vsfpdoH0NzG9HtUdkwCVprfvBArHXwNcQi5b2i1m14q6M+njCtwmOg/OlqAoInsFf6QQXm9PZGjM/KZTpAw/YQ6+qmYDKXBpcMuYB/3HltBm4TJQ3y1enXPlOxqvI1NO2vcq31KwHn7XV8UvbTS/sfw=
|
11
|
+
gem: fredapi
|
12
|
+
on:
|
13
|
+
repo: jonathanchrisp/fredapi
|
9
14
|
|
10
|
-
script: bundle exec rspec
|
15
|
+
script: bundle exec rspec
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/fredapi.png)](http://badge.fury.io/rb/fredapi)
|
2
|
+
[![Build Status](https://travis-ci.org/jonathanchrisp/fredapi.png?branch=master)](https://travis-ci.org/jonathanchrisp/fredapi)
|
3
|
+
[![Dependency Status](https://gemnasium.com/jonathanchrisp/fredapi.png)](https://gemnasium.com/jonathanchrisp/fredapi)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/jonathanchrisp/fredapi.png)](https://codeclimate.com/github/jonathanchrisp/fredapi)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/jonathanchrisp/fredapi/badge.png)](https://coveralls.io/r/jonathanchrisp/fredapi)
|
6
|
+
|
7
|
+
# fredapi
|
8
|
+
A Ruby wrapper for the [Federal Reserve Economic Data API](http://api.stlouisfed.org/docs/fred/overview.html) (FRED).
|
9
|
+
|
10
|
+
## Documentation
|
11
|
+
* Original documenation: <http://api.stlouisfed.org/docs/fred/>
|
12
|
+
* Gem documentation: <http://rubydoc.info/gems/fredapi>
|
13
|
+
|
14
|
+
## Getting Started
|
15
|
+
In order to be able to send API requests you'll first need to install the `fredapi` gem.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem install fredapi
|
19
|
+
```
|
20
|
+
|
21
|
+
You will need to register and request an API key in order to requests. To register please click [here](http://research.stlouisfed.org/useraccount/register/step1). Request an API key by following the instructions [here](http://api.stlouisfed.org/api_key.html).
|
22
|
+
|
23
|
+
Once you have completed the steps above, you can now create an instance of a `FREDAPI::Client` and set your API key as appropriate:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'fredapi'
|
27
|
+
api = FREDAPI::Client.new 'api_key' => '123456789'
|
28
|
+
```
|
29
|
+
|
30
|
+
If you now look at your `FREDAPI` object instance it will be similar to the following:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
<FREDAPI::Client:0x007ffb89bcf3e0
|
34
|
+
@adapter=:net_http,
|
35
|
+
@api_endpoint="http://api.stlouisfed.org/",
|
36
|
+
@api_key='123456789',
|
37
|
+
@file_type="json",
|
38
|
+
@user_agent="FREDAPI Ruby Gem 1.0.0">
|
39
|
+
```
|
40
|
+
|
41
|
+
By the default the file_type is set to `json`. This can be easily be changed by simply updating the instance variable to be set to `xml`:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
api.file_type = 'xml'
|
45
|
+
```
|
46
|
+
|
47
|
+
Please note that when sending any FRED API request if you don't pass an `api_key` or `file_type` parameter the values on the `FREDAPI::Client` instance will be used as default.
|
48
|
+
|
49
|
+
## Example requests
|
50
|
+
Now that you have an `FREDAPI::Client` instance with your API key you can now make requests to the FRED API. For example to send a category get request do the following:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
api.category 'category_id' => 125
|
54
|
+
```
|
55
|
+
|
56
|
+
The response is returned within a `Hashie::Mash` instance.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
{"categories"=>[{"id"=>125, "name"=>"Trade Balance", "parent_id"=>13}]}
|
60
|
+
```
|
61
|
+
|
62
|
+
To find out more information about `Hashie` please visit the following link: <https://github.com/intridea/hashie>. To see all documention on the various FREDAPI endpoint method calls please visit: <http://rubydoc.info/gems/fredapi>
|
63
|
+
|
64
|
+
## Tests
|
65
|
+
There are a number of unit tests which are included as part of this project, please run:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
rspec spec
|
69
|
+
```
|
70
|
+
|
71
|
+
Please note that a number of tests still need to be added so I don't currently have complete coverage, subject to workload these will be slowly added over the next few months.
|
72
|
+
|
73
|
+
## Feedback
|
74
|
+
I would be more than happy to recieve feedback, please email me at: jonathan.chrisp@gmail.com.
|
75
|
+
|
data/fredapi.gemspec
CHANGED
@@ -3,7 +3,8 @@ require File.dirname(__FILE__) + "/lib/fredapi/version"
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'fredapi'
|
5
5
|
s.version = FREDAPI::VERSION
|
6
|
-
s.
|
6
|
+
s.version = FREDAPI::VERSION + ".pre.#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
|
7
|
+
s.date = '2013-09-20'
|
7
8
|
s.summary = 'FRED API Ruby Wrapper'
|
8
9
|
s.description = 'A Ruby wrapper for the FRED API'
|
9
10
|
s.author = 'Jonathan Chrisp'
|
@@ -13,7 +14,6 @@ Gem::Specification.new do |s|
|
|
13
14
|
s.required_ruby_version = ">= 1.9.2"
|
14
15
|
|
15
16
|
s.add_development_dependency 'rspec', '~> 2.13.0'
|
16
|
-
s.add_development_dependency 'pry', '~> 0.9.12.2'
|
17
17
|
|
18
18
|
s.add_runtime_dependency 'faraday', '~> 0.8.7'
|
19
19
|
s.add_runtime_dependency 'faraday_middleware', '~> 0.9.0'
|
data/lib/fredapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fredapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1.pre.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Chrisp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.13.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.12.2
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.12.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: faraday
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,21 +129,20 @@ require_paths:
|
|
143
129
|
- lib
|
144
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
131
|
requirements:
|
146
|
-
- - '>='
|
132
|
+
- - ! '>='
|
147
133
|
- !ruby/object:Gem::Version
|
148
134
|
version: 1.9.2
|
149
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
136
|
requirements:
|
151
|
-
- - '
|
137
|
+
- - ! '>'
|
152
138
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
139
|
+
version: 1.3.1
|
154
140
|
requirements: []
|
155
141
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.0.3
|
157
143
|
signing_key:
|
158
144
|
specification_version: 4
|
159
145
|
summary: FRED API Ruby Wrapper
|
160
146
|
test_files:
|
161
147
|
- spec/fredapi_spec.rb
|
162
148
|
- spec/helper.rb
|
163
|
-
has_rdoc:
|