class Sunlight::Congress::District
Attributes
district[RW]
state[RW]
Public Class Methods
locate(options)
click to toggle source
# File lib/sunlight/congress/district.rb, line 14 def locate(options) if options.is_a?(String) || options[:address] coords = Geocoder.coordinates(options) response = Net::HTTP.get_response(locate_uri(latitude: coords[0], longitude: coords[1])) else response = Net::HTTP.get_response(locate_uri(options)) end create_from_response(response) end
locate_uri(options = {})
click to toggle source
# File lib/sunlight/congress/district.rb, line 25 def locate_uri(options = {}) encode_uri('legislators/locate', options) end
new(options = {})
click to toggle source
# File lib/sunlight/congress/district.rb, line 7 def initialize(options = {}) options.each do |attribute, value| instance_variable_set("@#{attribute}", value) end end