fcc_reboot 0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -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
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=nested
3
+ --backtrace
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.1
4
+ - 1.9.2
5
+ - jruby
6
+ - ree
7
+ - ruby-head
@@ -0,0 +1,7 @@
1
+ --no-private
2
+ --protected
3
+ --tag format:"Supported formats"
4
+ --tag key:"Requires API key"
5
+ --markup markdown
6
+ -
7
+ LICENSE.md
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gem_template.gemspec
4
4
  gemspec
@@ -4,46 +4,46 @@ A Ruby wrapper for the FCC Reboot APIs.
4
4
 
5
5
  Does your project or organization use this gem?
6
6
  ------------------------------------------
7
- Add it to the [apps](http://github.com/cfalabs/fcc_reboot/wiki/apps) wiki!
7
+ Add it to the [apps](https://github.com/cfalabs/fcc_reboot/wiki/apps) wiki!
8
8
 
9
9
  Installation
10
10
  ------------
11
- $ [sudo] gem install fcc_reboot
11
+ gem install fcc_reboot
12
12
 
13
13
  Usage Examples
14
14
  --------------
15
15
  require 'fcc_reboot'
16
-
16
+
17
17
  # Provide speed test statistics for a US County given the passed Latitude and Longitude
18
18
  FccReboot.broadband_test(:latitude => '38.0', :longitude => '-77.5')
19
-
20
- # Returns a list of the frequency bands
19
+
20
+ # Returns a list of the frequency bands
21
21
  FccReboot.get_spectrum_bands(:frequencyFrom=>'226', :frequencyTo => '900')
22
-
22
+
23
23
  # Provide high level overview of who owns spectrum across the country within the 225 MHz to 3700 MHz frequency
24
24
  FccReboot.get_spectrum_licenses(:name=> 'AT', :radioservice=>'Cellular')
25
-
25
+
26
26
  # Provide census block info for the given latitude and longitude
27
27
  FccReboot.find_census_block(:latitude => '38.0', :longitude => '-77.5')
28
-
28
+
29
29
  # Provide FRN list for the state of Illinois
30
30
  FccReboot.frn_getlist(:stateCode => 'IL', :multi => 'No')
31
-
31
+
32
32
  # Provide FRN info for Cygnus Telecommunications Corporation (FRN number 0017855545)
33
33
  FccReboot.find_census_block(:frn => '0017855545')
34
-
34
+
35
35
  # Returns the number of licenses up for renewal in a given month for Sprint Nextel.
36
36
  FccReboot.get_issued(:commonName=> 'Sprint Nextel')
37
-
37
+
38
38
  # Returns the counts and percent distribution of active licenses by entity type
39
39
  FccReboot.get_renewals()
40
-
40
+
41
41
  # Provide number of licenses that were issued by the Commission on a yearly basis
42
42
  FccReboot.get_licenses(:searchValue => 'Verizon Wireless')
43
-
43
+
44
44
  # Returns the license counts and percent distribution by status.
45
45
  FccReboot.get_statuses(:commonName => 'Sprint Nextel')
46
-
46
+
47
47
  Contributing
48
48
  ------------
49
49
  In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
@@ -57,15 +57,15 @@ Here are some ways *you* can contribute:
57
57
  * by writing specifications
58
58
  * by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
59
59
  * by refactoring code
60
- * by resolving [issues](http://github.com/cfalabs/fcc_reboot/issues)
60
+ * by resolving [issues](https://github.com/cfalabs/fcc_reboot/issues)
61
61
  * by reviewing patches
62
62
 
63
63
  Submitting an Issue
64
64
  -------------------
65
- We use the [GitHub issue tracker](http://github.com/cfalabs/fcc_reboot/issues) to track bugs and
65
+ We use the [GitHub issue tracker](https://github.com/cfalabs/fcc_reboot/issues) to track bugs and
66
66
  features. Before submitting a bug report or feature request, check to make sure it hasn't already
67
67
  been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
68
- bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
68
+ bug report, please include a [Gist](https://gist.github.com/) that includes a stack trace and any
69
69
  details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
70
70
  operating system. Ideally, a bug report should include a pull request with failing specs.
71
71
 
@@ -81,7 +81,35 @@ Submitting a Pull Request
81
81
  8. Commit and push your changes.
82
82
  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.)
83
83
 
84
+ Supported Rubies
85
+ ----------------
86
+ This library aims to support and is [tested
87
+ against](http://travis-ci.org/codeforamerica/fcc_reboot) the following Ruby
88
+ implementations:
89
+
90
+ * Ruby 1.8.7
91
+ * Ruby 1.9.1
92
+ * Ruby 1.9.2
93
+ * Ruby Enterprise Edition 1.8.7
94
+ * JRuby 1.6
95
+
96
+ If something doesn't work on one of these interpreters, it should be considered
97
+ a bug.
98
+
99
+ This library may inadvertently work (or seem to work) on other Ruby
100
+ implementations, however support will only be provided for the versions listed
101
+ above.
102
+
103
+ If you would like this library to support another Ruby version, you may
104
+ volunteer to be a maintainer. Being a maintainer entails making sure all tests
105
+ run and pass on that implementation. When something breaks on your
106
+ implementation, you will be personally responsible for providing patches in a
107
+ timely fashion. If critical issues for a particular implementation exist at the
108
+ time of a major release, support for that Ruby version may be dropped.
109
+
84
110
  Copyright
85
111
  ---------
86
112
  Copyright (c) 2010 Code for America Laboratories
87
- See [LICENSE](https://github.com/cfalabs/fcc_reboot/blob/master/LICENSE.mkd) for details.
113
+ See [LICENSE](https://github.com/cfalabs/fcc_reboot/blob/master/LICENSE.md) for details.
114
+
115
+ [![Code for America Tracker](http://stats.codeforamerica.org/codeforamerica/fcc_reboot.png)](http://stats.codeforamerica.org/projects/fcc_reboot)
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env rake
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/fcc_reboot/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.add_development_dependency 'ZenTest', '~> 4.5'
6
+ gem.add_development_dependency 'maruku', '~> 0.6'
7
+ gem.add_development_dependency 'nokogiri', '~> 1.4'
8
+ gem.add_development_dependency 'rake', '~> 0.9'
9
+ gem.add_development_dependency 'rspec', '~> 2.6'
10
+ gem.add_development_dependency 'simplecov', '~> 0.4'
11
+ gem.add_development_dependency 'webmock', '~> 1.6'
12
+ gem.add_development_dependency 'yard', '~> 0.7'
13
+ gem.add_runtime_dependency 'faraday', '~> 0.7.4'
14
+ gem.add_runtime_dependency 'faraday_middleware', '~> 0.7.0'
15
+ gem.add_runtime_dependency 'hashie', '~> 1.0.0'
16
+ gem.add_runtime_dependency 'multi_json', '~> 1.0.0'
17
+ gem.add_runtime_dependency 'multi_xml', '~> 0.2.0'
18
+ gem.authors = ["Dan Melton", "Javier Muniz"]
19
+ gem.description = %q{Wrapper for FCC API}
20
+ gem.email = 'info@codeforamerica.org'
21
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ gem.files = `git ls-files`.split("\n")
23
+ gem.homepage = 'https://github.com/codeforamerica/fcc_reboot'
24
+ gem.name = 'fcc_reboot'
25
+ gem.require_paths = ['lib']
26
+ gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
27
+ gem.summary = %q{FCC API Wrapper}
28
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ gem.version = FccReboot::VERSION
30
+ end
@@ -1,47 +1,25 @@
1
- require ::File.expand_path('../fcc_reboot/version', __FILE__)
2
- require ::File.expand_path('../fcc_reboot/configuration.rb', __FILE__)
3
- require ::File.expand_path('../fcc_reboot/client', __FILE__)
1
+ require 'fcc_reboot/configuration'
2
+ require 'fcc_reboot/client'
3
+ require 'fcc_reboot/version'
4
4
 
5
5
  module FccReboot
6
6
  extend Configuration
7
-
8
- # Alias for FccReboot::Client.new
9
- #
10
- # @return [FccReboot::Client]
11
- def self.client(options={})
12
- FccReboot::Client.new(options)
13
- end
14
-
15
- # Delegate to FccReboot::Client
16
- def self.method_missing(method, *args, &block)
17
- return super unless client.respond_to?(method)
18
- client.send(method, *args, &block)
7
+ class << self
8
+ # Alias for FccReboot::Client.new
9
+ #
10
+ # @return [FccReboot::Client]
11
+ def new(options={})
12
+ FccReboot::Client.new(options)
13
+ end
14
+
15
+ # Delegate to FccReboot::Client
16
+ def method_missing(method, *args, &block)
17
+ return super unless new.respond_to?(method)
18
+ new.send(method, *args, &block)
19
+ end
20
+
21
+ def respond_to?(method, include_private=false)
22
+ new.respond_to?(method, include_private) || super(method, include_private)
23
+ end
19
24
  end
20
-
21
- # Custom error class for rescuing from all FccReboot errors
22
- class Error < StandardError; end
23
-
24
- # Raised when FccReboot returns a 400 HTTP status code
25
- class BadRequest < Error; end
26
-
27
- # Raised when FccReboot returns a 401 HTTP status code
28
- class Unauthorized < Error; end
29
-
30
- # Raised when FccReboot returns a 403 HTTP status code
31
- class Forbidden < Error; end
32
-
33
- # Raised when FccReboot returns a 404 HTTP status code
34
- class NotFound < Error; end
35
-
36
- # Raised when FccReboot returns a 406 HTTP status code
37
- class NotAcceptable < Error; end
38
-
39
- # Raised when FccReboot returns a 500 HTTP status code
40
- class InternalServerError < Error; end
41
-
42
- # Raised when FccReboot returns a 502 HTTP status code
43
- class BadGateway < Error; end
44
-
45
- # Raised when FccReboot returns a 503 HTTP status code
46
- class ServiceUnavailable < Error; end
47
25
  end
@@ -1,31 +1,35 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'JSON'
3
2
 
4
3
  module FccReboot
5
4
  class Client
6
5
  module Api
6
+ include FccReboot::Client::Connection
7
7
  # speed test statistics for a US County given the passed Latitude and Longitude
8
8
  #
9
9
  # @format :json
10
10
  # @key false
11
11
  # @param options [Hash] A customizable set of options.
12
+ # @param latitude
13
+ # @param longitutde
12
14
  # @return [Array]
13
15
  # @see http://reboot.fcc.gov/developer/consumer-broadband-test-api
14
16
  # @example Provide speed test statistics for a US County given the passed Latitude and Longitude
15
17
  # FccReboot.broadband_test(:latitude => '38.0', :longitude => '-77.5')
16
18
  def broadband_test(options={})
17
- options.merge!({:format => "json"})
19
+ options.merge!({:format => "json"})
18
20
  response = get('speedtest/find', options)
19
- JSON.parse(response)["SpeedTestCounty"]
21
+ response["Errors"] ? response : response["SpeedTestCounty"]
20
22
  end
21
-
22
- # This API returns the US Census Bureau Census Block number (aka the 15 character FIPS Code) given
23
- # a passed Latitude and Longitude. The API also returns the US State and County name associated with
23
+
24
+ # This API returns the US Census Bureau Census Block number (aka the 15 character FIPS Code) given
25
+ # a passed Latitude and Longitude. The API also returns the US State and County name associated with
24
26
  # the Block.
25
27
  #
26
28
  # @format :json
27
29
  # @key false
28
30
  # @param options [Hash] A customizable set of options.
31
+ # @param latitude
32
+ # @param longitutde
29
33
  # @return [Hash]
30
34
  # @see http://reboot.fcc.gov/developer/census-block-conversions-api
31
35
  # @example Provide census block info for the given latitude and longitude
@@ -33,7 +37,6 @@ module FccReboot
33
37
  def find_census_block(options={})
34
38
  options.merge!({:format => "json"})
35
39
  response = get('block/find', options)
36
- JSON.parse(response)
37
40
  end
38
41
 
39
42
  # This API returns returns all the broadband providers in a given state, where those operators
@@ -42,6 +45,8 @@ module FccReboot
42
45
  # @format :json
43
46
  # @key false
44
47
  # @param options [Hash] A customizable set of options.
48
+ # @param stateCode
49
+ # @param multi
45
50
  # @return [Hash]
46
51
  # @see http://reboot.fcc.gov/developer/frn-conversions-api
47
52
  # @example Provide FRN list for the state of Illinois
@@ -50,14 +55,14 @@ module FccReboot
50
55
  options[:multi] = options[:multi] ? "Yes" : "No"
51
56
  options.merge!({:format => "json"})
52
57
  response = get('frn/getList', options)
53
- JSON.parse(response)
54
58
  end
55
-
59
+
56
60
  # This API returns information about a provider by FRN number.
57
61
  #
58
62
  # @format :json
59
63
  # @key false
60
64
  # @param options [Hash] A customizable set of options.
65
+ # @param frn
61
66
  # @return [Hash]
62
67
  # @see http://reboot.fcc.gov/developer/frn-conversions-api
63
68
  # @example Provide FRN info for Cygnus Telecommunications Corporation (FRN number 0017855545)
@@ -65,47 +70,42 @@ module FccReboot
65
70
  def frn_getinfo(options={})
66
71
  options.merge!({:format => "json"})
67
72
  response = get('frn/getInfo', options)
68
- JSON.parse(response)
69
73
  end
70
-
71
- # This API accepts a frequency range and returns a list of the frequency bands
74
+
75
+ # This API accepts a frequency range and returns a list of the frequency bands
72
76
  # along with a high level description of how the band is allocated and for what uses within the 225 MHz and 3700 MHz frequency range.
73
77
  # @format :json
74
78
  # @key false
75
79
  # @param options [Hash] A customizable set of options:
76
- # frequencyFrom (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
77
- # frequencyTo (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
78
- # pageNum (Optional) – Default is 1.
79
- # sortColumn (Optional) – Default is lowerBand. Valid values are: lowerBand, upperBand, or desc.
80
- # sortOrder (Optional) – Default is asc. Valid values are: asc, desc.
81
- # pageSize (Optional) – Default value is 1000.
82
- # limit (Optional) – Default value is 100.
83
- # format (Optional) – Default value is xml. Valid values are: xml, json, jsonp
84
- # jsonCallback (Optional) – Default value is callback.
80
+ # @param frequencyFrom (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
81
+ # @param frequencyTo (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
82
+ # @param pageNum (Optional) – Default is 1.
83
+ # @param sortColumn (Optional) – Default is lowerBand. Valid values are: lowerBand, upperBand, or desc.
84
+ # @param sortOrder (Optional) – Default is asc. Valid values are: asc, desc.
85
+ # @param pageSize (Optional) – Default value is 1000.
86
+ # @param limit (Optional) – Default value is 100.
85
87
  # @return [Array]
86
88
  # @see http://reboot.fcc.gov/developer/spectrum-dashboard-api
87
- # @example Returns a list of the frequency bands
89
+ # @example Returns a list of the frequency bands
88
90
  # FccReboot.get_spectrum_bands(:frequencyFrom=>'226', :frequencyTo => '900')
89
91
  def get_spectrum_bands(options={})
90
- options.merge!({:format => "json"})
91
- response = get('spectrum-view/services/advancedSearch/getSpectrumBands', options)
92
- JSON.parse(response)["SpectrumBands"]["SpectrumBand"]
92
+ options.merge!({:format => "json"})
93
+ response = get('spectrum-view/services/advancedSearch/getSpectrumBands', options)
94
+ response["Errors"] ? response : response["SpectrumBands"]["SpectrumBand"]
93
95
  end
94
-
95
- # This API returns a high level overview of who owns spectrum across the country
96
- # within the 225 MHz to 3700 MHz frequency range in radio services deemed appropriate for
97
- # mobile broadband use.
96
+
97
+ # This API returns a high level overview of who owns spectrum across the country
98
+ # within the 225 MHz to 3700 MHz frequency range in radio services deemed appropriate for
99
+ # mobile broadband use.
98
100
  # @format :json
99
101
  # @key false
100
102
  # @param options [Hash] A customizable set of options:
101
- # frequencyFrom (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
102
- # frequencyTo (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
103
- # pageNum (Optional) – Default is 1.
104
- # sortColumn (Optional) – Default is lowerBand. Valid values are: lowerBand, upperBand, or desc.
105
- # sortOrder (Optional) – Default is asc. Valid values are: asc, desc.
106
- # pageSize (Optional) – Default value is 1000.
107
- # limit (Optional) – Default value is 100.
108
- # format (Optional) – Default value is xml. Valid values are: xml, json, jsonp
103
+ # @param frequencyFrom (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
104
+ # @param frequencyTo (Optional) – If a frequency range is not provided then the API will return all spectrum bands falling within the 225 to 3700 MHz range. Both a lower and upper frequency value must be provided when entering search criteria.
105
+ # @param pageNum (Optional) – Default is 1.
106
+ # @param sortColumn (Optional) – Default is lowerBand. Valid values are: lowerBand, upperBand, or desc.
107
+ # @param sortOrder (Optional) – Default is asc. Valid values are: asc, desc.
108
+ # @param pageSize (Optional) – Default value is 1000.
109
109
  # @return [Array]
110
110
  # @see http://reboot.fcc.gov/developer/spectrum-dashboard-api
111
111
  # @example Provide high level overview of who owns spectrum across the country within the 225 MHz to 3700 MHz frequency
@@ -113,67 +113,67 @@ module FccReboot
113
113
  def get_spectrum_licenses(options={})
114
114
  options.merge!({:format => "json"})
115
115
  response = get('spectrum-view/services/advancedSearch/getLicenses', options)
116
- JSON.parse(response)["Licenses"]["License"]
116
+ response["Errors"] ? response : response["Licenses"]["License"]
117
117
  end
118
-
119
- # his API returns high level license information including name, FRN, call sign,
120
- # category, service, status, expiration date and license id, based on the search criteria passed.
118
+
119
+ # his API returns high level license information including name, FRN, call sign,
120
+ # category, service, status, expiration date and license id, based on the search criteria passed.
121
121
  # @format :json
122
122
  # @key false
123
123
  # @param options [Hash] A customizable set of options:
124
- # searchValue (Required)
125
- # pageNum (Optional) – Default is 1.
126
- # sortColumn (Optional) – Default is licName. Valid values are: licName, frn, callsign, service, status, expdate
127
- # sortOrder (Optional) – Default is asc. Valid values are: asc, desc
128
- # pageSize (Optional) – Default is 100.
124
+ # @param searchValue (Required)
125
+ # @param pageNum (Optional) – Default is 1.
126
+ # @param sortColumn (Optional) – Default is licName. Valid values are: licName, frn, callsign, service, status, expdate
127
+ # @param sortOrder (Optional) – Default is asc. Valid values are: asc, desc
128
+ # @param pageSize (Optional) – Default is 100.
129
129
  # @return [Array]
130
130
  # @see http://reboot.fcc.gov/developer/license-view-api
131
131
  # @example Provide number of licenses that were issued by the Commission on a yearly basis
132
132
  # FccReboot.get_licenses(:searchValue => 'Verizon Wireless')
133
133
  def get_licenses(options={})
134
- options.merge!({:format => "json"})
134
+ options.merge!({:format => "json"})
135
135
  response = get('license-view/basicSearch/getLicenses', options)
136
- JSON.parse(response)["Licenses"]["License"]
136
+ response["Errors"] ? response : response["Licenses"]["License"]
137
137
  end
138
138
 
139
139
  # This API returns a list of currently known licensee names associated with a common name.
140
140
  # @format :json
141
141
  # @key false
142
142
  # @param options [Hash] A customizable set of options:
143
- # commonName (Optional)
144
- # limit (Optional) – Number of request rows
143
+ # @param commonName (Optional)
144
+ # @param limit (Optional) – Number of request rows
145
145
  # @return [Array]
146
146
  # @see http://reboot.fcc.gov/developer/license-view-api
147
147
  # @example Returns a list of currently known licensee names associated with a common name.
148
148
  # FccReboot.get_common_names(:commonName => 'Sprint Nextel')
149
149
  def get_common_names(options={})
150
- options.merge!({:format => "json"})
150
+ options.merge!({:format => "json"})
151
151
  response = get('license-view/licenses/getCommonNames', options)
152
- JSON.parse(response)['Stats']['Stat']
152
+ response["Errors"] ? response : response['Stats']['Stat']
153
153
  end
154
-
154
+
155
155
  # This API returns the license counts and percent distribution by status.
156
156
  # @format :json
157
157
  # @key false
158
158
  # @param options [Hash] A customizable set of options:
159
- # commonName (Optional)
160
- # limit (Optional) – Number of request rows
159
+ # @param commonName (Optional)
160
+ # @param limit (Optional) – Number of request rows
161
161
  # @return [Array]
162
162
  # @see http://reboot.fcc.gov/developer/license-view-api
163
163
  # @example Returns the license counts and percent distribution by status.
164
164
  # FccReboot.get_statuses(:commonName => 'Sprint Nextel')
165
165
  def get_statuses(options={})
166
- options.merge!({:format => "json"})
166
+ options.merge!({:format => "json"})
167
167
  response = get('license-view/licenses/getStatuses', options)
168
- JSON.parse(response)['Stats']['Stat']
168
+ response["Errors"] ? response : response['Stats']['Stat']
169
169
  end
170
170
 
171
- # This API returns the number of licenses that were issued by the Commission on a yearly basis.
172
- #The data returned includes the year and the total number of licenses issued.
171
+ # This API returns the number of licenses that were issued by the Commission on a yearly basis.
172
+ # The data returned includes the year and the total number of licenses issued.
173
173
  # @format :json
174
174
  # @key false
175
175
  # @param options [Hash] A customizable set of options:
176
- # commonName - Name of the coporation
176
+ # @param commonName - Name of the coporation
177
177
  # @return [Array]
178
178
  # @see http://reboot.fcc.gov/developer/license-view-api
179
179
  # @example Provide number of licenses that were issued by the Commission on a yearly basis
@@ -181,53 +181,53 @@ module FccReboot
181
181
  def get_issued(options={})
182
182
  options.merge!({:format => "json"})
183
183
  response = get('license-view/licenses/getIssued', options)
184
- JSON.parse(response)["Stats"]["Stat"]
184
+ response["Errors"] ? response : response["Stats"]["Stat"]
185
185
  end
186
-
186
+
187
187
  # This API returns the number of licenses up for renewal in a given month. The API returns 12 months worth of data.
188
- # @format :json
189
- # @key false
190
- # @param options [Hash] A customizable set of options:
191
- # commonName - Name of the coporation
192
- # @return [Array]
193
- # @see http://reboot.fcc.gov/developer/license-view-api
194
- # @example Returns the number of licenses up for renewal in a given month. The API returns 12 months worth of data for Sprint Nextel.
195
- # FccReboot.get_renewals(:commonName=> 'Sprint Nextel')
196
- def get_renewals(options={})
197
- options.merge!({:format => "json"})
198
- response = get('license-view/licenses/getRenewals', options)
199
- JSON.parse(response)["Stats"]["Stat"]
200
- end
201
-
202
- # This API returns the counts and percent distribution of active licenses by entity type.
203
- # There are four entity categories: Individual, Business, Government and Other.
204
- # @format :json
205
- # @key false
206
- # @param options [Hash] A customizable set of options:
207
- # @return [Array]
208
- # @see http://reboot.fcc.gov/developer/license-view-api
209
- # @example Returns the counts and percent distribution of active licenses by entity type
210
- # FccReboot.get_renewals()
211
- def get_entities(options={})
212
- options.merge!({:format => "json"})
213
- response = get('license-view/licenses/getEntities', options)
214
- JSON.parse(response)["Stats"]["Stat"]
215
- end
216
-
217
- # This API returns the counts and percent distribution of active licenses by category. A license falls into only one category.
218
- # There are four entity categories: Individual, Business, Government and Other.
219
- # @format :json
220
- # @key false
221
- # @param options [Hash] A customizable set of options:
222
- # @return [Array]
223
- # @see http://reboot.fcc.gov/developer/license-view-api
224
- # @example Returns the counts and percent distribution of active licenses by category
225
- # FccReboot.get_categories()
226
- def get_categories(options={})
227
- options.merge!({:format => "json"})
228
- response = get('license-view/licenses/getCategories', options)
229
- JSON.parse(response)["Stats"]["Stat"]
230
- end
188
+ # @format :json
189
+ # @key false
190
+ # @param options [Hash] A customizable set of options:
191
+ # @param commonName - Name of the coporation
192
+ # @return [Array]
193
+ # @see http://reboot.fcc.gov/developer/license-view-api
194
+ # @example Returns the number of licenses up for renewal in a given month. The API returns 12 months worth of data for Sprint Nextel.
195
+ # FccReboot.get_renewals(:commonName=> 'Sprint Nextel')
196
+ def get_renewals(options={})
197
+ options.merge!({:format => "json"})
198
+ response = get('license-view/licenses/getRenewals', options)
199
+ response["Errors"] ? response : response["Stats"]["Stat"]
200
+ end
201
+
202
+ # This API returns the counts and percent distribution of active licenses by entity type.
203
+ # There are four entity categories: Individual, Business, Government and Other.
204
+ # @format :json
205
+ # @key false
206
+ # @param options [Hash] A customizable set of options:
207
+ # @return [Array]
208
+ # @see http://reboot.fcc.gov/developer/license-view-api
209
+ # @example Returns the counts and percent distribution of active licenses by entity type
210
+ # FccReboot.get_renewals()
211
+ def get_entities(options={})
212
+ options.merge!({:format => "json"})
213
+ response = get('license-view/licenses/getEntities', options)
214
+ response["Errors"] ? response : response["Stats"]["Stat"]
215
+ end
216
+
217
+ # This API returns the counts and percent distribution of active licenses by category. A license falls into only one category.
218
+ # There are four entity categories: Individual, Business, Government and Other.
219
+ # @format :json
220
+ # @key false
221
+ # @param options [Hash] A customizable set of options:
222
+ # @return [Array]
223
+ # @see http://reboot.fcc.gov/developer/license-view-api
224
+ # @example Returns the counts and percent distribution of active licenses by category
225
+ # FccReboot.get_categories()
226
+ def get_categories(options={})
227
+ options.merge!({:format => "json"})
228
+ response = get('license-view/licenses/getCategories', options)
229
+ response["Errors"] ? response : response["Stats"]["Stat"]
230
+ end
231
231
  end
232
232
  end
233
233
  end