Module: OpenCongressApi::Fetcher

Defined in:
lib/opencongress_api/fetcher.rb,
lib/opencongress_api/fetcher/base.rb,
lib/opencongress_api/fetcher/bills.rb,
lib/opencongress_api/fetcher/people.rb

Defined Under Namespace

Classes: Bills, HotBills, MostBloggedBills, MostCommentedBills, MostOpposedBills, MostSupportedBills, MostTrackedBills, NewsworthyBills, People

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(type) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/opencongress_api/fetcher.rb', line 8

def for(type)
  return  case type.to_sym
          when :people
            People.new
          when :bills
            Bills.new
          when :hot_bills
            HotBills.new
          when :most_blogged_bills
            MostBloggedBills.new
          when :newsworthy_bills
            NewsworthyBills.new
          when :most_commented_bills
            MostCommentedBills.new
          when :most_tracked_bills
            MostTrackedBills.new
          when :most_supported_bills
            MostSupportedBills.new
          when :most_opposed_bills
            MostOpposedBills.new
          end
end

Instance Method Details

#initialize(error_message, request_url) ⇒ Object



7
8
9
# File 'lib/opencongress_api/fetcher/base.rb', line 7

def initialize(error_message, request_url)
  super "OpenCongress API Error: #{error_message}"
end