Class: CivicInformation::RepresentativesResource::Official
- Inherits:
-
Object
- Object
- CivicInformation::RepresentativesResource::Official
- Defined in:
- lib/civic_information/models/representatives_resource/official.rb
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#name ⇒ Object
Returns the value of attribute name.
-
#party ⇒ Object
Returns the value of attribute party.
-
#phones ⇒ Object
Returns the value of attribute phones.
-
#photo_url ⇒ Object
Returns the value of attribute photo_url.
-
#result_index ⇒ Object
Returns the value of attribute result_index.
-
#urls ⇒ Object
Returns the value of attribute urls.
Instance Method Summary collapse
-
#initialize(result_index:, official_json:, parent_resource_id:) ⇒ Official
constructor
A new instance of Official.
- #offices ⇒ Object
Constructor Details
#initialize(result_index:, official_json:, parent_resource_id:) ⇒ Official
Returns a new instance of Official.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 6 def initialize(result_index:, official_json:, parent_resource_id:) @parent_resource_id = parent_resource_id @result_index = result_index @name = official_json["name"] @photo_url = official_json["photoUrl"] @party = official_json["party"] @phones = official_json["phones"] || [] @emails = official_json["emails"] || [] @urls = official_json["urls"] || [] @channels = build_channels(official_json["channels"] || []) @addresses = build_addresses(official_json["address"] || []) end |
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def addresses @addresses end |
#channels ⇒ Object
Returns the value of attribute channels.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def channels @channels end |
#emails ⇒ Object
Returns the value of attribute emails.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def emails @emails end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def name @name end |
#party ⇒ Object
Returns the value of attribute party.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def party @party end |
#phones ⇒ Object
Returns the value of attribute phones.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def phones @phones end |
#photo_url ⇒ Object
Returns the value of attribute photo_url.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def photo_url @photo_url end |
#result_index ⇒ Object
Returns the value of attribute result_index.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def result_index @result_index end |
#urls ⇒ Object
Returns the value of attribute urls.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 3 def urls @urls end |
Instance Method Details
#offices ⇒ Object
19 20 21 22 23 |
# File 'lib/civic_information/models/representatives_resource/official.rb', line 19 def offices parent_resource.offices.select do |office| office.official_indices.include? result_index end end |