fcc_reboot 0.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.gitignore +41 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/.yardopts +7 -0
- data/Gemfile +1 -1
- data/{README.mkd → README.md} +46 -18
- data/Rakefile +2 -0
- data/fcc_reboot.gemspec +30 -0
- data/lib/fcc_reboot.rb +20 -42
- data/lib/fcc_reboot/client/api.rb +105 -105
- data/lib/fcc_reboot/client/request.rb +2 -5
- data/lib/fcc_reboot/configuration.rb +1 -1
- data/lib/fcc_reboot/version.rb +1 -1
- data/spec/api.rb +35 -7
- data/spec/api_spec.rb +321 -0
- data/spec/faraday/response_spec.rb +29 -0
- data/spec/fixtures/error110.json +1 -0
- data/spec/fixtures/license-view-get-licenses-error.json +1 -0
- data/spec/helper.rb +4 -8
- metadata +125 -133
- data/fcc_ruby_gem.gemspec +0 -38
@@ -23,18 +23,15 @@ module FccReboot
|
|
23
23
|
response = connection(raw).send(method) do |request|
|
24
24
|
case method
|
25
25
|
when :get, :delete
|
26
|
-
request.url(
|
26
|
+
request.url(path, options)
|
27
27
|
when :post, :put
|
28
|
-
request.path =
|
28
|
+
request.path = path
|
29
29
|
request.body = options unless options.empty?
|
30
30
|
end
|
31
31
|
end
|
32
32
|
raw ? response : response.body
|
33
33
|
end
|
34
34
|
|
35
|
-
def formatted_path(path)
|
36
|
-
[path, format].compact.join('.')
|
37
|
-
end
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|
@@ -16,7 +16,7 @@ module FccReboot
|
|
16
16
|
DEFAULT_ADAPTER = Faraday.default_adapter
|
17
17
|
DEFAULT_ENDPOINT = nil
|
18
18
|
DEFAULT_PROXY = nil
|
19
|
-
DEFAULT_FORMAT =
|
19
|
+
DEFAULT_FORMAT = :json
|
20
20
|
DEFAULT_USER_AGENT = "FccReboot Ruby Gem #{FccReboot::VERSION}".freeze
|
21
21
|
|
22
22
|
attr_accessor *VALID_OPTIONS_KEYS
|
data/lib/fcc_reboot/version.rb
CHANGED
data/spec/api.rb
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
+
describe FccReboot do
|
4
|
+
after do
|
5
|
+
FccReboot.reset
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".respond_to?" do
|
9
|
+
it "should return true if method exists" do
|
10
|
+
FccReboot.respond_to?(:client, true).should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".client" do
|
15
|
+
it "should be a FccReboot::Client" do
|
16
|
+
FccReboot.client.should be_a FccReboot::Client
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
3
21
|
describe FccReboot, ".broadband_test" do
|
4
22
|
before do
|
5
23
|
stub_request(:get, 'http://data.fcc.gov/api/speedtest/find').
|
@@ -59,7 +77,7 @@ describe FccReboot, ".frn_getlist" do
|
|
59
77
|
with(:query => {:format => 'json', :stateCode => 'IL', :multi => 'Yes'}).
|
60
78
|
should have_been_made
|
61
79
|
end
|
62
|
-
|
80
|
+
|
63
81
|
it "should request the correct resource" do
|
64
82
|
FccReboot.frn_getlist(:stateCode => 'IL', :multi => false)
|
65
83
|
a_request(:get, 'http://data.fcc.gov/api/frn/getList').
|
@@ -69,8 +87,8 @@ describe FccReboot, ".frn_getlist" do
|
|
69
87
|
|
70
88
|
it "should return the correct results" do
|
71
89
|
services = FccReboot.frn_getlist(:stateCode => 'IL', :multi => false)
|
72
|
-
services.should be_a
|
73
|
-
services
|
90
|
+
services.should be_a Array
|
91
|
+
services.first["frn"].should == '0017855545'
|
74
92
|
end
|
75
93
|
end
|
76
94
|
|
@@ -87,11 +105,11 @@ describe FccReboot, ".frn_getinfo" do
|
|
87
105
|
with(:query => {:format => 'json', :frn => '0017855545'}).
|
88
106
|
should have_been_made
|
89
107
|
end
|
90
|
-
|
108
|
+
|
91
109
|
it "should return the correct results" do
|
92
110
|
services = FccReboot.frn_getinfo(:frn => '0017855545')
|
93
111
|
services.should be_a Hash
|
94
|
-
services["
|
112
|
+
services["frn"].should == '0017855545'
|
95
113
|
end
|
96
114
|
end
|
97
115
|
|
@@ -140,9 +158,13 @@ end
|
|
140
158
|
describe FccReboot, ".get_licenses" do
|
141
159
|
before do
|
142
160
|
@query = {:searchValue => 'Verizon%20Wireless', :format =>'json'}
|
161
|
+
@bad_query = {:searchValue => 'some name', :format =>'json'}
|
143
162
|
stub_request(:get, 'http://data.fcc.gov/api/license-view/basicSearch/getLicenses').
|
144
163
|
with(:query => @query).
|
145
164
|
to_return(:body => fixture('license-view-get-licenses.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
165
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/basicSearch/getLicenses').
|
166
|
+
with(:query => @bad_query).
|
167
|
+
to_return(:body => fixture('license-view-get-licenses-error.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
146
168
|
end
|
147
169
|
|
148
170
|
it "should request the correct resource" do
|
@@ -157,11 +179,17 @@ describe FccReboot, ".get_licenses" do
|
|
157
179
|
licenses.should be_a Array
|
158
180
|
licenses[0]["licenseID"].should == '2300007967'
|
159
181
|
end
|
182
|
+
|
183
|
+
it "should return the correct results" do
|
184
|
+
licenses = FccReboot.get_licenses(@bad_query)
|
185
|
+
licenses.should be_a Hash
|
186
|
+
licenses["Errors"]["Err"][0]["code"].should == '110'
|
187
|
+
end
|
160
188
|
end
|
161
189
|
|
162
190
|
describe FccReboot, ".get_common_names" do
|
163
191
|
before do
|
164
|
-
@query = {:commonName => 'Sprint%20Nextel', :limit => '10'}
|
192
|
+
@query = {:commonName => 'Sprint%20Nextel', :limit => '10', :format => 'json'}
|
165
193
|
@url = 'http://data.fcc.gov/api/license-view/licenses/getCommonNames'
|
166
194
|
stub_request(:get, @url).
|
167
195
|
with(:query => @query).
|
@@ -184,7 +212,7 @@ end
|
|
184
212
|
|
185
213
|
describe FccReboot, ".get_statuses" do
|
186
214
|
before do
|
187
|
-
@query = {:commonName => 'Sprint%20Nextel', :limit => '10'}
|
215
|
+
@query = {:commonName => 'Sprint%20Nextel', :limit => '10', :format => 'json'}
|
188
216
|
@url = 'http://data.fcc.gov/api/license-view/licenses/getStatuses'
|
189
217
|
stub_request(:get, @url).
|
190
218
|
with(:query => @query).
|
data/spec/api_spec.rb
ADDED
@@ -0,0 +1,321 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe FccReboot do
|
4
|
+
after do
|
5
|
+
FccReboot.reset
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".respond_to?" do
|
9
|
+
it "should return true if method exists" do
|
10
|
+
FccReboot.respond_to?(:new, true).should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".new" do
|
15
|
+
it "should be a FccReboot::Client" do
|
16
|
+
FccReboot.new.should be_a FccReboot::Client
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe FccReboot, ".broadband_test" do
|
22
|
+
before do
|
23
|
+
stub_request(:get, 'http://data.fcc.gov/api/speedtest/find').
|
24
|
+
with(:query => {:format => 'json', :latitude => '38.0', :longitude => '-77.5'}).
|
25
|
+
to_return(:body => fixture('broadband_test.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the correct resource" do
|
29
|
+
FccReboot.broadband_test({:latitude => '38.0', :longitude => '-77.5'})
|
30
|
+
a_request(:get, 'http://data.fcc.gov/api/speedtest/find').
|
31
|
+
with(:query => {:format => 'json', :latitude => '38.0', :longitude => '-77.5'}).
|
32
|
+
should have_been_made
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should return the correct results" do
|
36
|
+
test = FccReboot.broadband_test({:latitude => '38.0', :longitude => '-77.5'})
|
37
|
+
test.should be_an Hash
|
38
|
+
test["wirelineMaxDownload"].should == 17773.0
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe FccReboot, ".census_block" do
|
43
|
+
before do
|
44
|
+
stub_request(:get, 'http://data.fcc.gov/api/block/find').
|
45
|
+
with(:query => {:format => 'json', :latitude => '38.0', :longitude => '-77.5'}).
|
46
|
+
to_return(:body => fixture('census-block-conversions-api.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should request the correct resource" do
|
50
|
+
FccReboot.find_census_block(:latitude => '38.0', :longitude => '-77.5')
|
51
|
+
a_request(:get, 'http://data.fcc.gov/api/block/find').
|
52
|
+
with(:query => {:format => 'json', :latitude => '38.0', :longitude => '-77.5'}).
|
53
|
+
should have_been_made
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return the correct results" do
|
57
|
+
services = FccReboot.find_census_block(:latitude => '38.0', :longitude => '-77.5')
|
58
|
+
services.should be_a Hash
|
59
|
+
services["Block"]["FIPS"].should == '510339905003000'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe FccReboot, ".frn_getlist" do
|
64
|
+
before do
|
65
|
+
stub_request(:get, 'http://data.fcc.gov/api/frn/getList').
|
66
|
+
with(:query => {:format => 'json', :stateCode => 'IL', :multi => 'Yes'}).
|
67
|
+
to_return(:body => fixture('frn-conversions-getlist.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
68
|
+
stub_request(:get, 'http://data.fcc.gov/api/frn/getList').
|
69
|
+
with(:query => {:format => 'json', :stateCode => 'IL', :multi => 'No'}).
|
70
|
+
to_return(:body => fixture('frn-conversions-getlist.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should request the correct resource" do
|
74
|
+
FccReboot.frn_getlist(:stateCode => 'IL', :multi => true)
|
75
|
+
a_request(:get, 'http://data.fcc.gov/api/frn/getList').
|
76
|
+
with(:query => {:format => 'json', :stateCode => 'IL', :multi => 'Yes'}).
|
77
|
+
should have_been_made
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should request the correct resource" do
|
81
|
+
FccReboot.frn_getlist(:stateCode => 'IL', :multi => false)
|
82
|
+
a_request(:get, 'http://data.fcc.gov/api/frn/getList').
|
83
|
+
with(:query => {:format => 'json', :stateCode => 'IL', :multi => 'No'}).
|
84
|
+
should have_been_made
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return the correct results" do
|
88
|
+
services = FccReboot.frn_getlist(:stateCode => 'IL', :multi => false)
|
89
|
+
services.should be_a Hash
|
90
|
+
services["Frns"]["Frn"].first["frn"].should == '0017855545'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe FccReboot, ".frn_getinfo" do
|
95
|
+
before do
|
96
|
+
stub_request(:get, 'http://data.fcc.gov/api/frn/getInfo').
|
97
|
+
with(:query => {:format => 'json', :frn => '0017855545'}).
|
98
|
+
to_return(:body => fixture('frn-conversions-getinfo.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should request the correct resource" do
|
102
|
+
FccReboot.frn_getinfo(:frn => '0017855545')
|
103
|
+
a_request(:get, 'http://data.fcc.gov/api/frn/getInfo').
|
104
|
+
with(:query => {:format => 'json', :frn => '0017855545'}).
|
105
|
+
should have_been_made
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should return the correct results" do
|
109
|
+
services = FccReboot.frn_getinfo(:frn => '0017855545')
|
110
|
+
services.should be_a Hash
|
111
|
+
services["Info"]["frn"].should == '0017855545'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe FccReboot, ".get_spectrum_bands" do
|
116
|
+
before do
|
117
|
+
stub_request(:get, 'http://data.fcc.gov/api/spectrum-view/services/advancedSearch/getSpectrumBands').
|
118
|
+
with(:query => {:format => 'json', :frequencyFrom=>'226', :frequencyTo => '900'}).
|
119
|
+
to_return(:body => fixture('get_spectrum_bands.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should request the correct resource" do
|
123
|
+
FccReboot.get_spectrum_bands(:frequencyFrom=>'226', :frequencyTo => '900')
|
124
|
+
a_request(:get, 'http://data.fcc.gov/api/spectrum-view/services/advancedSearch/getSpectrumBands').
|
125
|
+
with(:query => {:format => 'json', :frequencyFrom=>'226', :frequencyTo => '900'}).
|
126
|
+
should have_been_made
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should return the correct results" do
|
130
|
+
services = FccReboot.get_spectrum_bands(:frequencyFrom=>'226', :frequencyTo => '900')
|
131
|
+
services.should be_a Array
|
132
|
+
services[0]["upperBand"].should == "235"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe FccReboot, ".get_spectrum_licenses" do
|
137
|
+
before do
|
138
|
+
stub_request(:get, 'http://data.fcc.gov/api/spectrum-view/services/advancedSearch/getLicenses').
|
139
|
+
with(:query => {:format => 'json', :name=> 'AT', :radioservice=>'Cellular'}).
|
140
|
+
to_return(:body => fixture('get_licenses.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should request the correct resource" do
|
144
|
+
FccReboot.get_spectrum_licenses(:name=> 'AT', :radioservice=>'Cellular')
|
145
|
+
a_request(:get, 'http://data.fcc.gov/api/spectrum-view/services/advancedSearch/getLicenses').
|
146
|
+
with(:query => {:format => 'json', :name=> 'AT', :radioservice=>'Cellular'}).
|
147
|
+
should have_been_made
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should return the correct results" do
|
151
|
+
services = FccReboot.get_spectrum_licenses(:name=> 'AT', :radioservice=>'Cellular')
|
152
|
+
services.should be_a Array
|
153
|
+
services[0]["id"].should == "11538"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe FccReboot, ".get_licenses" do
|
158
|
+
before do
|
159
|
+
@query = {:searchValue => 'Verizon%20Wireless', :format =>'json'}
|
160
|
+
@bad_query = {:searchValue => 'some name', :format =>'json'}
|
161
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/basicSearch/getLicenses').
|
162
|
+
with(:query => @query).
|
163
|
+
to_return(:body => fixture('license-view-get-licenses.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
164
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/basicSearch/getLicenses').
|
165
|
+
with(:query => @bad_query).
|
166
|
+
to_return(:body => fixture('license-view-get-licenses-error.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should request the correct resource" do
|
170
|
+
FccReboot.get_licenses(@query)
|
171
|
+
a_request(:get, 'http://data.fcc.gov/api/license-view/basicSearch/getLicenses').
|
172
|
+
with(:query => @query).
|
173
|
+
should have_been_made
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should return the correct results" do
|
177
|
+
licenses = FccReboot.get_licenses(@query)
|
178
|
+
licenses.should be_a Array
|
179
|
+
licenses[0]["licenseID"].should == '2300007967'
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return the correct results" do
|
183
|
+
licenses = FccReboot.get_licenses(@bad_query)
|
184
|
+
licenses.should be_a Hash
|
185
|
+
licenses["Errors"]["Err"][0]["code"].should == '110'
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe FccReboot, ".get_common_names" do
|
190
|
+
before do
|
191
|
+
@query = {:commonName => 'Sprint%20Nextel', :limit => '10', :format => 'json'}
|
192
|
+
@url = 'http://data.fcc.gov/api/license-view/licenses/getCommonNames'
|
193
|
+
stub_request(:get, @url).
|
194
|
+
with(:query => @query).
|
195
|
+
to_return(:body => fixture('license-view-get-common-names.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
196
|
+
end
|
197
|
+
|
198
|
+
it "should request the correct resource" do
|
199
|
+
FccReboot.get_common_names(@query)
|
200
|
+
a_request(:get, @url).
|
201
|
+
with(:query => @query).
|
202
|
+
should have_been_made
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should return the correct results" do
|
206
|
+
common_names = FccReboot.get_common_names(@query)
|
207
|
+
common_names.should be_a Array
|
208
|
+
common_names[0]["statCount"].should == '11989'
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe FccReboot, ".get_statuses" do
|
213
|
+
before do
|
214
|
+
@query = {:commonName => 'Sprint%20Nextel', :limit => '10', :format => 'json'}
|
215
|
+
@url = 'http://data.fcc.gov/api/license-view/licenses/getStatuses'
|
216
|
+
stub_request(:get, @url).
|
217
|
+
with(:query => @query).
|
218
|
+
to_return(:body => fixture('license-view-get-statuses.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should request the correct resource" do
|
222
|
+
FccReboot.get_statuses(@query)
|
223
|
+
a_request(:get, @url).
|
224
|
+
with(:query => @query).
|
225
|
+
should have_been_made
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should return the correct results" do
|
229
|
+
statuses = FccReboot.get_statuses(@query)
|
230
|
+
statuses.should be_a Array
|
231
|
+
statuses[0]["statCount"].should == '43980'
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
describe FccReboot, ".get_issued" do
|
236
|
+
before do
|
237
|
+
@query = {:commonName => 'Sprint%Nextel', :format => 'json'}
|
238
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getIssued').
|
239
|
+
with(:query => @query).
|
240
|
+
to_return(:body => fixture('get_issued.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should request the correct resource" do
|
244
|
+
FccReboot.get_issued(@query)
|
245
|
+
a_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getIssued').
|
246
|
+
with(:query => @query).
|
247
|
+
should have_been_made
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should return the correct results" do
|
251
|
+
licenses = FccReboot.get_issued(@query)
|
252
|
+
licenses.should be_a Array
|
253
|
+
licenses[0]["statDesc"].should == '2001'
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe FccReboot, ".get_renewals" do
|
258
|
+
before do
|
259
|
+
@query = {:commonName => 'Sprint%Nextel', :format => 'json'}
|
260
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getRenewals').
|
261
|
+
with(:query => @query).
|
262
|
+
to_return(:body => fixture('get_renewals.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should request the correct resource" do
|
266
|
+
FccReboot.get_renewals(@query)
|
267
|
+
a_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getRenewals').
|
268
|
+
with(:query => @query).
|
269
|
+
should have_been_made
|
270
|
+
end
|
271
|
+
|
272
|
+
it "should return the correct results" do
|
273
|
+
licenses = FccReboot.get_renewals(@query)
|
274
|
+
licenses.should be_a Array
|
275
|
+
licenses[0]["statDesc"].should == '201104'
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
describe FccReboot, ".get_entities" do
|
280
|
+
before do
|
281
|
+
@query = {:commonName => 'Sprint%Nextel', :format => 'json'}
|
282
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getEntities').
|
283
|
+
with(:query => @query).
|
284
|
+
to_return(:body => fixture('get_entities.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should request the correct resource" do
|
288
|
+
FccReboot.get_entities(@query)
|
289
|
+
a_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getEntities').
|
290
|
+
with(:query => @query).
|
291
|
+
should have_been_made
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should return the correct results" do
|
295
|
+
licenses = FccReboot.get_entities(@query)
|
296
|
+
licenses.should be_a Array
|
297
|
+
licenses[0]["statDesc"].should == 'Individual'
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
describe FccReboot, ".get_categories" do
|
302
|
+
before do
|
303
|
+
@query = {:commonName => 'Sprint%Nextel', :limit=>"10", :format => 'json'}
|
304
|
+
stub_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getCategories').
|
305
|
+
with(:query => @query).
|
306
|
+
to_return(:body => fixture('get_entities.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should request the correct resource" do
|
310
|
+
FccReboot.get_categories(@query)
|
311
|
+
a_request(:get, 'http://data.fcc.gov/api/license-view/licenses/getCategories').
|
312
|
+
with(:query => @query).
|
313
|
+
should have_been_made
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should return the correct results" do
|
317
|
+
licenses = FccReboot.get_categories(@query)
|
318
|
+
licenses.should be_a Array
|
319
|
+
licenses[0]["statDesc"].should == 'Individual'
|
320
|
+
end
|
321
|
+
end
|