Module: ECFS::Proceedings

Defined in:
lib/ecfs.rb

Class Method Summary collapse

Class Method Details

.search(docket: nil) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/ecfs.rb', line 135

def self.search(docket: nil)
  url = "http://apps.fcc.gov/ecfs/proceeding/view?name=#{docket}"
  response = Unirest.get url
  doc = Nokogiri::HTML(response.raw_body)
  table = doc.search('table.dataTable').first
  rows = table.search('div.wwgrp')

  proceeding = {}
  rows.each do |row|
    key = row.search('span')[0].text.strip
    key.gsub!(" ", "")
    key.gsub!(":", "")
    key.downcase!
    value = row.search('span')[1].text.strip
    proceeding[key.to_sym] = value
  end

  proceeding
end