class BMWConnectedDrive::Vehicle
Constants
- SERVICES
Attributes
api[R]
vehicle[R]
Public Class Methods
new(api, vehicle)
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 29 def initialize(api, vehicle) @api = api @vehicle = vehicle end
Public Instance Methods
all_trips()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 42 def all_trips api.get("/v1/user/vehicles/#{vehicle['vin']}/statistics/allTrips")["allTrips"] end
charging_profile()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 46 def charging_profile api.get("/v1/user/vehicles/#{vehicle['vin']}/chargingprofile")["weeklyPlanner"] end
destinations()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 50 def destinations api.get("/v1/user/vehicles/#{vehicle['vin']}/destinations")["destinations"] end
execute_service(service_type, secret_knowledge=nil)
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 58 def execute_service(service_type, secret_knowledge=nil) responses = [] if SERVICES.include? service_type response = api.post( "/v1/user/vehicles/#{vehicle['vin']}/executeService", body: { "serviceType" => service_type, "secretKnowledge" => secret_knowledge } ) status = response["executionStatus"]["status"] responses << response["executionStatus"] while ["INITIATED","PENDING"].include? status do response = api.get("/v1/user/vehicles/#{vehicle['vin']}/serviceExecutionStatus?serviceType=#{service_type}") status = response["executionStatus"]["status"] responses << response["executionStatus"] end end responses end
last_trip()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 38 def last_trip api.get("/v1/user/vehicles/#{vehicle['vin']}/statistics/lastTrip")["lastTrip"] end
range_map()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 54 def range_map api.get("/v1/user/vehicles/#{vehicle['vin']}/rangemap")["rangemap"] end
status()
click to toggle source
# File lib/bmw-connected-drive/vehicle.rb, line 34 def status api.get("/v1/user/vehicles/#{vehicle['vin']}/status")["vehicleStatus"] end