Sha256: 6138a84ed472af093ebff282e769aa031ecfc503bf7b614025d07fa0e7fa30bf
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
require "fcc_api/version" require 'net/http' require 'uri' require 'rubygems' gem 'activesupport' require 'active_support/all' module FccApi class CensusBlock def initialize @base_uri = "https://geo.fcc.gov/api/census/" end def get_all(lat, lon) request ={ "format" => "json", "latitude" => lat, "longitude" => lon, "showall" => "true" } make_http_call(request, "block/find") end def get(lat, lon) request ={ "format" => "json", "latitude" => lat, "longitude" => lon, "showall" => "false" } make_http_call(request, "block/find") end private def make_http_call(request, endpoint) url = URI.parse( @base_uri + endpoint + "?" + request.to_query ) response = Net::HTTP.get( url ) return JSON.parse(response) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fcc_api-0.2.0 | lib/fcc_api.rb |