Class: SabreDevStudio::Flight::Shop::OutboundFlight
- Inherits:
-
Object
- Object
- SabreDevStudio::Flight::Shop::OutboundFlight
- Defined in:
- lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#flight_uuid ⇒ Object
readonly
Returns the value of attribute flight_uuid.
-
#inbounds ⇒ Object
readonly
Returns the value of attribute inbounds.
-
#max_inbound_duration ⇒ Object
readonly
Returns the value of attribute max_inbound_duration.
-
#max_price ⇒ Object
readonly
Returns the value of attribute max_price.
-
#min_inbound_duration ⇒ Object
readonly
Returns the value of attribute min_inbound_duration.
-
#min_price ⇒ Object
readonly
Returns the value of attribute min_price.
Instance Method Summary collapse
- #add_inbound_flight(flight, price) ⇒ Object
-
#initialize(flight, price) ⇒ OutboundFlight
constructor
A new instance of OutboundFlight.
- #to_hash ⇒ Object
Constructor Details
#initialize(flight, price) ⇒ OutboundFlight
Returns a new instance of OutboundFlight.
182 183 184 185 186 187 188 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 182 def initialize(flight, price) @flight_uuid = flight.sha @min_price = @max_price = price @inbounds = [] @duration = flight.duration @min_inbound_duration = @max_inbound_duration = nil end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def duration @duration end |
#flight_uuid ⇒ Object (readonly)
Returns the value of attribute flight_uuid.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def flight_uuid @flight_uuid end |
#inbounds ⇒ Object (readonly)
Returns the value of attribute inbounds.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def inbounds @inbounds end |
#max_inbound_duration ⇒ Object (readonly)
Returns the value of attribute max_inbound_duration.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def max_inbound_duration @max_inbound_duration end |
#max_price ⇒ Object (readonly)
Returns the value of attribute max_price.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def max_price @max_price end |
#min_inbound_duration ⇒ Object (readonly)
Returns the value of attribute min_inbound_duration.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def min_inbound_duration @min_inbound_duration end |
#min_price ⇒ Object (readonly)
Returns the value of attribute min_price.
179 180 181 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 179 def min_price @min_price end |
Instance Method Details
#add_inbound_flight(flight, price) ⇒ Object
190 191 192 193 194 195 196 197 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 190 def add_inbound_flight(flight, price) set_min_price(price) set_inbound_duration(flight.duration) @inbounds << { flight_uuid: flight.sha, price: price } end |
#to_hash ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/sabre_dev_studio-flight/shop/streamlined_itineraries.rb', line 199 def to_hash { flight_uuid: flight_uuid, min_price: min_price, max_price: max_price, duration: duration, min_inbound_duration: min_inbound_duration, max_inbound_duration: max_inbound_duration, inbounds: inbounds.uniq } end |