class Google::Civic::RepresentativeInfo

Public Class Methods

for_address(address, client) click to toggle source
# File lib/google-civic/representative_info.rb, line 5
def self.for_address(address, client)
  representative_info_from_response response(address, client)
end

Private Class Methods

representative_info_from_response(response) click to toggle source
# File lib/google-civic/representative_info.rb, line 25
def self.representative_info_from_response(response)
  RepresentativeInfo.new(response.body)
end
response(address, client) click to toggle source
# File lib/google-civic/representative_info.rb, line 29
def self.response(address, client)
  client.request(:representative_info, address: address)
end

Public Instance Methods

divisions() click to toggle source
# 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
offices() click to toggle source
# 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