Sha256: acda0a71b0a3491df2cb86bcc0f9a57ae40422c4a6300b47db66cd5a1e3999c6
Contents?: true
Size: 570 Bytes
Versions: 1
Compression:
Stored size: 570 Bytes
Contents
require 'net/http' require 'json' module Sunlight module Congress end end class Sunlight::Congress::Legislator attr_accessor :first_name, :last_name, :website def initialize(options) self.first_name = options["first_name"] self.last_name = options["last_name"] self.website = options["website"] end def self.by_zipcode(zipcode) uri = URI("http://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zipcode}&apikey=#{Sunlight::Congress.api_key}") JSON.load(Net::HTTP.get(uri))["results"].collect{|json| new(json) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sunlight-congress-1.1.0 | lib/sunlight/congress/legislator.rb |