ecfs 0.4.1 → 0.5.0
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.
- checksums.yaml +4 -4
- data/lib/ecfs/solr_scrape_query.rb +23 -23
- data/lib/ecfs/version.rb +1 -1
- data/test/test_solr_scrape.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a6dcf7a11a8fe5074e894553719aea9451fc6f
|
4
|
+
data.tar.gz: e2edf307df0346fb87ee5e8328f4b830fa7adc5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2577e742cacbaaff43926f6f69302cb7e4172b62e56bfd7717f670d6c2140f868bc84ecfd3d04a543bdb3456d59a8a260683306b2686e7636e1d17102af1cbd9
|
7
|
+
data.tar.gz: e39b2abf1052849b29a8a5e672758ffc508009ff62cdff395c490cd46e02e4372d68ba78cd72c9ee4709d0d661bdbef2af79d47b7f56e8a5da255ce8430a9214
|
@@ -9,6 +9,25 @@ module ECFS
|
|
9
9
|
attr_accessor :received_min_date
|
10
10
|
attr_accessor :after_scrape
|
11
11
|
|
12
|
+
def filing_to_citation(filing)
|
13
|
+
patterns = {
|
14
|
+
"COMMENT" => "Comments",
|
15
|
+
"REPLY TO COMMENTS" => "Reply Comments",
|
16
|
+
"NOTICE OF EXPARTE" => "Ex Parte Letter"
|
17
|
+
}
|
18
|
+
|
19
|
+
case filing["type_of_filing"]
|
20
|
+
when "COMMENT"
|
21
|
+
return "Comments of #{filing['name_of_filer']}"
|
22
|
+
when "REPLY TO COMMENTS"
|
23
|
+
return "Reply Comments of #{filing['name_of_filer']}"
|
24
|
+
when "NOTICE OF EXPARTE"
|
25
|
+
return "#{filing['name_of_filer']} Ex Parte Letter"
|
26
|
+
else
|
27
|
+
return "#{filing["type_of_filing"].downcase.capitalize} of #{filing['name_of_filer']}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
12
31
|
def filings_from_docket_number(docket_number, start=0, received_min_date=nil, after_scrape=nil)
|
13
32
|
url = "http://apps.fcc.gov/ecfs/solr/search?sort=dateRcpt&proceeding=#{docket_number}&dir=asc&start=#{start}"
|
14
33
|
|
@@ -47,6 +66,10 @@ module ECFS
|
|
47
66
|
}
|
48
67
|
end
|
49
68
|
|
69
|
+
filings.each do |filing|
|
70
|
+
filing['citation'] = filing_to_citation(filing)
|
71
|
+
end
|
72
|
+
|
50
73
|
if after_scrape
|
51
74
|
after_scrape.call(filings)
|
52
75
|
end
|
@@ -54,25 +77,6 @@ module ECFS
|
|
54
77
|
return filings, total
|
55
78
|
end
|
56
79
|
|
57
|
-
def filing_to_citation(filing)
|
58
|
-
patterns = {
|
59
|
-
"COMMENT" => "Comments",
|
60
|
-
"REPLY TO COMMENTS" => "Reply Comments",
|
61
|
-
"NOTICE OF EXPARTE" => "Ex Parte Letter"
|
62
|
-
}
|
63
|
-
|
64
|
-
case filing["type_of_filing"]
|
65
|
-
when "COMMENT"
|
66
|
-
return "Comments of #{filing['name_of_filer']}"
|
67
|
-
when "REPLY TO COMMENTS"
|
68
|
-
return "Reply Comments of #{filing['name_of_filer']}"
|
69
|
-
when "NOTICE OF EXPARTE"
|
70
|
-
return "#{filing['name_of_filer']} Ex Parte Letter"
|
71
|
-
else
|
72
|
-
return "#{filing["type_of_filing"].downcase.capitalize} of #{filing['name_of_filer']}"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
80
|
def get
|
77
81
|
url = "http://apps.fcc.gov/ecfs/solr/search?sort=dateRcpt&proceeding=#{@docket_number}&dir=asc&start=0"
|
78
82
|
filings = []
|
@@ -87,10 +91,6 @@ module ECFS
|
|
87
91
|
pages.each do |page|
|
88
92
|
filings.concat filings_from_docket_number(@docket_number, page, @received_min_date, @after_scrape)[0]
|
89
93
|
end
|
90
|
-
|
91
|
-
filings.each do |filing|
|
92
|
-
filing['citation'] = filing_to_citation(filing)
|
93
|
-
end
|
94
94
|
|
95
95
|
filings
|
96
96
|
end
|
data/lib/ecfs/version.rb
CHANGED
data/test/test_solr_scrape.rb
CHANGED
@@ -26,6 +26,7 @@ class TestSolrScrape < MiniTest::Unit::TestCase
|
|
26
26
|
assert filings.first.is_a?(Hash)
|
27
27
|
assert filings.first.has_key?('docket_number')
|
28
28
|
assert filings.first.has_key?('citation')
|
29
|
+
assert filings.first
|
29
30
|
|
30
31
|
filing_date = DateTime.strptime(filings.first['date_received'], "%m/%d/%Y")
|
31
32
|
min_date = DateTime.strptime('11/28/14', "%m/%d/%Y")
|