Class: TeslaAPI::DriveState
Overview
Data defining the driving state of the the vehicle
Instance Attribute Summary collapse
-
#gps_timestamp ⇒ Object
readonly
Time when GPS data was recorded.
Instance Method Summary collapse
-
#heading ⇒ Integer
Compass heading (0 to 360) degrees.
-
#initialize(data) ⇒ DriveState
constructor
initialize.
-
#latitude ⇒ Float
Lattitude of vehicle.
-
#longitude ⇒ Float
Longitude of vehicle.
-
#shift_state ⇒ Object
Unknown.
-
#speed ⇒ Object
Vehicle speed (units?).
Methods inherited from Data
#inspect, #ivar_from_data, #method_missing, #respond_to_missing?
Constructor Details
#initialize(data) ⇒ DriveState
initialize
28 29 30 31 32 33 34 35 |
# File 'lib/tesla-api/drive_state.rb', line 28 def initialize(data) ivar_from_data("shift_state", "shift_state", data) ivar_from_data("speed", "speed", data) ivar_from_data("latitude", "latitude", data) ivar_from_data("longitude", "longitude", data) ivar_from_data("heading", "heading", data) @gps_timestamp = Time.at(data["gps_as_of"]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TeslaAPI::Data
Instance Attribute Details
#gps_timestamp ⇒ Object (readonly)
Time when GPS data was recorded
5 6 7 |
# File 'lib/tesla-api/drive_state.rb', line 5 def @gps_timestamp end |
Instance Method Details
#heading ⇒ Integer
Returns Compass heading (0 to 360) degrees.
|
# File 'lib/tesla-api/drive_state.rb', line 23
|
#latitude ⇒ Float
Returns Lattitude of vehicle.
|
# File 'lib/tesla-api/drive_state.rb', line 15
|
#longitude ⇒ Float
Returns Longitude of vehicle.
|
# File 'lib/tesla-api/drive_state.rb', line 19
|
#shift_state ⇒ Object
Unknown
|
# File 'lib/tesla-api/drive_state.rb', line 7
|
#speed ⇒ Object
Vehicle speed (units?)
|
# File 'lib/tesla-api/drive_state.rb', line 11
|