fredapi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.travis.yml +10 -0
  4. data/Gemfile +6 -0
  5. data/LICENCE.md +20 -0
  6. data/README.md +0 -0
  7. data/bin/fredapi +2 -0
  8. data/fredapi.gemspec +26 -0
  9. data/lib/faraday/utils/utils.rb +24 -0
  10. data/lib/fredapi.rb +29 -0
  11. data/lib/fredapi/client.rb +41 -0
  12. data/lib/fredapi/client/category.rb +31 -0
  13. data/lib/fredapi/client/category/children.rb +23 -0
  14. data/lib/fredapi/client/category/related.rb +23 -0
  15. data/lib/fredapi/client/category/related_tags.rb +30 -0
  16. data/lib/fredapi/client/category/series.rb +30 -0
  17. data/lib/fredapi/client/category/tags.rb +30 -0
  18. data/lib/fredapi/client/related_tags.rb +27 -0
  19. data/lib/fredapi/client/release.rb +33 -0
  20. data/lib/fredapi/client/release/dates.rb +28 -0
  21. data/lib/fredapi/client/release/related_tags.rb +30 -0
  22. data/lib/fredapi/client/release/series.rb +30 -0
  23. data/lib/fredapi/client/release/sources.rb +23 -0
  24. data/lib/fredapi/client/release/tags.rb +30 -0
  25. data/lib/fredapi/client/releases.rb +29 -0
  26. data/lib/fredapi/client/releases/dates.rb +27 -0
  27. data/lib/fredapi/client/series.rb +37 -0
  28. data/lib/fredapi/client/series/categories.rb +23 -0
  29. data/lib/fredapi/client/series/observations.rb +33 -0
  30. data/lib/fredapi/client/series/release.rb +23 -0
  31. data/lib/fredapi/client/series/search.rb +38 -0
  32. data/lib/fredapi/client/series/search/related_tags.rb +32 -0
  33. data/lib/fredapi/client/series/search/tags.rb +32 -0
  34. data/lib/fredapi/client/series/tags.rb +25 -0
  35. data/lib/fredapi/client/series/updates.rb +26 -0
  36. data/lib/fredapi/client/series/vintage_dates.rb +27 -0
  37. data/lib/fredapi/client/source.rb +25 -0
  38. data/lib/fredapi/client/source/releases.rb +27 -0
  39. data/lib/fredapi/client/sources.rb +24 -0
  40. data/lib/fredapi/client/tags.rb +31 -0
  41. data/lib/fredapi/client/tags/series.rb +27 -0
  42. data/lib/fredapi/configuration.rb +45 -0
  43. data/lib/fredapi/connection.rb +32 -0
  44. data/lib/fredapi/request.rb +98 -0
  45. data/lib/fredapi/version.rb +3 -0
  46. data/spec/fredapi_spec.rb +23 -0
  47. data/spec/helper.rb +12 -0
  48. metadata +163 -0
