Class: CarvoyantAPI::Vehicle
- Defined in:
- lib/carvoyant_api/resources/vehicle.rb
Instance Attribute Summary collapse
-
#last_running_timestamp ⇒ Object
readonly
Returns the value of attribute last_running_timestamp.
-
#last_waypoint ⇒ Object
readonly
Returns the value of attribute last_waypoint.
Instance Method Summary collapse
-
#initialize(attributes = {}, persisted = false) ⇒ Vehicle
constructor
A new instance of Vehicle.
- #running? ⇒ Boolean
Methods inherited from Base
activate_session, collection_path, element_path, #errors, headers, #save, #update
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ Vehicle
Returns a new instance of Vehicle.
22 23 24 25 26 27 28 |
# File 'lib/carvoyant_api/resources/vehicle.rb', line 22 def initialize(attributes = {}, persisted = false) super self.attributes['deviceId'] ||= '' self.attributes['label'] ||= '' @last_waypoint = Waypoint.new(lastWaypoint.attributes) if lastWaypoint @last_running_timestamp = Time.parse(lastRunningTimestamp) if lastRunningTimestamp end |
Instance Attribute Details
#last_running_timestamp ⇒ Object (readonly)
Returns the value of attribute last_running_timestamp.
14 15 16 |
# File 'lib/carvoyant_api/resources/vehicle.rb', line 14 def @last_running_timestamp end |
#last_waypoint ⇒ Object (readonly)
Returns the value of attribute last_waypoint.
14 15 16 |
# File 'lib/carvoyant_api/resources/vehicle.rb', line 14 def last_waypoint @last_waypoint end |
Instance Method Details
#running? ⇒ Boolean
30 31 32 |
# File 'lib/carvoyant_api/resources/vehicle.rb', line 30 def running? running == 'true' end |