Sha256: b17b1408bcc163bf1b81f412845464c49248dd5d3fd8efe3dd6c437ba35bfeb1
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
module Notams class NotamFetcher require 'nokogiri' require 'open-uri' attr_accessor :icao, :obj_list, :notams, :string_notams def initialize(icao, args = nil) @icao = icao process_arguments(args) if args.class == Hash @notams = []; @string_notams = [] notams_object_list notams_string_list end def raw_list Nokogiri::HTML(open("https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId=#{@icao}&actionType=notamRetrievalByICAOs")) end def fetch @obj_list == true ? @notams : @string_notams end private def notams_string_list @notams.each {|n| @string_notams << n.to_s} end def notams_object_list raw_list.css("pre").each {|n| @notams << Notam.new(n.text)} end def process_arguments(args) args[:objects] == true ? @obj_list = true : @obj_list = false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notams-0.2.0 | lib/notams/notam_fetcher.rb |