Class: Skyscanner::RouteInfo
- Inherits:
-
Object
- Object
- Skyscanner::RouteInfo
- Defined in:
- lib/movlog/routes.rb
Overview
Route info
Instance Attribute Summary collapse
-
#carriers ⇒ Object
readonly
Returns the value of attribute carriers.
-
#places ⇒ Object
readonly
Returns the value of attribute places.
-
#quotes ⇒ Object
readonly
Returns the value of attribute quotes.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ RouteInfo
constructor
A new instance of RouteInfo.
- #parse_flights ⇒ Object
Constructor Details
#initialize(data) ⇒ RouteInfo
Returns a new instance of RouteInfo.
9 10 11 |
# File 'lib/movlog/routes.rb', line 9 def initialize(data) load_data(data) end |
Instance Attribute Details
#carriers ⇒ Object (readonly)
Returns the value of attribute carriers.
7 8 9 |
# File 'lib/movlog/routes.rb', line 7 def carriers @carriers end |
#places ⇒ Object (readonly)
Returns the value of attribute places.
7 8 9 |
# File 'lib/movlog/routes.rb', line 7 def places @places end |
#quotes ⇒ Object (readonly)
Returns the value of attribute quotes.
7 8 9 |
# File 'lib/movlog/routes.rb', line 7 def quotes @quotes end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
7 8 9 |
# File 'lib/movlog/routes.rb', line 7 def routes @routes end |
Class Method Details
.find(meta) ⇒ Object
13 14 15 16 |
# File 'lib/movlog/routes.rb', line 13 def self.find() data = SkyscannerApi.routes_info() new(data) end |
Instance Method Details
#parse_flights ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/movlog/routes.rb', line 18 def parse_flights @quotes.map do |quo| data = { min_price: quo['MinPrice'], direct: quo['Direct'], carriers: get_carriers(quo['OutboundLeg']['CarrierIds']), origin: get_place(quo['OutboundLeg']['OriginId']), destination: get_place(quo['OutboundLeg']['DestinationId']), date: quo['OutboundLeg']['DepartureDate'] } Flight.new(data) end end |