Class: GetYourRep::OpenStatesRep

Inherits:
Base
  • Object
show all
Defined in:
lib/get_your_rep/responses/open_states_rep.rb

Overview

Parses rep information from Open States responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {}) # :nodoc:
  super
  @email  = []
  @phones = []
end

Instance Attribute Details

#emailObject (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

#phonesObject (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_hashObject

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