Class: FAA::Delay::GroundStop
- Inherits:
-
FAA::Delay
- Object
- FAA::Delay
- FAA::Delay::GroundStop
- Defined in:
- lib/faa/delay/ground_stop.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
Returns the value of attribute end_time.
Attributes inherited from FAA::Delay
Class Method Summary collapse
Instance Attribute Details
#end_time ⇒ Object
Returns the value of attribute end_time.
3 4 5 |
# File 'lib/faa/delay/ground_stop.rb', line 3 def end_time @end_time end |
Class Method Details
.from_xml(xml, updated_at) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/faa/delay/ground_stop.rb', line 5 def self.from_xml(xml, updated_at) delays = [] xml.children.each do |node| delay = new node.children.each do |child| case child.name when 'ARPT' delay.airport_id = child.content.strip when 'Reason' delay.reason = child.content.strip when 'End_Time' updated_at = updated_at.utc end_time = Time.parse(child.content).utc end_time = Time.utc(updated_at.year, updated_at.month, updated_at.day, end_time.hour, end_time.min) end_time = end_time + 60*60*24 if end_time < updated_at delay.end_time = end_time end end delays << delay end delays end |