Sha256: b94a04108df6ec4a4707aa5f2a756d7be5360afcf3448c6c82621533d7a0da19
Contents?: true
Size: 468 Bytes
Versions: 1
Compression:
Stored size: 468 Bytes
Contents
require 'net/http' require 'json' module Sunlight module Congress end end class Sunlight::Congress::Legislator attr_accessor :first_name def initialize(options) self.first_name = options["first_name"] 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-0.0.1 | lib/sunlight/congress/legislator.rb |