Class: Google::Civic::RepresentativeInfo

Inherits:
Representation show all
Defined in:
lib/google-civic/representative_info.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Representation

has_many, #initialize

Constructor Details

This class inherits a constructor from Google::Civic::Representation

Class Method Details

.for_address(address, client) ⇒ Object



5
6
7
# File 'lib/google-civic/representative_info.rb', line 5

def self.for_address(address, client)
  representative_info_from_response response(address, client)
end

Instance Method Details

#divisionsObject



9
10
11
12
13
14
# File 'lib/google-civic/representative_info.rb', line 9

def divisions
  @divisions ||= self["divisions"].keys.map do |key|
    division_rep = self["divisions"].fetch(key).merge(id: key)
    Division.new(division_rep, @root_scope)
  end
end

#officesObject



16
17
18
19
20
21
# File 'lib/google-civic/representative_info.rb', line 16

def offices
  @offices ||= self["offices"].keys.map do |key|
    office_rep = self["offices"].fetch(key).merge(id: key)
    Office.new(office_rep, @root_scope)
  end
end