Class: Vatbook::BookFetcher
- Inherits:
-
Object
- Object
- Vatbook::BookFetcher
- Defined in:
- lib/vatbook/book_fetcher.rb
Instance Attribute Summary collapse
-
#atc_bookings ⇒ Object
Returns the value of attribute atc_bookings.
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#enroute ⇒ Object
Returns the value of attribute enroute.
-
#fir ⇒ Object
Returns the value of attribute fir.
-
#pilot_bookings ⇒ Object
Returns the value of attribute pilot_bookings.
Instance Method Summary collapse
- #atcs_count ⇒ Object
- #fetch ⇒ Object
-
#initialize(fir, args = nil) ⇒ BookFetcher
constructor
A new instance of BookFetcher.
- #pilots_count ⇒ Object
- #raw_list ⇒ Object
Constructor Details
#initialize(fir, args = nil) ⇒ BookFetcher
Returns a new instance of BookFetcher.
9 10 11 12 13 14 15 16 17 |
# File 'lib/vatbook/book_fetcher.rb', line 9 def initialize(fir, args = nil) @fir = fir.upcase @enroute = true process_arguments(args) if args.class == Hash @atc_bookings = []; @pilot_bookings = []; @doc = raw_list atcs pilots end |
Instance Attribute Details
#atc_bookings ⇒ Object
Returns the value of attribute atc_bookings.
7 8 9 |
# File 'lib/vatbook/book_fetcher.rb', line 7 def atc_bookings @atc_bookings end |
#doc ⇒ Object
Returns the value of attribute doc.
7 8 9 |
# File 'lib/vatbook/book_fetcher.rb', line 7 def doc @doc end |
#enroute ⇒ Object
Returns the value of attribute enroute.
7 8 9 |
# File 'lib/vatbook/book_fetcher.rb', line 7 def enroute @enroute end |
#fir ⇒ Object
Returns the value of attribute fir.
7 8 9 |
# File 'lib/vatbook/book_fetcher.rb', line 7 def fir @fir end |
#pilot_bookings ⇒ Object
Returns the value of attribute pilot_bookings.
7 8 9 |
# File 'lib/vatbook/book_fetcher.rb', line 7 def pilot_bookings @pilot_bookings end |
Instance Method Details
#atcs_count ⇒ Object
35 36 37 |
# File 'lib/vatbook/book_fetcher.rb', line 35 def atcs_count @doc.css("atcs booking").count end |
#fetch ⇒ Object
23 24 25 |
# File 'lib/vatbook/book_fetcher.rb', line 23 def fetch {:atc => atc_bookings, :pilots => pilot_bookings} end |
#pilots_count ⇒ Object
39 40 41 |
# File 'lib/vatbook/book_fetcher.rb', line 39 def pilots_count @doc.css("pilots booking").count end |
#raw_list ⇒ Object
19 20 21 |
# File 'lib/vatbook/book_fetcher.rb', line 19 def raw_list Nokogiri::XML(open("http://vatbook.euroutepro.com/xml2.php?fir=#{@fir}")) end |