Class: OpenCongressApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/opencongress_api.rb

Constant Summary collapse

FETCH_TYPES =
[:people, :hot_bills, :most_blogged_bills,
:bills_in_the_news, :most_commented_bills,
:most_tracked_bills, :most_supported_bills,
:most_opposed_bills]

Class Method Summary collapse

Class Method Details

.fetch(type, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/opencongress_api.rb', line 24

def self.fetch(type, options = {})
    check_configuration!

    options = default_options.merge(options)
    if FETCH_TYPES.include? type.to_sym
        fetcher = OpenCongressApi::Fetcher.for(type)
        return fetcher.fetch(options)
    else
        raise InvalidRequestTypeError.new(type)
    end
end