Class: CivicInformation::RepresentativesResource::Division
- Inherits:
-
Object
- Object
- CivicInformation::RepresentativesResource::Division
- Defined in:
- lib/civic_information/models/representatives_resource/division.rb
Instance Attribute Summary collapse
-
#also_known_as ⇒ Object
Returns the value of attribute also_known_as.
-
#name ⇒ Object
Returns the value of attribute name.
-
#open_civic_data_id ⇒ Object
Returns the value of attribute open_civic_data_id.
Instance Method Summary collapse
-
#initialize(open_civic_data_id:, division_json:, parent_resource_id:) ⇒ Division
constructor
A new instance of Division.
- #offices ⇒ Object
Constructor Details
#initialize(open_civic_data_id:, division_json:, parent_resource_id:) ⇒ Division
Returns a new instance of Division.
5 6 7 8 9 10 |
# File 'lib/civic_information/models/representatives_resource/division.rb', line 5 def initialize(open_civic_data_id:, division_json:, parent_resource_id:) @parent_resource_id = parent_resource_id @open_civic_data_id = open_civic_data_id @also_known_as = division_json['alsoKnownAs'] || [] @name = division_json['name'] end |
Instance Attribute Details
#also_known_as ⇒ Object
Returns the value of attribute also_known_as.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/division.rb', line 3 def also_known_as @also_known_as end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/division.rb', line 3 def name @name end |
#open_civic_data_id ⇒ Object
Returns the value of attribute open_civic_data_id.
3 4 5 |
# File 'lib/civic_information/models/representatives_resource/division.rb', line 3 def open_civic_data_id @open_civic_data_id end |
Instance Method Details
#offices ⇒ Object
12 13 14 15 16 |
# File 'lib/civic_information/models/representatives_resource/division.rb', line 12 def offices parent_resource.offices.select do |office| office.division_id == open_civic_data_id end end |