Class: JetBluePlaneTracker::Travel
- Inherits:
-
Object
- Object
- JetBluePlaneTracker::Travel
- Defined in:
- lib/jetblue_plane_tracker/travel.rb
Instance Attribute Summary collapse
-
#actual_takeoff ⇒ Object
Returns the value of attribute actual_takeoff.
-
#airport ⇒ Object
Returns the value of attribute airport.
-
#gate ⇒ Object
Returns the value of attribute gate.
-
#scheduled_takeoff ⇒ Object
Returns the value of attribute scheduled_takeoff.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#terminal ⇒ Object
Returns the value of attribute terminal.
Instance Method Summary collapse
-
#initialize(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature) ⇒ Travel
constructor
A new instance of Travel.
- #to_json ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature) ⇒ Travel
Returns a new instance of Travel.
5 6 7 8 9 10 11 12 13 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 5 def initialize(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature) super() self.airport = Airport.find_by_iata(Airport.parse_airport_iata(airport)) self.scheduled_takeoff = DateTime.parse(scheduled_takeoff) self.actual_takeoff = DateTime.parse(actual_takeoff) self.terminal = terminal self.gate = gate self.temperature = temperature end |
Instance Attribute Details
#actual_takeoff ⇒ Object
Returns the value of attribute actual_takeoff.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def actual_takeoff @actual_takeoff end |
#airport ⇒ Object
Returns the value of attribute airport.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def airport @airport end |
#gate ⇒ Object
Returns the value of attribute gate.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def gate @gate end |
#scheduled_takeoff ⇒ Object
Returns the value of attribute scheduled_takeoff.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def scheduled_takeoff @scheduled_takeoff end |
#temperature ⇒ Object
Returns the value of attribute temperature.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def temperature @temperature end |
#terminal ⇒ Object
Returns the value of attribute terminal.
3 4 5 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 3 def terminal @terminal end |
Instance Method Details
#to_json ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 19 def to_json { "airport" => self.airport.to_json, "scheduled_takeoff" => self.scheduled_takeoff, "actual_takeoff" => self.actual_takeoff, "terminal" => self.terminal, "gate" => self.gate, "temperature" => self.temperature } end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 15 def to_s "#{type}-> Airport: #{airport.name} Scheduled Take-Off: #{scheduled_takeoff} - Actual Take-Off: #{actual_takeoff} [Terminal: #{terminal}, Gate: #{gate}, Temperature: #{temperature}]" end |
#type ⇒ Object
30 31 32 |
# File 'lib/jetblue_plane_tracker/travel.rb', line 30 def type self.class.name.sub!("JetBluePlaneTracker::", "") end |