broadband_map 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/.gemtest +0 -0
- data/.gitignore +41 -0
- data/.rspec +3 -0
- data/.yardopts +3 -0
- data/Gemfile +4 -0
- data/LICENSE.md +10 -0
- data/README.md +66 -0
- data/Rakefile +18 -0
- data/broadband_map.gemspec +32 -0
- data/lib/broadband_map.rb +19 -0
- data/lib/broadband_map/client.rb +32 -0
- data/lib/broadband_map/client/almanac.rb +74 -0
- data/lib/broadband_map/client/bip.rb +50 -0
- data/lib/broadband_map/client/btop.rb +50 -0
- data/lib/broadband_map/client/cai.rb +65 -0
- data/lib/broadband_map/client/census.rb +46 -0
- data/lib/broadband_map/client/connection.rb +19 -0
- data/lib/broadband_map/client/demographics.rb +65 -0
- data/lib/broadband_map/client/geography.rb +72 -0
- data/lib/broadband_map/client/provider.rb +34 -0
- data/lib/broadband_map/client/request.rb +18 -0
- data/lib/broadband_map/client/speed_test.rb +65 -0
- data/lib/broadband_map/client/summary.rb +38 -0
- data/lib/broadband_map/client/wire.rb +33 -0
- data/lib/broadband_map/version.rb +3 -0
- data/spec/broadband_map/almanac_spec.rb +74 -0
- data/spec/broadband_map/bip_spec.rb +47 -0
- data/spec/broadband_map/btop_spec.rb +47 -0
- data/spec/broadband_map/cai_spec.rb +62 -0
- data/spec/broadband_map/census_spec.rb +48 -0
- data/spec/broadband_map/demographics_spec.rb +61 -0
- data/spec/broadband_map/geography_spec.rb +74 -0
- data/spec/broadband_map/providers_spec.rb +34 -0
- data/spec/broadband_map/speed_test_spec.rb +61 -0
- data/spec/broadband_map/summary_spec.rb +36 -0
- data/spec/broadband_map/wire_spec.rb +35 -0
- data/spec/broadband_map_spec.rb +10 -0
- data/spec/fixtures/almanac_parameters.json +1 -0
- data/spec/fixtures/almanac_rank_geo_type_nation.json +1 -0
- data/spec/fixtures/almanac_rank_geo_type_state.json +1 -0
- data/spec/fixtures/almanac_rank_geography_id_nation.json +1 -0
- data/spec/fixtures/almanac_rank_geography_id_state.json +1 -0
- data/spec/fixtures/bip_nation.json +1 -0
- data/spec/fixtures/bip_state_id.json +1 -0
- data/spec/fixtures/bip_state_name.json +1 -0
- data/spec/fixtures/btop_nation.json +1 -0
- data/spec/fixtures/btop_state_id.json +1 -0
- data/spec/fixtures/btop_state_name.json +1 -0
- data/spec/fixtures/cai_closest.json +1 -0
- data/spec/fixtures/cai_geo_id.json +1 -0
- data/spec/fixtures/cai_geo_name.json +1 -0
- data/spec/fixtures/cai_nation.json +1 -0
- data/spec/fixtures/census_coords.json +1 -0
- data/spec/fixtures/census_fips.json +1 -0
- data/spec/fixtures/census_geo_name.json +1 -0
- data/spec/fixtures/demo_coords.json +1 -0
- data/spec/fixtures/demo_geo_id.json +1 -0
- data/spec/fixtures/demo_geo_name.json +1 -0
- data/spec/fixtures/demo_nation.json +1 -0
- data/spec/fixtures/geo_id.json +1 -0
- data/spec/fixtures/geo_type.json +1 -0
- data/spec/fixtures/geo_type_name.json +1 -0
- data/spec/fixtures/geo_type_state.json +1 -0
- data/spec/fixtures/geo_type_state_name.json +1 -0
- data/spec/fixtures/providers_all.json +1 -0
- data/spec/fixtures/providers_name.json +1 -0
- data/spec/fixtures/speed_geo_type_id.json +1 -0
- data/spec/fixtures/speed_geo_type_name.json +1 -0
- data/spec/fixtures/speed_nation.json +1 -0
- data/spec/fixtures/speed_quartile_type.json +1 -0
- data/spec/fixtures/summary_geo.json +1 -0
- data/spec/fixtures/summary_nation.json +1 -0
- data/spec/fixtures/wireless.json +1 -0
- data/spec/fixtures/wireline.json +1 -0
- data/spec/helper.rb +48 -0
- metadata +302 -0
data/.autotest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'autotest/bundler'
|
data/.gemtest
ADDED
File without changes
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
!.gitignore
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
*.sw[a-p]
|
5
|
+
*.tmproj
|
6
|
+
*.tmproject
|
7
|
+
*.un~
|
8
|
+
*~
|
9
|
+
.DS_Store
|
10
|
+
.Spotlight-V100
|
11
|
+
.Trashes
|
12
|
+
._*
|
13
|
+
.bundle
|
14
|
+
.config
|
15
|
+
.directory
|
16
|
+
.elc
|
17
|
+
.redcar
|
18
|
+
.yardoc
|
19
|
+
/.emacs.desktop
|
20
|
+
/.emacs.desktop.lock
|
21
|
+
Desktop.ini
|
22
|
+
Gemfile.lock
|
23
|
+
Icon?
|
24
|
+
InstalledFiles
|
25
|
+
Session.vim
|
26
|
+
Thumbs.db
|
27
|
+
\#*\#
|
28
|
+
_yardoc
|
29
|
+
auto-save-list
|
30
|
+
coverage
|
31
|
+
doc/
|
32
|
+
lib/bundler/man
|
33
|
+
pkg
|
34
|
+
pkg/*
|
35
|
+
rdoc
|
36
|
+
spec/reports
|
37
|
+
test/tmp
|
38
|
+
test/version_tmp
|
39
|
+
tmp
|
40
|
+
tmtags
|
41
|
+
tramp
|
data/.rspec
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Copyright (c) 2011, Code for America
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
* Neither the name of Code for America nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
9
|
+
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
Broadband Map
|
2
|
+
=======
|
3
|
+
A Ruby wrapper for the [Broadband Map APIs](http://broadbandmap.gov/developer).
|
4
|
+
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
gem install broadband_map
|
9
|
+
|
10
|
+
Usage Examples
|
11
|
+
--------------
|
12
|
+
|
13
|
+
require 'broadband_map'
|
14
|
+
|
15
|
+
# Provide all the wireless providers within a US census block given a passed latitude and longitude.
|
16
|
+
BroadbandMap.wireless(:data_version => 'fall2010', :latitude => '38.0', :longitude => '-77.5')
|
17
|
+
|
18
|
+
# Provide all the wireline providers within a US census block given a passed latitude and longitude.
|
19
|
+
BroadbandMap.wireline(:data_version => 'fall2010', :latitude => '38.0', :longitude => '-77.5')
|
20
|
+
|
21
|
+
# Returns rankings within nation by specific geo id
|
22
|
+
BroadbandMap.almanac_ranking_geo_id_within_nation({:data_version => 'fall2010', :census_metric_type => 'population', :ranking_metric => 'wirelineproviderequals0', :geography_type => 'county', :geography_id => '01101', :sort_order => 'asc'})
|
23
|
+
|
24
|
+
Contributing
|
25
|
+
------------
|
26
|
+
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
27
|
+
|
28
|
+
Here are some ways *you* can contribute:
|
29
|
+
|
30
|
+
* by using alpha, beta, and prerelease versions
|
31
|
+
* by reporting bugs
|
32
|
+
* by suggesting new features
|
33
|
+
* by writing or editing documentation
|
34
|
+
* by writing specifications
|
35
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
|
36
|
+
* by refactoring code
|
37
|
+
* by resolving [issues](https://github.com/codeforamerica/broadband_map_ruby/issues)
|
38
|
+
* by reviewing patches
|
39
|
+
|
40
|
+
Submitting an Issue
|
41
|
+
-------------------
|
42
|
+
We use the [GitHub issue tracker](https://github.com/codeforamerica/broadband_map_ruby/issues) to track bugs and
|
43
|
+
features. Before submitting a bug report or feature request, check to make sure it hasn't already
|
44
|
+
been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
|
45
|
+
bug report, please include a [Gist](https://gist.github.com/) that includes a stack trace and any
|
46
|
+
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
|
47
|
+
operating system. Ideally, a bug report should include a pull request with failing specs.
|
48
|
+
|
49
|
+
Submitting a Pull Request
|
50
|
+
-------------------------
|
51
|
+
1. Fork the project.
|
52
|
+
2. Create a topic branch.
|
53
|
+
3. Implement your feature or bug fix.
|
54
|
+
4. Add documentation for your feature or bug fix.
|
55
|
+
5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
56
|
+
6. Add specs for your feature or bug fix.
|
57
|
+
7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
|
58
|
+
8. Commit and push your changes.
|
59
|
+
9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
60
|
+
|
61
|
+
Copyright
|
62
|
+
---------
|
63
|
+
Copyright (c) 2010 Code for America Laboratories
|
64
|
+
See [LICENSE](https://github.com/codeforamerica/broadband_map_ruby/blob/master/LICENSE.md) for details.
|
65
|
+
|
66
|
+
[![Code for America Tracker](http://stats.codeforamerica.org/codeforamerica/broadband_map_ruby.png)](http://stats.codeforamerica.org/projects/broadband_map_ruby)
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
task :default => :spec
|
10
|
+
task :test => :spec
|
11
|
+
|
12
|
+
require 'yard'
|
13
|
+
namespace :doc do
|
14
|
+
YARD::Rake::YardocTask.new do |task|
|
15
|
+
task.files = ['LICENSE.md', 'lib/**/*.rb']
|
16
|
+
task.options = ['--markup', 'markdown']
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/broadband_map/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'broadband_map'
|
6
|
+
gem.version = BroadbandMap::VERSION
|
7
|
+
gem.author = "blakeshall"
|
8
|
+
gem.email = 'blake@codeforamerica.org'
|
9
|
+
gem.homepage = ''
|
10
|
+
gem.summary = %q{Ruby wrapper for Broadbandmap.gov api}
|
11
|
+
gem.description = %q{Ruby wrapper for Broadbandmap.gov api}
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
16
|
+
gem.require_paths = ['lib']
|
17
|
+
|
18
|
+
gem.add_development_dependency 'ZenTest', '~> 4.5'
|
19
|
+
gem.add_development_dependency 'maruku', '~> 0.6'
|
20
|
+
gem.add_development_dependency 'rake', '~> 0.9'
|
21
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
22
|
+
gem.add_development_dependency 'simplecov', '~> 0.4'
|
23
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
24
|
+
gem.add_development_dependency 'webmock', '~> 1.6'
|
25
|
+
|
26
|
+
gem.add_runtime_dependency 'faraday', '~> 0.6.1'
|
27
|
+
gem.add_runtime_dependency 'faraday_middleware', '~> 0.6.3'
|
28
|
+
gem.add_runtime_dependency 'hashie', '~> 1.0.0'
|
29
|
+
gem.add_runtime_dependency 'multi_json', '~> 1.0.2'
|
30
|
+
gem.add_runtime_dependency 'rash', '~> 0.3.0'
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'broadband_map/client'
|
2
|
+
|
3
|
+
module BroadbandMap
|
4
|
+
|
5
|
+
def self.client(options={})
|
6
|
+
BroadbandMap::Client.new(options)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Delegate to BroadbandMap::Client.new
|
10
|
+
def self.method_missing(method, *args, &block)
|
11
|
+
return super unless client.respond_to?(method)
|
12
|
+
client.send(method, *args, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.respond_to?(method, include_private=false)
|
16
|
+
client.respond_to?(method, include_private) || super(method, include_private)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'broadband_map/client'
|
2
|
+
require 'broadband_map/client/connection'
|
3
|
+
require 'broadband_map/client/request'
|
4
|
+
require 'broadband_map/client/almanac'
|
5
|
+
require 'broadband_map/client/bip'
|
6
|
+
require 'broadband_map/client/btop'
|
7
|
+
require 'broadband_map/client/provider'
|
8
|
+
require 'broadband_map/client/summary'
|
9
|
+
require 'broadband_map/client/census'
|
10
|
+
require 'broadband_map/client/cai'
|
11
|
+
require 'broadband_map/client/demographics'
|
12
|
+
require 'broadband_map/client/geography'
|
13
|
+
require 'broadband_map/client/speed_test'
|
14
|
+
require 'broadband_map/client/wire'
|
15
|
+
|
16
|
+
module BroadbandMap
|
17
|
+
class Client
|
18
|
+
include BroadbandMap::Client::Connection
|
19
|
+
include BroadbandMap::Client::Request
|
20
|
+
include BroadbandMap::Client::Bip
|
21
|
+
include BroadbandMap::Client::Btop
|
22
|
+
include BroadbandMap::Client::Almanac
|
23
|
+
include BroadbandMap::Client::Provider
|
24
|
+
include BroadbandMap::Client::Summary
|
25
|
+
include BroadbandMap::Client::Census
|
26
|
+
include BroadbandMap::Client::Cai
|
27
|
+
include BroadbandMap::Client::Demographics
|
28
|
+
include BroadbandMap::Client::Geography
|
29
|
+
include BroadbandMap::Client::SpeedTest
|
30
|
+
include BroadbandMap::Client::Wire
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module BroadbandMap
|
2
|
+
class Client
|
3
|
+
module Almanac
|
4
|
+
|
5
|
+
# Returns all almanac parameters used by the Almanac API for ranking.
|
6
|
+
#
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @return {Hash}
|
9
|
+
# @see http://www.broadbandmap.gov/developer/api/almanac-api-parameters
|
10
|
+
# @example
|
11
|
+
# almanac_parameters()
|
12
|
+
def almanac_parameters(params={}, options={})
|
13
|
+
params = {:format => 'json'}.merge(params)
|
14
|
+
get("almanac/parameters?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns the rankings within a state by specific geo id
|
18
|
+
#
|
19
|
+
# @param params [Hash] The parameters for the lookup
|
20
|
+
# @param options [Hash] A customizable set of options.
|
21
|
+
# @return {Hash}
|
22
|
+
# @see http://www.broadbandmap.gov/developer/api/almanac-api-ranking-by-geography-id-within-a-state
|
23
|
+
# @example
|
24
|
+
# almanac_ranking_geo_id_within_state({:data_version => 'fall2010', :state_id => '01', :census_metric_type => 'population', :ranking_metric => 'wirelineproviderequals0', :geography_type => 'county', :geography_id => '01101', :sort_order => 'asc'})
|
25
|
+
|
26
|
+
def almanac_ranking_geo_id_within_state(params={}, options={})
|
27
|
+
params = {:format => 'json'}.merge(params)
|
28
|
+
get("almanac/#{params[:data_version]}/rankby/state/#{params[:state_id]}/#{params[:census_metric_type]}/#{params[:ranking_metric]}/#{params[:geography_type]}/id/#{params[:geography_id]}?format=#{params[:format]}&order=#{params[:sort_order]}&properties=#{params[:properties]}&callback=#{params[:callback]}", options)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns rankings within nation by specific geo id
|
32
|
+
#
|
33
|
+
# @param params [Hash] The parameters for the lookup
|
34
|
+
# @param options [Hash] A customizable set of options.
|
35
|
+
# @return {Hash}
|
36
|
+
# @see http://www.broadbandmap.gov/developer/api/almanac-api-ranking-by-geography-id-within-the-nation
|
37
|
+
# @example
|
38
|
+
# almanac_ranking_geo_id_within_nation({:data_version => 'fall2010', :census_metric_type => 'population', :ranking_metric => 'wirelineproviderequals0', :geography_type => 'county', :geography_id => '01101', :sort_order => 'asc'})
|
39
|
+
|
40
|
+
def almanac_ranking_geo_id_within_nation(params={}, options={})
|
41
|
+
params = {:format => 'json'}.merge(params)
|
42
|
+
get("almanac/#{params[:data_version]}/rankby/nation/#{params[:census_metric_type]}/#{params[:ranking_metric]}/#{params[:geography_type]}/id/#{params[:geography_id]}?format=#{params[:format]}&order=#{params[:sort_order]}&properties=#{params[:properties]}&callback=#{params[:callback]}", options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns rankings within a state by geo type
|
46
|
+
#
|
47
|
+
# @param params [Hash] The parameters for the lookup
|
48
|
+
# @param options [Hash] A customizable set of options.
|
49
|
+
# @return {Hash}
|
50
|
+
# @see http://www.broadbandmap.gov/developer/api/almanac-api-ranking-by-geography-type-within-a-state
|
51
|
+
# @example
|
52
|
+
# almanac_ranking_geo_type_within_state({:data_version => 'fall2010', :state_id => '01', :census_metric_type => 'population', :ranking_metric => 'wirelineproviderequals0', :geography_type => 'county', :sort_order => 'asc'})
|
53
|
+
|
54
|
+
def almanac_ranking_geo_type_within_state(params={}, options={})
|
55
|
+
params = {:format => 'json'}.merge(params)
|
56
|
+
get("almanac/#{params[:data_version]}/rankby/state/#{params[:state_id]}/#{params[:census_metric_type]}/#{params[:ranking_metric]}/#{params[:geography_type]}?format=#{params[:format]}&order=#{params[:sort_order]}&properties=#{params[:properties]}&callback=#{params[:callback]}")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns rankings within a state by geo type
|
60
|
+
#
|
61
|
+
# @param params [Hash] The parameters for the lookup
|
62
|
+
# @param options [Hash] A customizable set of options.
|
63
|
+
# @return {Hash}
|
64
|
+
# @see http://www.broadbandmap.gov/developer/api/almanac-api-ranking-by-geography-type-within-a-state
|
65
|
+
# @example
|
66
|
+
# almanac_ranking_geo_type_within_nation({:data_version => 'fall2010', :census_metric_type => 'population', :ranking_metric => 'wirelineproviderequals0', :geography_type => 'county', :sort_order => 'asc'})
|
67
|
+
|
68
|
+
def almanac_ranking_geo_type_within_nation(params={}, options={})
|
69
|
+
params = {:format => 'json'}.merge(params)
|
70
|
+
get("almanac/#{params[:data_version]}/rankby/nation/#{params[:census_metric_type]}/#{params[:ranking_metric]}/#{params[:geography_type]}?format=#{params[:format]}&order=#{params[:sort_order]}&properties=#{params[:properties]}&callback=#{params[:callback]}", options)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module BroadbandMap
|
2
|
+
class Client
|
3
|
+
module Bip
|
4
|
+
|
5
|
+
# Returns the BIP funding allocated to states by specifying the state fips code
|
6
|
+
# @param params [Hash] The parameters for the lookup
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @return {Hash}
|
9
|
+
# @see http://www.broadbandmap.gov/developer/api/bip-funding-api-by-state-id
|
10
|
+
# @example
|
11
|
+
# bip_state_id({:state_ids => ["01", "02"]})
|
12
|
+
def bip_state_id(params={}, options={})
|
13
|
+
params = {:format => 'json'}.merge(params)
|
14
|
+
ids = ""
|
15
|
+
params[:state_ids].each {|x| ids += x +","}
|
16
|
+
ids.chop!
|
17
|
+
get("bip/stateids/#{ids}?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the BIP funding allocated to states by specifying the state name
|
21
|
+
# @param params [Hash] The parameters for the lookup
|
22
|
+
# @param options [Hash] A customizable set of options.
|
23
|
+
# @return {Hash}
|
24
|
+
# @see http://www.broadbandmap.gov/developer/api/bip-funding-api-by-state-name
|
25
|
+
# @example
|
26
|
+
# bip_state_id({:state_names => ['alaska', 'alabama']})
|
27
|
+
|
28
|
+
def bip_state_name(params={}, options={})
|
29
|
+
params = {:format => 'json'}.merge(params)
|
30
|
+
names = ""
|
31
|
+
params[:state_names].each {|x| names += x +","}
|
32
|
+
names.chop!
|
33
|
+
get("bip/states/#{names}?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the BIP funding allocation for the whole nation
|
37
|
+
# @param params [Hash] The parameters for the lookup
|
38
|
+
# @param options [Hash] A customizable set of options.
|
39
|
+
# @return {Hash}
|
40
|
+
# @see http://www.broadbandmap.gov/developer/api/bip-funding-api-nation
|
41
|
+
# @example
|
42
|
+
# bip_nation()
|
43
|
+
|
44
|
+
def bip_nation(params={}, options={})
|
45
|
+
params = {:format => 'json'}.merge(params)
|
46
|
+
get("bip/nation?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module BroadbandMap
|
2
|
+
class Client
|
3
|
+
module Btop
|
4
|
+
|
5
|
+
# Returns the BIP funding allocated to states by specifying the state fips code
|
6
|
+
# @param params [Hash] The parameters for the lookup
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @return {Hash}
|
9
|
+
# @see http://www.broadbandmap.gov/developer/api/btop-funding-api-by-state-id
|
10
|
+
# @example
|
11
|
+
# btop_state_id({:state_ids => ["01", "02"]})
|
12
|
+
def btop_state_id(params={}, options={})
|
13
|
+
params = {:format => 'json'}.merge(params)
|
14
|
+
ids = ""
|
15
|
+
params[:state_ids].each {|x| ids += x +","}
|
16
|
+
ids.chop!
|
17
|
+
get("btop/stateids/#{ids}?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the BIP funding allocated to states by specifying the state name
|
21
|
+
# @param params [Hash] The parameters for the lookup
|
22
|
+
# @param options [Hash] A customizable set of options.
|
23
|
+
# @return {Hash}
|
24
|
+
# @see http://www.broadbandmap.gov/developer/api/btop-funding-api-by-state-name
|
25
|
+
# @example
|
26
|
+
# btop_state_id({:state_names => ['alaska', 'alabama']})
|
27
|
+
|
28
|
+
def btop_state_name(params={}, options={})
|
29
|
+
params = {:format => 'json'}.merge(params)
|
30
|
+
names = ""
|
31
|
+
params[:state_names].each {|x| names += x +","}
|
32
|
+
names.chop!
|
33
|
+
get("btop/states/#{names}?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the BIP funding allocation for the whole nation
|
37
|
+
# @param params [Hash] The parameters for the lookup
|
38
|
+
# @param options [Hash] A customizable set of options.
|
39
|
+
# @return {Hash}
|
40
|
+
# @see http://www.broadbandmap.gov/developer/api/btop-funding-api-nation
|
41
|
+
# @example
|
42
|
+
# btop_nation()
|
43
|
+
|
44
|
+
def btop_nation(params={}, options={})
|
45
|
+
params = {:format => 'json'}.merge(params)
|
46
|
+
get("btop/nation?format=#{params[:format]}&callback=#{params[:callback]}", options)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module BroadbandMap
|
2
|
+
class Client
|
3
|
+
module Cai
|
4
|
+
|
5
|
+
# Returns the closest community anchor institutions by latitude and longitude
|
6
|
+
# @param params [Hash] :latitude and :longitude and optional :max_results, :format, :callback
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @return {Hash}
|
9
|
+
# @see http://www.broadbandmap.gov/developer/api/community-anchor-institutions-closest-by-latitude-and-longitude
|
10
|
+
# @example
|
11
|
+
# cai_closest({:latitude => 41.486857, :longitude => -71.294392, :max_results=> 2})
|
12
|
+
|
13
|
+
def cai_closest(params={}, options={})
|
14
|
+
params = {:format => 'json', :max_results => 25}.merge(params)
|
15
|
+
get("cai/closest?latitude=#{params[:latitude]}&longitude=#{params[:longitude]}&maxresults=#{params[:max_results]}&format=#{params[:format]}&callback=#{params[:callback]}")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the broadband availability among the Community Anchor Institutions by geography type and ID.
|
19
|
+
# @param params [Hash] :data_version, :geography_type and optional :format, :callback
|
20
|
+
# @param options [Hash] A customizable set of options.
|
21
|
+
# @return {Hash}
|
22
|
+
# @see http://www.broadbandmap.gov/developer/api/community-anchor-institutions-api-by-geography-type-and-geography-id
|
23
|
+
# @example
|
24
|
+
# cai_geo_id({:data_version => 'fall2010', :geography_type => 'state', :geography_ids => ['01','02']})
|
25
|
+
|
26
|
+
def cai_geo_id(params={}, options={})
|
27
|
+
params = {:format => 'json'}.merge(params)
|
28
|
+
ids = ""
|
29
|
+
params[:geography_ids].each {|x| ids += x +","}
|
30
|
+
ids.chop!
|
31
|
+
get("cai/#{params[:data_version]}/#{params[:geography_type]}/ids/#{ids}?format=#{params[:format]}&callback=#{params[:callback]}")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the broadband availability among the Community Anchor Institutions by geography name and type.
|
35
|
+
# @param params [Hash] :data_version, :geography_type, :geography_names and optional :format, :callback
|
36
|
+
# @param options [Hash] A customizable set of options.
|
37
|
+
# @return {Hash}
|
38
|
+
# @see http://www.broadbandmap.gov/developer/api/community-anchor-institutions-api-by-geography-type-and-geography-name
|
39
|
+
# @example
|
40
|
+
# cai_geo_name({:data_version => 'fall2010', :geography_type => 'state', :geography_names => ['alabama', 'arizona']})
|
41
|
+
|
42
|
+
def cai_geo_name(params={}, options={})
|
43
|
+
params = {:format => 'json'}.merge(params)
|
44
|
+
names = ""
|
45
|
+
params[:geography_names].each {|x| names += x +","}
|
46
|
+
names.chop!
|
47
|
+
get("cai/#{params[:data_version]}/#{params[:geography_type]}/names/#{names}?format=#{params[:format]}&callback=#{params[:callback]}")
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the broadband availability among the Community Anchor Institutions for the entire United States.
|
51
|
+
# @param params [Hash] :data_version and optional :format, :callback
|
52
|
+
# @param options [Hash] A customizable set of options.
|
53
|
+
# @return {Hash}
|
54
|
+
# @see http://www.broadbandmap.gov/developer/api/community-anchor-institutions-api-nation
|
55
|
+
# @example
|
56
|
+
# cai_nation({:data_version => 'fall2010'})
|
57
|
+
|
58
|
+
def cai_nation(params={}, options={})
|
59
|
+
params = {:format => 'json'}.merge(params)
|
60
|
+
get("cai/#{params[:data_version]}/nation?format=#{params[:format]}&callback=#{params[:callback]}")
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|