@@ -0,0 +1,30 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Release
4
+ # RelatedTags module for fred/release/related_tags endpoint
5
+ module RelatedTags
6
+
7
+ # Get the related tags for a release
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] release_id The id for a release
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
16
+ # @option opts [String] tag_group_id A tag group id to filter tags by type
17
+ # @option opts [String] search_text The words to find matching tags with
18
+ # @option opts [Integer] limit The maximum number of results to return
19
+ # @option opts [Integer] offset Non-negative integer
20
+ # @option opts [String] order_by Order results by values of the specified attribute
21
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
22
+ # @return [Hashie::Mash] Hash containing the results
23
+ def release_related_tags opts={}
24
+ get "fred/release/related_tags", opts
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Release
4
+ # RelatedTags module for fred/release/series endpoint
5
+ module Series
6
+
7
+ # Get the series on a release of economic data
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] release_id The id for a release
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [Integer] limit The maximum number of results to return
16
+ # @option opts [Integer] offset Non-negative integer
17
+ # @option opts [String] order_by Order results by values of the specified attribute
18
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
19
+ # @option opts [String] filter_variable The attribute to filter results by
20
+ # @option opts [String] filter_value The attribute to filter results by
21
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
22
+ # @return [Hashie::Mash] Hash containing the results
23
+ def release_series opts={}
24
+ get "fred/release/series", opts
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Release
4
+ # Sources module for fred/release/sources endpoint
5
+ module Sources
6
+
7
+ # Get the sources on a release of economic data
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] release_id The id for a release
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @return [Hashie::Mash] Hash containing the results
16
+ def release_sources opts={}
17
+ get "fred/release/sources", opts
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Release
4
+ # Tags module for fred/release/tags endpoint
5
+ module Tags
6
+
7
+ # Get the sources on a release of economic data
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] release_id The id for a release
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [String] tag_group_id A tag group id to filter tags by type
16
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
17
+ # @option opts [String] search_text The words to find matching tags with
18
+ # @option opts [Integer] limit The maximum number of results to return
19
+ # @option opts [Integer] offset Non-negative integer
20
+ # @option opts [String] order_by Order results by values of the specified attribute
21
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
22
+ # @return [Hashie::Mash] Hash containing the results
23
+ def release_tags opts={}
24
+ get "fred/release/tags", opts
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ require 'fredapi/client/releases/dates'
2
+
3
+ module FREDAPI
4
+ class Client
5
+ # Releases module for fred/releases endpoint
6
+ module Releases
7
+
8
+ # Get all releases of economic data
9
+ #
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
12
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
13
+ # @option opts [Integer] category_id The id for a category
14
+ # @option opts [String] realtime_start The start of the real-time period
15
+ # @option opts [String] realtime_end The end of the real-time period
16
+ # @option opts [Integer] limit The maximum number of results to return
17
+ # @option opts [Integer] offset Non-negative integer
18
+ # @option opts [String] order_by Order results by values of the specified attribute
19
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
20
+ # @return [Hashie::Mash] Hash containing the results
21
+ def releases opts={}
22
+ get "fred/releases", opts
23
+ end
24
+
25
+ include FREDAPI::Client::Releases::Dates
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Releases
4
+ # Dates module for fred/releases/dates endpoint
5
+ module Dates
6
+
7
+ # Get releases dates for all releases of economic data
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [String] realtime_start The start of the real-time period
13
+ # @option opts [String] realtime_end The end of the real-time period
14
+ # @option opts [Integer] limit The maximum number of results to return
15
+ # @option opts [Integer] offset Non-negative integer
16
+ # @option opts [String] order_by Order results by values of the specified attribute
17
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
18
+ # @option opts [Integer] include_release_dates_with_no_data Determines whether release dates with no data available are returned.
19
+ # @return [Hashie::Mash] Hash containing the results
20
+ def releases_dates opts={}
21
+ get "fred/releases/dates", opts
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,37 @@
1
+ require 'fredapi/client/series/categories'
2
+ require 'fredapi/client/series/observations'
3
+ require 'fredapi/client/series/release'
4
+ require 'fredapi/client/series/search'
5
+ require 'fredapi/client/series/tags'
6
+ require 'fredapi/client/series/updates'
7
+ require 'fredapi/client/series/vintage_dates'
8
+
9
+ module FREDAPI
10
+ class Client
11
+ # Series module for fred/series endpoint
12
+ module Series
13
+
14
+ # Get an economic data series
15
+ #
16
+ # @param opts [Hash] options hash of parameters
17
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
18
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
19
+ # @option opts [Integer] series_id The id for a series
20
+ # @option opts [String] realtime_start The start of the real-time period
21
+ # @option opts [String] realtime_end The end of the real-time period
22
+ # @return [Hashie::Mash] Hash containing the results
23
+ def series opts={}
24
+ get "fred/series", opts
25
+ end
26
+
27
+ include FREDAPI::Client::Series::Categories
28
+ include FREDAPI::Client::Series::Observations
29
+ include FREDAPI::Client::Series::Release
30
+ include FREDAPI::Client::Series::Search
31
+ include FREDAPI::Client::Series::Tags
32
+ include FREDAPI::Client::Series::Updates
33
+ include FREDAPI::Client::Series::VintageDates
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,23 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ # Categories module for fred/series/categories endpoint
5
+ module Categories
6
+
7
+ # Get the categories for an economic data series
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] series_id The id for a series
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @return [Hashie::Mash] Hash containing the results
16
+ def series_categories opts={}
17
+ get "fred/series/categories", opts
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ # Observations module for fred/series/observations endpoint
5
+ module Observations
6
+
7
+ # Get the observations or data values for an economic data series
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] series_id The id for a series
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [Integer] limit The maximum number of results to return
16
+ # @option opts [Integer] offset Non-negative integer
17
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
18
+ # @option opts [String] observation_start The start of the observation period
19
+ # @option opts [String] observation_end The end of the observation period
20
+ # @option opts [String] units A key that indicates a data value transformation
21
+ # @option opts [String] frequency An optional parameter that indicates a lower frequency to aggregate values to.
22
+ # @option opts [String] aggregation_method A key that indicates the aggregation method used for frequency aggregation
23
+ # @option opts [Integer] output_type An integer that indicates an output type
24
+ # @option opts [String] vintage_dates A comma separated string of YYYY-MM-DD formatted dates in history
25
+ # @return [Hashie::Mash] Hash containing the results
26
+ def series_observations opts={}
27
+ get "fred/series/observations", opts
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ # Release module for fred/series/release endpoint
5
+ module Release
6
+
7
+ # Get the release for an economic data series
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] series_id The id for a series
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @return [Hashie::Mash] Hash containing the results
16
+ def series_release opts={}
17
+ get "fred/series/release", opts
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ require 'fredapi/client/series/search/tags'
2
+ require 'fredapi/client/series/search/related_tags'
3
+
4
+ module FREDAPI
5
+ class Client
6
+ module Series
7
+ # Search module for fred/series/search endpoint
8
+ module Search
9
+
10
+ # Get economic data series that match keywords
11
+ #
12
+ # @param opts [Hash] options hash of parameters
13
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
14
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
15
+ # @option opts [Integer] series_id The id for a series
16
+ # @option opts [String] search_text The words to match against economic data series
17
+ # @option opts [String] search_type Determines the type of search to perform
18
+ # @option opts [String] realtime_start The start of the real-time period
19
+ # @option opts [String] realtime_end The end of the real-time period
20
+ # @option opts [Integer] limit The maximum number of results to return
21
+ # @option opts [Integer] offset Non-negative integer
22
+ # @option opts [String] order_by Order results by values of the specified attribute
23
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
24
+ # @option opts [String] filter_variable The attribute to filter results by
25
+ # @option opts [String] filter_value The attribute to filter results by
26
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
27
+ # @return [Hashie::Mash] Hash containing the results
28
+ def series_search opts={}
29
+ get "fred/series/search", opts
30
+ end
31
+
32
+ include FREDAPI::Client::Series::Search::Tags
33
+ include FREDAPI::Client::Series::Search::RelatedTags
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,32 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ module Search
5
+ # RelatedTags module for fred/series/search/related_tags endpoint
6
+ module RelatedTags
7
+
8
+ # Get the related tags for a series search
9
+ #
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
12
+ # @option opts [String] file_type A key or file extension that indicates the type
13
+ # @option opts [Integer] series_search_text The words to match against economic data series
14
+ # @option opts [String] realtime_start The start of the real-time period
15
+ # @option opts [String] realtime_end The end of the real-time period
16
+ # @option opts [String] tag_group_id A tag group id to filter tags by type
17
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
18
+ # @option opts [String] tag_search_text The words to find matching tags with
19
+ # @option opts [Integer] limit The maximum number of results to return
20
+ # @option opts [Integer] offset Non-negative integer
21
+ # @option opts [String] order_by Order results by values of the specified attribute
22
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
23
+ # @return [Hashie::Mash] Hash containing the results
24
+ def series_search_related_tags opts={}
25
+ get "fred/series/search/related_tags", opts
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ module Search
5
+ # Tags module for fred/series/search/tags endpoint
6
+ module Tags
7
+
8
+ # Get the tags for a series search
9
+ #
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
12
+ # @option opts [String] file_type A key or file extension that indicates the type
13
+ # @option opts [Integer] series_search_text The words to match against economic data series
14
+ # @option opts [String] realtime_start The start of the real-time period
15
+ # @option opts [String] realtime_end The end of the real-time period
16
+ # @option opts [String] tag_group_id A tag group id to filter tags by type
17
+ # @option opts [String] tag_names A semicolon delimited list of tags to find related tags for
18
+ # @option opts [String] tag_search_text The words to find matching tags with
19
+ # @option opts [Integer] limit The maximum number of results to return
20
+ # @option opts [Integer] offset Non-negative integer
21
+ # @option opts [String] order_by Order results by values of the specified attribute
22
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
23
+ # @return [Hashie::Mash] Hash containing the results
24
+ def series_search_tags opts={}
25
+ get "fred/series/search/tags", opts
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ # Tags module for fred/series/tags endpoint
5
+ module Tags
6
+
7
+ # Get the tags for an economic data series
8
+ #
9
+ # @param opts [Hash] options hash of parameters
10
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
11
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
12
+ # @option opts [Integer] series_id The id for a series
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [String] order_by Order results by values of the specified attribute
16
+ # @option opts [String] sort_order Sort results is ascending or descending order for attribute values specified by order_by
17
+ # @return [Hashie::Mash] Hash containing the results
18
+ def series_tags opts={}
19
+ get "fred/series/tags", opts
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module FREDAPI
2
+ class Client
3
+ module Series
4
+ # Updates module for fred/series/updates endpoint
5
+ module Updates
6
+
7
+ # Get economic data series sorted by when observations
8
+ # were updated on the FRED® server
9
+ #
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Integer] api_key 32 character alpha-numeric lowercase string
12
+ # @option opts [String] file_type A key or file extension that indicates the type of file to send
13
+ # @option opts [String] realtime_start The start of the real-time period
14
+ # @option opts [String] realtime_end The end of the real-time period
15
+ # @option opts [Integer] limit The maximum number of results to return
16
+ # @option opts [Integer] offset Non-negative integer
17
+ # @option opts [String] filter_value The attribute to filter results by
18
+ # @return [Hashie::Mash] Hash containing the results
19
+ def series_updates opts={}
20
+ get "fred/series/updates", opts
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end