Class: GetYourRep::OpenStatesRep
- Defined in:
- lib/get_your_rep/responses/open_states_rep.rb
Overview
Parses rep information from Open States responses.
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
These attributes hold arrays of information, and are empty arrays by default.
-
#phones ⇒ Object
readonly
These attributes hold arrays of information, and are empty arrays by default.
Instance Method Summary collapse
-
#build_hash ⇒ Object
Build a hash from attributes to be passed to the GetYourRep::Representative constructor method.
-
#initialize(options = {}) ⇒ OpenStatesRep
constructor
:nodoc:.
Constructor Details
#initialize(options = {}) ⇒ OpenStatesRep
:nodoc:
10 11 12 13 14 |
# File 'lib/get_your_rep/responses/open_states_rep.rb', line 10 def initialize( = {}) # :nodoc: super @email = [] @phones = [] end |
Instance Attribute Details
#email ⇒ Object (readonly)
These attributes hold arrays of information, and are empty arrays by default.
8 9 10 |
# File 'lib/get_your_rep/responses/open_states_rep.rb', line 8 def email @email end |
#phones ⇒ Object (readonly)
These attributes hold arrays of information, and are empty arrays by default.
8 9 10 |
# File 'lib/get_your_rep/responses/open_states_rep.rb', line 8 def phones @phones end |
Instance Method Details
#build_hash ⇒ Object
Build a hash from attributes to be passed to the GetYourRep::Representative constructor method.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/get_your_rep/responses/open_states_rep.rb', line 17 def build_hash { name: full_name.split(', ').reverse.join(' '), office: office, party: party, phones: phones - [nil], office_locations: office_locations, email: email - [nil], url: url, photo: photo_url, committees: committees } end |