Class: CarvoyantAPI::Vehicle

Inherits:
Base
  • Object
show all
Defined in:
lib/carvoyant_api/resources/vehicle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timestampObject (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
  @last_running_timestamp
end

#last_waypointObject (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

Returns:

  • (Boolean)


30
31
32
# File 'lib/carvoyant_api/resources/vehicle.rb', line 30

def running?
  running == 'true'
end