Class: VoteSmart::State
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#largest_city ⇒ Object
Returns the value of attribute largest_city.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
- .all ⇒ Object
- .find_by_id(state_id) ⇒ Object
-
.get_state(state_id) ⇒ Object
Returns detailed state information.
-
.get_state_ids ⇒ Object
Returns a list of states and their 2 digit IDs.
Methods inherited from Common
construct_url, get_json_data, hash2get, #initialize, parallelize!, request, response_child, session, set_attribute_map, #update_attributes
Constructor Details
This class inherits a constructor from VoteSmart::Common
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/vote_smart/state.rb', line 5 def id @id end |
#largest_city ⇒ Object
Returns the value of attribute largest_city.
5 6 7 |
# File 'lib/vote_smart/state.rb', line 5 def largest_city @largest_city end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/vote_smart/state.rb', line 5 def name @name end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/vote_smart/state.rb', line 9 def self.all response_child(get_state_ids, "stateList", "list", "state").collect {|attributes| State.new(attributes)} end |
.find_by_id(state_id) ⇒ Object
13 14 15 16 |
# File 'lib/vote_smart/state.rb', line 13 def self.find_by_id state_id response = response_child(get_state(state_id), "state", "details") State.new(response) unless response.empty? end |
.get_state(state_id) ⇒ Object
Returns detailed state information
24 25 26 |
# File 'lib/vote_smart/state.rb', line 24 def self.get_state state_id request("State.getState", "stateId" => state_id) end |
.get_state_ids ⇒ Object
Returns a list of states and their 2 digit IDs
19 20 21 |
# File 'lib/vote_smart/state.rb', line 19 def self.get_state_ids request("State.getStateIDs") end |