class Fredric::API

Provides access to all the FRED API endpoints with dynamic methods anc caching.

Attributes

api_key[R]

Public Class Methods

new(api_key, opts={}) click to toggle source
# File lib/fredric/api.rb, line 11
def initialize(api_key, opts={})
  @api_key = api_key
  cache.disable unless opts[:use_cache]
  cache.dir = opts[:cache_dir] if opts[:cache_dir]
  cache.life = opts[:cache_life] if opts[:cache_life]
end

Public Instance Methods

default_query() click to toggle source
# File lib/fredric/api.rb, line 18
def default_query
  { api_key: api_key, file_type: :json } 
end