Class: TeslaAPI::ChargeState
Overview
Defines the current charge state of the vehicle
Instance Method Summary collapse
-
#battery_current_flow ⇒ Float
Current flowing into the battery.
-
#battery_percentage ⇒ Integer
Percentage of battery charge.
-
#battery_range_miles ⇒ Float
Rated miles for the current charge.
-
#charge_port_open? ⇒ Boolean
Charge port open state.
-
#charge_rate_miles_per_hour ⇒ Float
Miles of range being added per hour.
-
#charger_actual_amperage ⇒ Integer
Current amperage being drawn into battery.
-
#charger_pilot_amperage ⇒ Integer
Max amperage allowed by the charger.
-
#charger_power ⇒ Integer
Kilowatt of charger (rounded down).
-
#charger_voltage ⇒ Float
Current voltage being used to charge battery.
-
#charging_state ⇒ Object
Charging state (“Complete”, “Charging”).
-
#charging_to_max? ⇒ Boolean
True if currently performing a range charge.
-
#estimated_battry_range_miles ⇒ Float
Range estimated from current driving.
-
#hours_to_full_charge ⇒ Float
Hours remaining until the vehicle is fully charged.
-
#ideal_battery_range_miles ⇒ Float
Ideal range for the current charge.
-
#initialize(data) ⇒ Boolean
constructor
Charging via a Tesla SuperCharger.
-
#supercharging? ⇒ Boolean
Charging via a Tesla SuperCharger.
Methods inherited from Data
#inspect, #ivar_from_data, #method_missing, #respond_to_missing?
Constructor Details
#initialize(data) ⇒ Boolean
Returns charging via a Tesla SuperCharger.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tesla-api/charge_state.rb', line 65 def initialize(data) ivar_from_data("charging_state", "charging_state", data) ivar_from_data("charging_to_max", "charge_to_max_range", data) ivar_from_data("battery_range_miles", "battery_range", data) ivar_from_data("estimated_battry_range_miles", "est_battery_range", data) ivar_from_data("ideal_battery_range_miles", "ideal_battery_range", data) ivar_from_data("battery_percentage", "battery_level", data) ivar_from_data("battery_current_flow", "battery_current", data) ivar_from_data("charger_voltage", "charger_voltage", data) ivar_from_data("charger_pilot_amperage", "charger_pilot_current", data) ivar_from_data("charger_actual_amperage", "charger_actual_current", data) ivar_from_data("charger_power", "charger_power", data) ivar_from_data("hours_to_full_charge", "time_to_full_charge", data) ivar_from_data("charge_rate_miles_per_hour", "charge_rate", data) ivar_from_data("charge_port_open", "charge_port_door_open", data) ivar_from_data("supercharging", "fast_charger_present", data) @charging = charging_state == "Charging" @charge_complete = charging_state == "Complete" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TeslaAPI::Data
Instance Method Details
#battery_current_flow ⇒ Float
Returns Current flowing into the battery.
|
# File 'lib/tesla-api/charge_state.rb', line 29
|
#battery_percentage ⇒ Integer
Returns Percentage of battery charge.
|
# File 'lib/tesla-api/charge_state.rb', line 25
|
#battery_range_miles ⇒ Float
Returns Rated miles for the current charge.
|
# File 'lib/tesla-api/charge_state.rb', line 13
|
#charge_port_open? ⇒ Boolean
Returns charge port open state.
|
# File 'lib/tesla-api/charge_state.rb', line 57
|
#charge_rate_miles_per_hour ⇒ Float
Returns Miles of range being added per hour.
|
# File 'lib/tesla-api/charge_state.rb', line 53
|
#charger_actual_amperage ⇒ Integer
Returns Current amperage being drawn into battery.
|
# File 'lib/tesla-api/charge_state.rb', line 41
|
#charger_pilot_amperage ⇒ Integer
Returns Max amperage allowed by the charger.
|
# File 'lib/tesla-api/charge_state.rb', line 37
|
#charger_power ⇒ Integer
Returns Kilowatt of charger (rounded down).
|
# File 'lib/tesla-api/charge_state.rb', line 45
|
#charger_voltage ⇒ Float
Returns Current voltage being used to charge battery.
|
# File 'lib/tesla-api/charge_state.rb', line 33
|
#charging_state ⇒ Object
Returns Charging state (“Complete”, “Charging”).
|
# File 'lib/tesla-api/charge_state.rb', line 5
|
#charging_to_max? ⇒ Boolean
Returns true if currently performing a range charge.
|
# File 'lib/tesla-api/charge_state.rb', line 9
|
#estimated_battry_range_miles ⇒ Float
Returns Range estimated from current driving.
|
# File 'lib/tesla-api/charge_state.rb', line 17
|
#hours_to_full_charge ⇒ Float
Returns Hours remaining until the vehicle is fully charged.
|
# File 'lib/tesla-api/charge_state.rb', line 49
|
#ideal_battery_range_miles ⇒ Float
Returns Ideal range for the current charge.
|
# File 'lib/tesla-api/charge_state.rb', line 21
|
#supercharging? ⇒ Boolean
Returns charging via a Tesla SuperCharger.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tesla-api/charge_state.rb', line 65 def initialize(data) ivar_from_data("charging_state", "charging_state", data) ivar_from_data("charging_to_max", "charge_to_max_range", data) ivar_from_data("battery_range_miles", "battery_range", data) ivar_from_data("estimated_battry_range_miles", "est_battery_range", data) ivar_from_data("ideal_battery_range_miles", "ideal_battery_range", data) ivar_from_data("battery_percentage", "battery_level", data) ivar_from_data("battery_current_flow", "battery_current", data) ivar_from_data("charger_voltage", "charger_voltage", data) ivar_from_data("charger_pilot_amperage", "charger_pilot_current", data) ivar_from_data("charger_actual_amperage", "charger_actual_current", data) ivar_from_data("charger_power", "charger_power", data) ivar_from_data("hours_to_full_charge", "time_to_full_charge", data) ivar_from_data("charge_rate_miles_per_hour", "charge_rate", data) ivar_from_data("charge_port_open", "charge_port_door_open", data) ivar_from_data("supercharging", "fast_charger_present", data) @charging = charging_state == "Charging" @charge_complete = charging_state == "Complete" end |