Class: MassHighways::Event
- Inherits:
-
Object
- Object
- MassHighways::Event
- Defined in:
- lib/mass_highways/event.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#event_category ⇒ Object
Returns the value of attribute event_category.
-
#event_created_date ⇒ Object
Returns the value of attribute event_created_date.
-
#event_end_date ⇒ Object
Returns the value of attribute event_end_date.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#event_start_date ⇒ Object
Returns the value of attribute event_start_date.
-
#event_status ⇒ Object
Returns the value of attribute event_status.
-
#event_sub_type ⇒ Object
Returns the value of attribute event_sub_type.
-
#event_type ⇒ Object
Returns the value of attribute event_type.
-
#lane_blockage_description ⇒ Object
Returns the value of attribute lane_blockage_description.
-
#last_update ⇒ Object
Returns the value of attribute last_update.
-
#location_description ⇒ Object
Returns the value of attribute location_description.
-
#location_type ⇒ Object
Returns the value of attribute location_type.
-
#primary_latitude ⇒ Object
Returns the value of attribute primary_latitude.
-
#primary_longitude ⇒ Object
Returns the value of attribute primary_longitude.
-
#recurrence_description ⇒ Object
Returns the value of attribute recurrence_description.
-
#roadway_name ⇒ Object
Returns the value of attribute roadway_name.
-
#secondary_latitude ⇒ Object
Returns the value of attribute secondary_latitude.
-
#secondary_longitude ⇒ Object
Returns the value of attribute secondary_longitude.
Class Method Summary collapse
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def direction @direction end |
#event_category ⇒ Object
Returns the value of attribute event_category.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_category @event_category end |
#event_created_date ⇒ Object
Returns the value of attribute event_created_date.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_created_date @event_created_date end |
#event_end_date ⇒ Object
Returns the value of attribute event_end_date.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_end_date @event_end_date end |
#event_id ⇒ Object
Returns the value of attribute event_id.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_id @event_id end |
#event_start_date ⇒ Object
Returns the value of attribute event_start_date.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_start_date @event_start_date end |
#event_status ⇒ Object
Returns the value of attribute event_status.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_status @event_status end |
#event_sub_type ⇒ Object
Returns the value of attribute event_sub_type.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_sub_type @event_sub_type end |
#event_type ⇒ Object
Returns the value of attribute event_type.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def event_type @event_type end |
#lane_blockage_description ⇒ Object
Returns the value of attribute lane_blockage_description.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def lane_blockage_description @lane_blockage_description end |
#last_update ⇒ Object
Returns the value of attribute last_update.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def last_update @last_update end |
#location_description ⇒ Object
Returns the value of attribute location_description.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def location_description @location_description end |
#location_type ⇒ Object
Returns the value of attribute location_type.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def location_type @location_type end |
#primary_latitude ⇒ Object
Returns the value of attribute primary_latitude.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def primary_latitude @primary_latitude end |
#primary_longitude ⇒ Object
Returns the value of attribute primary_longitude.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def primary_longitude @primary_longitude end |
#recurrence_description ⇒ Object
Returns the value of attribute recurrence_description.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def recurrence_description @recurrence_description end |
#roadway_name ⇒ Object
Returns the value of attribute roadway_name.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def roadway_name @roadway_name end |
#secondary_latitude ⇒ Object
Returns the value of attribute secondary_latitude.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def secondary_latitude @secondary_latitude end |
#secondary_longitude ⇒ Object
Returns the value of attribute secondary_longitude.
3 4 5 |
# File 'lib/mass_highways/event.rb', line 3 def secondary_longitude @secondary_longitude end |
Class Method Details
.parse(node) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mass_highways/event.rb', line 9 def self.parse(node) event = self.new event.event_id = node.search('EventId').first.text.to_i event.event_created_date = DateTime.parse node.search('EventCreatedDate').first.text event.event_start_date = DateTime.parse node.search('EventStartDate').first.text end_date = node.search('EventEndDate').first.text event.event_end_date = DateTime.parse end_date unless end_date.empty? event.last_update = DateTime.parse node.search('LastUpdate').first.text event.event_status = node.search('EventStatus').first.text event.event_category = node.search('EventCategory').first.text event.event_type = node.search('EventType').first.text event.event_sub_type = node.search('EventSubType').first.text event.roadway_name = node.search('RoadwayName').first.text event.direction = node.search('Direction').first.text event.location_type = node.search('LocationType').first.text event.primary_latitude = node.search('PrimaryLatitude').first.text.to_f event.primary_longitude = node.search('PrimaryLongitude').first.text.to_f secondary_latitude = node.search('SecondaryLatitude').first.text event.secondary_latitude = secondary_latitude.to_i unless secondary_latitude == 'NaN' secondary_longitude = node.search('SecondaryLongitude').first.text event.secondary_longitude = secondary_longitude.to_i unless secondary_longitude == 'NaN' event.location_description = node.search('LocationDescription').first.text event.lane_blockage_description = node.search('LaneBlockageDescription').first.text event.recurrence_description = node.search('RecurrenceDescription').first.text event end |