Class: OpenStates::Legislator

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/openstates/models/legislator.rb

Class Method Summary collapse

Methods included from Model

included, #populate_from_hash!

Class Method Details

.api_methodObject



26
27
28
# File 'lib/openstates/models/legislator.rb', line 26

def api_method
  :legislators
end

.by_location(lat, lon) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/openstates/models/legislator.rb', line 34

def by_location(lat, lon)
  return if !lat || !lon

  response = OpenStates.geo_legislators(lat, lon)

  response.map do |leg_hash|
    from_hash(leg_hash)
  end
end

.id_keyObject



30
31
32
# File 'lib/openstates/models/legislator.rb', line 30

def id_key
  :leg_id
end