Class: GovKit::OpenStates::Bill

Inherits:
GovKit::OpenStatesResource show all
Defined in:
lib/gov_kit/open_states.rb

Overview

The Bill class represents the bill data returned from Open States.

For details about fields returned, see the Open States documentation, at openstates.sunlightlabs.com/api/bills/,

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #raw_response

Class Method Summary collapse

Methods inherited from GovKit::OpenStatesResource

get_uri

Methods inherited from Resource

#initialize, instantiate, instantiate_collection, parse, #to_md5, #unload

Constructor Details

This class inherits a constructor from GovKit::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GovKit::Resource

Class Method Details

.find(state_abbrev, session, bill_id, chamber = '') ⇒ Object



64
65
66
67
68
69
# File 'lib/gov_kit/open_states.rb', line 64

def self.find(state_abbrev, session, bill_id, chamber = '')
  escaped_bill_id = bill_id.gsub(/ /, '%20')
  escaped_session = session.gsub(/ /, '%20')

  get_uri("/bills/#{state_abbrev.downcase}/#{escaped_session}/#{chamber.blank? ? '' : chamber + '/'}#{escaped_bill_id}/")
end

.latest(updated_since, ops = {}) ⇒ Object



76
77
78
79
# File 'lib/gov_kit/open_states.rb', line 76

def self.latest(updated_since, ops = {})
  response = get('/bills/', :query => {:updated_since => updated_since.to_s}.merge(ops))
  parse(response)
end

.search(query, options = {}) ⇒ Object



71
72
73
74
# File 'lib/gov_kit/open_states.rb', line 71

def self.search(query, options = {})
  result = get_uri('/bills/', :query => {:q => query}.merge(options))
  return Array(result)
end