class CongressV3::Bill

Public Class Methods

all(params={}) click to toggle source
# File lib/congress_v3/bill.rb, line 2
def self.all(params={})
  CongressV3::Request.bills(params)
end
find(bill_id) click to toggle source
# File lib/congress_v3/bill.rb, line 6
def self.find(bill_id)
  self.all(bill_id: bill_id).results.first
end
new(params) click to toggle source
# File lib/congress_v3/bill.rb, line 14
def initialize(params)
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
    self.class.send(:attr_reader, key)
  end
end

Public Instance Methods

text() click to toggle source
# File lib/congress_v3/bill.rb, line 21
def text
  @text ||= if @last_version && @last_version['urls'] && @last_version['urls']['html']
              CongressV3::Request.bill_text(@last_version['urls']['html'])
            else
              "No text for this bill"
            end
end
votes(params={}) click to toggle source
# File lib/congress_v3/bill.rb, line 29
def votes(params={})
  @votes ||= CongressV3::Request.bill_votes(bill_id, params)
end