Class: VfrUtils::NOTAM

Inherits:
BaseService show all
Defined in:
lib/vfr_utils/notam.rb

Constant Summary collapse

URL =
'https://www.notams.faa.gov/dinsQueryWeb/queryRetrievalMapAction.do'

Class Method Summary collapse

Methods inherited from BaseService

get, inherited

Class Method Details

.get_one(icao_code) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vfr_utils/notam.rb', line 13

def get_one(icao_code)
  ret = []
  return cache.get("notam_#{icao_code}") do
    html = fetch_from_web(icao_code)
    html_doc = Nokogiri::HTML(html)
    html_doc.xpath("//td[@class='textBlack12']/pre").map(&:text).each do |raw_notam|
      ret << parse(raw_notam)
    end
    ret
  end
end