fcc-content-api 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gem "rake"
4
+
3
5
  # Specify your gem's dependencies in fcc-content-api.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://secure.travis-ci.org/adelevie/fcc-content-api.png?branch=master)](http://travis-ci.org/adelevie/fcc-content-api)
2
+
1
3
  The FCC Content API allows you to programmatically access much of the content accessible on [FCC.gov](http://fcc.gov).
2
4
 
3
5
  fcc-content-api is a lightweight Ruby wrapper for the Federal Communication Commission's Content API. The query interface resembles ActiveRecord. The response objects are simple Ruby `Hash`es and `Array`s.
@@ -27,13 +29,19 @@ FccContentApi::Content.where(:edocs => "true").where(:type => "proceeding").wher
27
29
  FccContentApi::Content.where({:edocs => "true", :type => "proceeding" :comments => "true"}).all
28
30
  ```
29
31
 
32
+ If you know the id of the object you want, use `FccContentApi::Content#find`:
33
+
34
+ ```ruby
35
+ FccContentApi::Content.find(38660)
36
+ ```
37
+
30
38
  ## Installation
31
39
 
32
40
  `gem install fcc-content-api` or:
33
41
 
34
42
  ```ruby
35
- # Gemfile
36
- gem "fcc-content-api"
43
+ # Gemfile
44
+ gem "fcc-content-api"
37
45
  ```
38
46
 
39
47
  ## More Info
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.fcc.gov/api/content.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Host:
11
+ - www.fcc.gov
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache
23
+ Last-Modified:
24
+ - Fri, 13 Apr 2012 11:48:45 GMT
25
+ Content-Length:
26
+ - "2885"
27
+ Content-Type:
28
+ - application/json
29
+ Cache-Control:
30
+ - no-cache, must-revalidate, post-check=0, pre-check=0
31
+ Expires:
32
+ - Fri, 13 Apr 2012 11:45:17 GMT
33
+ Date:
34
+ - Fri, 13 Apr 2012 11:45:17 GMT
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: "[{\"count\":\"21171\",\"pages\":2117,\"itemsPerPage\":10,\"currentPage\":0},{\"nid\":\"38892\",\"title\":\"Clyburn Statement on Award of Contract for Literature Review\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/clyburn-statement-award-contract-literature-review\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38892\"},{\"nid\":\"38891\",\"title\":\"Broadband Over Power Lines\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/broadband-over-power-lines\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38891\"},{\"nid\":\"38890\",\"title\":\"Ex Parte Rules and Other Procedural Rules\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/ex-parte-rules-and-other-procedural-rules\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38890\"},{\"nid\":\"38889\",\"title\":\"Commissioner McDowell Remarks: MMTC Honors Commissioner Copps\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/commissioner-mcdowell-remarks-mmtc-honors-commissioner-copps\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38889\"},{\"nid\":\"38888\",\"title\":\"WTB seeks comment on waiver of USF support methodology rule\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/wtb-seeks-comment-waiver-usf-support-methodology-rule\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38888\"},{\"nid\":\"38887\",\"title\":\"Wireline Bureau Seeks Comment on BelWave Request for Review\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/wireline-bureau-seeks-comment-belwave-request-review\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38887\"},{\"nid\":\"38884\",\"title\":\"Collocation Workshop May 1, 2012, Promoting Mobile Brandband\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/collocation-workshop-may-1-2012-promoting-mobile-brandband\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38884\"},{\"nid\":\"38883\",\"title\":\"Erratum - Al-Ihsan Academy, South Ozone Park, NY et al.\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/erratum-al-ihsan-academy-south-ozone-park-ny-et-al-0\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38883\"},{\"nid\":\"38882\",\"title\":\"LPFM Channel Finder Tool Now Available\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/lpfm-channel-finder-tool-now-available\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38882\"},{\"nid\":\"38881\",\"title\":\"DeltaCom, Inc. Order Denying Renewal Deadline Waiver Requests\",\"created\":\"2012-04-12\",\"changed\":\"2012-04-13\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/deltacom-inc-order-denying-renewal-deadline-waiver-requests\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38881\"}]"
40
+ http_version:
41
+ recorded_at: Fri, 13 Apr 2012 11:45:17 GMT
42
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.fcc.gov/api/content/38837.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Host:
11
+ - www.fcc.gov
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache
23
+ Last-Modified:
24
+ - Fri, 13 Apr 2012 11:45:53 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - "11396"
29
+ Cache-Control:
30
+ - no-cache, must-revalidate, post-check=0, pre-check=0
31
+ Expires:
32
+ - Fri, 13 Apr 2012 11:45:18 GMT
33
+ Date:
34
+ - Fri, 13 Apr 2012 11:45:18 GMT
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: "{\"nid\":\"38837\",\"title\":\"WCB seeks comment on petitions for ETC designations\",\"created\":\"2012-04-10\",\"changed\":\"2012-04-11\",\"type\":\"edoc\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/document\\/wcb-seeks-comment-petitions-etc-designations\",\"taxonomy\":{\"7\":{\"tid\":\"7\",\"vid\":\"1\",\"name\":\"Wireline Competition\",\"description\":\"\",\"weight\":\"21\"},\"49\":{\"tid\":\"49\",\"vid\":\"4\",\"name\":\"Public Notice\",\"description\":\"\",\"weight\":\"49\"}},\"body\":\"<A name=1><\\/a><p><b>PUBLIC NOTICE<\\/b><\\/p>\\n<p><b>Federal Communications Commission<\\/b><\\/p>\\n<p><b>News Media Information 202 \\/ 418-0500<\\/b><\\/p>\\n<b>445 12th&nbsp;St., S.W.<\\/b><br \\/>\\n<p><b>Internet: http:\\/\\/www.fcc.gov<\\/b><\\/p>\\n<p><b>Washington, D.C. 20554<\\/b><\\/p>\\n<p><b>TTY: 1-888-835-5322<\\/b><\\/p>\\n<p><b>DA 12-566<\\/b><\\/p>\\n<p><b>Release Date: &nbsp;April 10, 2012<\\/b><\\/p>\\n<p><b>WIRELINE COMPETITION BUREAU SEEKS COMMENT ON PETITIONS FOR&nbsp;<\\/b><\\/p>\\n<p><b>DESIGNATION AS A LOW-INCOME ELIGIBLE TELECOMMUNICATIONS CARRIER&nbsp;<\\/b><\\/p>\\n<p><b>FILED BY T-MOBILE, KAJEET, TAG MOBILE, TELRITE AND GLOBAL CONNECTION&nbsp;<\\/b><\\/p>\\n<p><b>WC Docket No. 09-197<\\/b><\\/p>\\n<p><b>Comment Date: &nbsp; May 10, 2012<br \\/>Reply Comment Date: &nbsp;May 25, 2012<\\/b><\\/p>\\nThe Wireline Competition Bureau seeks comment on petitions filed by T-Mobile USA, Inc. (T-<br \\/>\\nMobile),1&nbsp;kajeet, Inc. (kajeet),2&nbsp;TAG Mobile, LLC (TAG),3&nbsp;Telrite Corporation (Telrite),4&nbsp;and Global<br \\/>Connection Inc. of America (Global Connection),5&nbsp;for limited designation as eligible telecommunications&nbsp;<br \\/>carriers (ETC) for the provision of Lifeline service. &nbsp;kajeet, TAG, Telrite and Global Connection each&nbsp;<br \\/>seek designation as an ETC for the limited purpose of offering Lifeline service in Alabama, Connecticut,&nbsp;<br \\/>Delaware, District of Columbia, Florida, New Hampshire, New York, North Carolina, Tennessee and&nbsp;<br \\/>\\n&nbsp;<br \\/>\\n&nbsp;<br \\/>\\n1&nbsp;Petition of T-Mobile USA, Inc. for Designation as a Low-Income Eligible Telecommunications Carrier, WC&nbsp;<br \\/>Docket No. 09-197 (filed Jan. 23, 2012) (T-Mobile Petition).<br \\/>\\n2&nbsp;kajeet, Inc. Petition for Designation as a Lifeline Eligible Telecommunications Carrier, WC Docket No. 09-197&nbsp;<br \\/>(filed Mar. 26, 2012) (kajeet Petition). &nbsp;kajeet has a compliance plan pending with the Commission and may not be&nbsp;<br \\/>designated an ETC until that plan has been approved by the Wireline Competition Bureau. &nbsp;<i>See&nbsp;<\\/i>kajeet, Inc.&nbsp;<br \\/>Compliance Plan, WC Docket Nos. 09-197 and 11-42 (filed Mar. 26, 2012);&nbsp;<i>see also<\\/i>,&nbsp;<i>Lifeline and Link Up Reform&nbsp;<br \\/>and Modernization et al<\\/i>, WC Dkt No.11-42&nbsp;<i>et al.,&nbsp;<\\/i>Report and Order and Further Notice of Proposed Rulemaking,&nbsp;<br \\/>FCC 12-11, at&nbsp;para. 380 (rel. Feb. 6, 2012) (<i>Lifeline Reform Order<\\/i>).<br \\/>\\n3&nbsp;TAG Mobile, LLC Petition for Limited Designation as an Eligible Telecommunications Carrier in Alabama,&nbsp;<br \\/>Connecticut, Delaware, the District of Columbia, Florida, New&nbsp;Hampshire, New York, North Carolina, Tennessee&nbsp;<br \\/>and Virginia, WC Docket No. 09-197 (filed Apr. 4, 2012) (TAG Petition). &nbsp;TAG has a compliance plan pending&nbsp;<br \\/>with the Commission and may not be designated an ETC until its plan has been approved by the Wireline&nbsp;<br \\/>Competition Bureau. &nbsp;<i>See&nbsp;<\\/i>TAG Mobile, LLC Compliance Plan, WC Docket Nos. 09-197 and 11-42 (filed Mar. 6,&nbsp;<br \\/>2012);&nbsp;<i>see also<\\/i>,&nbsp;<i>Lifeline Reform Order<\\/i>, FCC 12-11, at para. 380.<br \\/>\\n4&nbsp;Telrite Corporation Petition for Limited Designation as an Eligible Telecommunications Carrier in Alabama,&nbsp;<br \\/>Connecticut, Delaware, the District of Columbia, Florida, New&nbsp;Hampshire, New York, North Carolina, Tennessee&nbsp;<br \\/>and Virginia, WC Docket No. 09-197 (filed Apr. 4, 2012) (Telrite Petition). &nbsp;Telrite has a compliance plan pending&nbsp;<br \\/>with the Commission and may not be designated an ETC until its plan has been approved by the Wireline&nbsp;<br \\/>Competition Bureau. &nbsp;<i>See&nbsp;<\\/i>Telrite Corporation Compliance Plan, WC Docket Nos. 09-197 and 11-42 (filed Mar. 12,&nbsp;<br \\/>2012);&nbsp;<i>see also<\\/i>,&nbsp;<i>Lifeline Reform Order<\\/i>, FCC 12-11, para. 380.<br \\/>\\n5&nbsp;Global Connection Inc.&nbsp;of America Petition for Limited Designation as an Eligible Telecommunications Carrier in&nbsp;<br \\/>Alabama, Connecticut, Delaware, the District of Columbia, Florida, New&nbsp;Hampshire, New York, North Carolina,&nbsp;<br \\/>Tennessee and Virginia, WC Docket No. 09-197 (filed Apr. 4, 2012) (Global Connections Petition). &nbsp;Global&nbsp;<br \\/>Connection has a compliance plan pending with the Commission and may not be designated an ETC until its plan&nbsp;<br \\/>has been approved by the Wireline Competition Bureau. &nbsp;<i>See&nbsp;<\\/i>Global Connection Inc. of America Compliance Plan,&nbsp;<br \\/>WC Docket Nos. 09-197 and 11-42 (filed Mar. 8, 2012); &nbsp;<i>see also<\\/i>,&nbsp;<i>Lifeline Reform Order<\\/i>, FCC 12-11, para. 380.<br \\/>\\n<hr>\\n<A name=2><\\/a>Virginia.6&nbsp;T-Mobile seeks ETC designation for the limited purpose of offering Lifeline service in&nbsp;<br \\/>Alabama, Connecticut, Delaware, District of Columbia, Florida, New Hampshire, New York, Tennessee&nbsp;<br \\/>and Virginia.7<br \\/>\\nPursuant to sections 1.415 and 1.419 of the Commission\\u2019s rules, interested parties may file&nbsp;<br \\/>\\ncomments and reply comments on or before the dates indicated on the first page of this document. &nbsp;<br \\/>Comments may be filed using the Commission\\u2019s Electronic Comment Filing System (ECFS).8&nbsp;&nbsp;<br \\/>\\n\\u00a7<br \\/>\\nElectronic Filers: &nbsp;Comments may be filed electronically using the Internet by accessing the&nbsp;<br \\/>ECFS: &nbsp;http:\\/\\/fjallfoss.fcc.gov\\/ecfs2\\/. &nbsp;<br \\/>\\n\\u00a7<br \\/>\\nPaper Filers: &nbsp;Parties who choose to file by paper must file an original and one copy of each&nbsp;<br \\/>filing. &nbsp;If more than one docket or rulemaking number appears in the caption of this proceeding,&nbsp;<br \\/>filers must submit two additional copies for each additional docket or rulemaking number.<br \\/>\\nFilings can be sent by hand or messenger delivery, by commercial overnight courier, or by first-<br \\/>class or overnight U.S. Postal Service mail. &nbsp;All filings must be addressed to the Commission\\u2019s&nbsp;<br \\/>Secretary, Office of the Secretary, Federal Communications Commission.<br \\/>\\n\\u00a7<br \\/>\\nAll hand-delivered or messenger-delivered paper filings for the Commission\\u2019s Secretary&nbsp;<br \\/>must be delivered to FCC Headquarters at 445 12th&nbsp;St., SW, Room TW-A325,&nbsp;<br \\/>Washington, DC 20554. &nbsp;The filing hours are 8:00 a.m. to 7:00 p.m. &nbsp; All hand deliveries&nbsp;<br \\/>must be held together with rubber bands or fasteners. &nbsp;Any envelopes and boxes must be&nbsp;<br \\/>disposed of&nbsp;before&nbsp;entering the building. &nbsp;<br \\/>\\n\\u00a7<br \\/>\\nCommercial overnight mail (other than U.S. Postal Service Express Mail and Priority&nbsp;<br \\/>Mail) must be sent to 9300 East Hampton Drive, Capitol Heights, MD &nbsp;20743.<br \\/>\\n\\u00a7<br \\/>\\nU.S. Postal Service first-class, Express, and Priority mail must be addressed to 445 12th<br \\/>Street, SW, Washington DC &nbsp;20554.<br \\/>\\nPeople&nbsp;with Disabilities: &nbsp;To request materials in accessible formats for people with disabilities (braille,&nbsp;<br \\/>large print, electronic files, audio format), send an e-mail to&nbsp;fcc504@fcc.gov&nbsp;or call the Consumer &amp;&nbsp;<br \\/>Governmental&nbsp;Affairs Bureau at 202-418-0530 (voice), 202-418-0432 (tty).<br \\/>\\nThe proceeding this Notice initiates shall be treated as a \\u201cpermit-but-disclose\\u201d proceeding in&nbsp;<br \\/>\\naccordance with the Commission\\u2019s&nbsp;<i>ex parte&nbsp;<\\/i>rules.9&nbsp;Persons making&nbsp;<i>ex parte&nbsp;<\\/i>presentations must file&nbsp;a&nbsp;<br \\/>copy of any written presentation or a memorandum summarizing any oral presentation within two&nbsp;<br \\/>business days after the presentation (unless a different deadline applicable to the Sunshine period applies). &nbsp;<br \\/>Persons making oral&nbsp;<i>ex parte&nbsp;<\\/i>presentations are reminded that memoranda summarizing the presentation&nbsp;<br \\/>must (1) list all persons attending or otherwise participating in the meeting at which the&nbsp;<i>ex parte&nbsp;<br \\/><\\/i>presentation was made, and (2) summarize all data presented and arguments made during the&nbsp;<br \\/>\\n&nbsp;<br \\/>\\n&nbsp;<br \\/>\\n6&nbsp;kajeet Petition at 1; TAG Petition at 1; Telrite Petition at 1; Global Connection Petition at 1.<br \\/>7&nbsp;T-Mobile Petition at 1.&nbsp;<br \\/>8&nbsp;<i>See&nbsp;<\\/i>47 CFR \\u00a7\\u00a7 1.415, 1.419;&nbsp;<i>Electronic Filing of Documents in Rulemaking Proceedings<\\/i>, 63 FR 24121 (1998).<br \\/>9&nbsp;47 C.F.R. \\u00a7\\u00a7 1.1200&nbsp;<i>et seq.<\\/i><br \\/>\\n2<br \\/>\\n<hr>\\n<A name=3><\\/a>presentation. &nbsp;If the presentation consisted in whole or in part of the presentation of data or arguments&nbsp;<br \\/>already reflected in the presenter\\u2019s written comments, memoranda or other filings in the proceeding, the&nbsp;<br \\/>presenter may provide citations to such data or arguments in&nbsp;his or her prior comments, memoranda, or&nbsp;<br \\/>other filings (specifying the relevant page and\\/or paragraph numbers where such data or arguments can be&nbsp;<br \\/>found) in lieu of summarizing them in the memorandum. &nbsp;Documents shown or given to Commission&nbsp;<br \\/>staff during&nbsp;<i>ex&nbsp;parte&nbsp;<\\/i>meetings are deemed to be written&nbsp;<i>ex parte&nbsp;<\\/i>presentations and must be filed&nbsp;<br \\/>consistent with rule 1.1206(b). &nbsp;In proceedings governed by rule 1.49(f) or for which the Commission has&nbsp;<br \\/>made available a method of electronic filing, written&nbsp;<i>ex parte&nbsp;<\\/i>presentations and memoranda summarizing&nbsp;<br \\/>oral&nbsp;<i>ex parte&nbsp;<\\/i>presentations, and all attachments thereto, must be filed through the electronic comment&nbsp;<br \\/>filing system available for that proceeding, and must be filed in their native format (<i>e.g.<\\/i>, .doc, .xml, .ppt,&nbsp;<br \\/>searchable .pdf). &nbsp;Participants in this proceeding should familiarize themselves with the Commission\\u2019s&nbsp;<i>ex&nbsp;<br \\/>parte&nbsp;<\\/i>rules.<br \\/>\\nFor further information, please contact Divya S. Shenoy, Telecommunications Access Policy&nbsp;<br \\/>\\nDivision, Wireline Competition Bureau at (202) 418-7400 or TTY (202) 418-0484.<br \\/>\\n<b>-&nbsp;FCC&nbsp;-<\\/b><br \\/>\\n3<br \\/>\\n<hr>\",\"vid\":\"62623\",\"field_short_title\":[{\"value\":null}],\"field_short_description\":[{\"value\":null}],\"field_author\":[{\"value\":null}],\"field_job_title\":[{\"value\":null}],\"field_edoc_internal_id\":[{\"value\":\"313517\"}],\"field_released_date\":[{\"value\":\"2012-04-10T00:00:00\"}],\"field_published_date\":[{\"value\":\"2012-04-10T00:00:00\"}],\"field_adopted_date\":[{\"value\":null}],\"field_comment_date\":[{\"value\":\"2012-05-10T00:00:00\"}],\"field_edoc_id\":[{\"value\":\"DA-12-566\"}],\"field_featured_image\":[{\"fid\":null,\"list\":null,\"data\":null}],\"topics\":[{\"nid\":\"144\",\"title\":\"Connecting America\"},{\"nid\":\"3907\",\"title\":\"Universal Service\"}],\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/38837\"}"
40
+ http_version:
41
+ recorded_at: Fri, 13 Apr 2012 11:45:18 GMT
42
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.fcc.gov/api/content.json?title=Open%2520Internet%2520Workshops%2520and%2520Speeches
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Host:
11
+ - www.fcc.gov
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache
23
+ Last-Modified:
24
+ - Fri, 13 Apr 2012 11:44:53 GMT
25
+ Content-Length:
26
+ - "319"
27
+ Content-Type:
28
+ - application/json
29
+ Cache-Control:
30
+ - no-cache, must-revalidate, post-check=0, pre-check=0
31
+ Expires:
32
+ - Fri, 13 Apr 2012 11:44:18 GMT
33
+ Date:
34
+ - Fri, 13 Apr 2012 11:44:18 GMT
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: "[{\"count\":\"1\",\"pages\":0,\"itemsPerPage\":10,\"currentPage\":0},{\"nid\":\"37071\",\"title\":\"Open Internet Workshops and Speeches\",\"created\":\"2011-12-21\",\"changed\":\"2011-12-21\",\"type\":\"article\",\"webUrl\":\"http:\\/\\/www.fcc.gov\\/encyclopedia\\/open-internet-workshops-and-speeches\",\"uri\":\"http:\\/\\/www.fcc.gov\\/api\\/content\\/37071\"}]"
40
+ http_version:
41
+ recorded_at: Fri, 13 Apr 2012 11:44:18 GMT
42
+ recorded_with: VCR 2.0.1
@@ -3,70 +3,73 @@ require "weary"
3
3
  require "json"
4
4
 
5
5
  module FccContentApi
6
-
7
- def self.client
8
- @@client ||= FccContentApi::Client.new
9
- end
10
-
11
- class Content
12
- def self.where(*args)
13
- Query.new(self).where(*args)
14
- end
15
-
16
- def self.all
17
- Query.new(self).all
18
- end
19
-
20
- def self.find(id)
21
- resp = FccContentApi::Client.new.get(:id => id).perform.body
22
- JSON.parse resp
23
- end
24
- end
25
-
26
- class Query
27
-
28
- def initialize(klass); @klass = klass; end
29
-
30
- def criteria; @criteria ||= {}; end
31
-
32
- def where(args)
33
- criteria.merge! args
34
- self
35
- end
36
-
37
- def all; execute; end
38
-
39
- def request
40
- @request ||= FccContentApi::Client.new.all criteria
41
- end
42
-
43
- def execute
44
- resp = request.perform.body
45
- JSON.parse(resp)
46
- end
47
-
48
- end
49
-
50
- class Client < Weary::Client
51
- domain "http://www.fcc.gov/api"
52
-
53
- get :all, "/content.json?" do |resource|
54
- resource.optional :created_before, :created_after, # YYYY-MM-DD
55
- :changed_before, :changed_after, # YYYY-MM-DD
56
- :search_string,
57
- :limit,
58
- :page,
59
- :fields, # true
60
- :edocs, # true
61
- :comments, # true
62
- :major_topics,
63
- :type,
64
- :term,
65
- :topic,
66
- :title
67
- end
68
-
69
- get :get, "/content/{id}.json"
70
-
71
- end
72
- end
6
+ def self.client
7
+ @@client ||= FccContentApi::Client.new
8
+ end
9
+
10
+ class Content
11
+ def self.where(*args)
12
+ Query.new(self).where(*args)
13
+ end
14
+
15
+ def self.all
16
+ Query.new(self).all
17
+ end
18
+
19
+ def self.find(id)
20
+ resp = FccContentApi.client.get(:id => id).perform.body
21
+ JSON.parse resp
22
+ end
23
+ end
24
+
25
+ class Query
26
+ def initialize(klass); @klass = klass; end
27
+
28
+ def criteria; @criteria ||= {}; end
29
+
30
+ def where(args)
31
+ criteria.merge! args
32
+ self
33
+ end
34
+
35
+ def all; execute; end
36
+
37
+ def request
38
+ @request ||= FccContentApi.client.all criteria
39
+ end
40
+
41
+ def execute
42
+ resp = request.perform.body
43
+ JSON.parse(resp)
44
+ end
45
+
46
+ end
47
+
48
+ class Client < Weary::Client
49
+ domain "http://www.fcc.gov/api"
50
+
51
+ get :all, "/content.json?" do |resource|
52
+
53
+ resource.user_agent "rubygem/fcc-content-api/#{VERSION}"
54
+
55
+ resource.optional :created_before, :created_after, # YYYY-MM-DD
56
+ :changed_before, :changed_after, # YYYY-MM-DD
57
+ :search_string,
58
+ :limit,
59
+ :page,
60
+ :fields, # true
61
+ :edocs, # true
62
+ :comments, # true
63
+ :major_topics,
64
+ :type,
65
+ :term,
66
+ :topic,
67
+ :title
68
+ end
69
+
70
+ get :get, "/content/{id}.json" do |resource|
71
+ resource.user_agent "rubygem/fcc-content-api/#{VERSION}"
72
+ end
73
+
74
+ end
75
+ end
@@ -1,3 +1,3 @@
1
1
  module FccContentApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,51 +1,53 @@
1
1
  require "test_helper"
2
2
 
3
3
  class TestClient < Test::Unit::TestCase
4
- VCR.use_cassette("test_title") do
5
- def test_title
6
- title = "Open Internet Workshops and Speeches"
7
- resp = FccContentApi::Content.where(:title => URI.encode(title)).all
8
- assert_equal resp.first.keys.sort!, ["count", "pages", "itemsPerPage", "currentPage"].sort!
9
- assert_equal resp[1].keys.sort!, ["nid", "title", "created", "changed", "type", "webUrl", "uri"].sort!
10
- assert_equal title, resp[1]["title"]
11
- end
12
- end
13
4
 
14
- VCR.use_cassette("test_all") do
15
- def test_all
16
- resp = FccContentApi::Content.all
17
- assert_equal resp.first.keys.sort!, ["count", "pages", "itemsPerPage", "currentPage"].sort!
18
- assert_equal resp[1].keys.sort!, ["nid", "title", "created", "changed", "type", "webUrl", "uri"].sort!
19
- end
20
- end
5
+ def test_title
6
+ VCR.use_cassette("test_title") do
7
+ title = "Open Internet Workshops and Speeches"
8
+ resp = FccContentApi::Content.where(:title => URI.encode(title)).all
9
+ assert_equal resp.first.keys.sort!, ["count", "pages", "itemsPerPage", "currentPage"].sort!
10
+ assert_equal resp[1].keys.sort!, ["nid", "title", "created", "changed", "type", "webUrl", "uri"].sort!
11
+ assert_equal title, resp[1]["title"]
12
+ end
13
+ end
21
14
 
22
- VCR.use_cassette("test_find") do
23
- def test_find
24
- resp = FccContentApi::Content.find 38837
25
- assert_equal resp.class, Hash
26
- keys = ["nid", "title", "created", "changed",
27
- "type", "webUrl", "taxonomy", "body",
28
- "vid", "field_short_title", "field_short_description",
29
- "field_author", "field_job_title", "field_edoc_internal_id",
30
- "field_released_date", "field_published_date",
31
- "field_adopted_date", "field_comment_date", "field_edoc_id",
32
- "field_featured_image", "topics", "uri"]
33
- assert_equal resp.keys.sort!, keys.sort!
34
- end
35
- end
15
+ def test_all
16
+ VCR.use_cassette("test_all") do
17
+ resp = FccContentApi::Content.all
18
+ assert_equal resp.first.keys.sort!, ["count", "pages", "itemsPerPage", "currentPage"].sort!
19
+ assert_equal resp[1].keys.sort!, ["nid", "title", "created", "changed", "type", "webUrl", "uri"].sort!
20
+ end
21
+ end
36
22
 
37
- def test_params
38
- params = {
39
- :attribute1 => "value1", # invalid
40
- :search_string => "searchq" # valid
41
- }
42
- req = FccContentApi::Content.where(params).request
43
- assert_equal req.uri.to_s.split("?")[1], "search_string=searchq"
44
- end
23
+
24
+ def test_find
25
+ VCR.use_cassette("test_find") do
26
+ resp = FccContentApi::Content.find 38837
27
+ assert_equal resp.class, Hash
28
+ keys = ["nid", "title", "created", "changed",
29
+ "type", "webUrl", "taxonomy", "body",
30
+ "vid", "field_short_title", "field_short_description",
31
+ "field_author", "field_job_title", "field_edoc_internal_id",
32
+ "field_released_date", "field_published_date",
33
+ "field_adopted_date", "field_comment_date", "field_edoc_id",
34
+ "field_featured_image", "topics", "uri"]
35
+ assert_equal resp.keys.sort!, keys.sort!
36
+ end
37
+ end
45
38
 
46
- def test_equivalent_queries
47
- q1 = FccContentApi::Content.where({:search_string => "broadband", :created_afer => "2012-1-1"}).request
48
- q2 = FccContentApi::Content.where(:search_string => "broadband").where(:created_afer => "2012-1-1").request
49
- assert_equal q1.uri.to_s, q2.uri.to_s
50
- end
39
+ def test_params
40
+ params = {
41
+ :attribute1 => "value1", # invalid
42
+ :search_string => "searchq" # valid
43
+ }
44
+ req = FccContentApi::Content.where(params).request
45
+ assert_equal req.uri.to_s.split("?")[1], "search_string=searchq"
46
+ end
47
+
48
+ def test_equivalent_queries
49
+ q1 = FccContentApi::Content.where({:search_string => "broadband", :created_afer => "2012-1-1"}).request
50
+ q2 = FccContentApi::Content.where(:search_string => "broadband").where(:created_afer => "2012-1-1").request
51
+ assert_equal q1.uri.to_s, q2.uri.to_s
52
+ end
51
53
  end
@@ -4,5 +4,5 @@ require 'vcr'
4
4
 
5
5
  VCR.configure do |c|
6
6
  c.cassette_library_dir = 'fixtures/vcr_cassettes'
7
- #c.stub_with :webmock
7
+ c.hook_into :webmock
8
8
  end
@@ -3,24 +3,24 @@ require "test_helper"
3
3
  class TestQuery < Test::Unit::TestCase
4
4
 
5
5
 
6
- def test_where
7
- query = FccContentApi::Query.new(FccContentApi::Content)
8
- query.where(:attribute => "value")
9
- assert_equal query.criteria[:attribute], "value"
10
- end
6
+ def test_where
7
+ query = FccContentApi::Query.new(FccContentApi::Content)
8
+ query.where(:attribute => "value")
9
+ assert_equal query.criteria[:attribute], "value"
10
+ end
11
11
 
12
- def test_stacked_wheres
13
- query = FccContentApi::Query.new(FccContentApi::Content)
14
- query.where(:attribute => "value")
15
- assert_equal query.criteria[:attribute], "value"
16
- query.where(:second_attribute => "second_value")
17
- assert_equal query.criteria[:second_attribute], "second_value"
18
- assert_equal query.criteria[:attribute], "value"
19
- end
12
+ def test_stacked_wheres
13
+ query = FccContentApi::Query.new(FccContentApi::Content)
14
+ query.where(:attribute => "value")
15
+ assert_equal query.criteria[:attribute], "value"
16
+ query.where(:second_attribute => "second_value")
17
+ assert_equal query.criteria[:second_attribute], "second_value"
18
+ assert_equal query.criteria[:attribute], "value"
19
+ end
20
20
 
21
- def test_request
22
- query = FccContentApi::Query.new(FccContentApi::Content)
23
- assert_equal query.request.class, Weary::Request
24
- end
21
+ def test_request
22
+ query = FccContentApi::Query.new(FccContentApi::Content)
23
+ assert_equal query.request.class, Weary::Request
24
+ end
25
25
 
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcc-content-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-10 00:00:00.000000000Z
12
+ date: 2012-04-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vcr
16
- requirement: &70341875787080 !ruby/object:Gem::Requirement
16
+ requirement: &70178652500760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70341875787080
24
+ version_requirements: *70178652500760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: webmock
27
- requirement: &70341875786580 !ruby/object:Gem::Requirement
27
+ requirement: &70178652500240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70341875786580
35
+ version_requirements: *70178652500240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: weary
38
- requirement: &70341875786160 !ruby/object:Gem::Requirement
38
+ requirement: &70178652499600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70341875786160
46
+ version_requirements: *70178652499600
47
47
  description: A Ruby wrapper for the FCC's Content API
48
48
  email:
49
49
  - adelevie@gmail.com
@@ -52,10 +52,14 @@ extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
54
  - .gitignore
55
+ - .travis.yml
55
56
  - Gemfile
56
57
  - README.md
57
58
  - Rakefile
58
59
  - fcc-content-api.gemspec
60
+ - fixtures/vcr_cassettes/test_all.yml
61
+ - fixtures/vcr_cassettes/test_find.yml
62
+ - fixtures/vcr_cassettes/test_title.yml
59
63
  - lib/fcc-content-api.rb
60
64
  - lib/fcc-content-api/version.rb
61
65
  - test/test_client.rb