Class: Mercedes::Client

Inherits:
Object
  • Object
show all
Includes:
Charge, Door, Fuel, Location, Odometer, Tire, Vehicle
Defined in:
lib/mercedes/client.rb,
lib/mercedes/client/door.rb,
lib/mercedes/client/fuel.rb,
lib/mercedes/client/tire.rb,
lib/mercedes/client/charge.rb,
lib/mercedes/client/vehicle.rb,
lib/mercedes/client/location.rb,
lib/mercedes/client/odometer.rb

Defined Under Namespace

Modules: Charge, Door, Fuel, Location, Odometer, Tire, Vehicle

Constant Summary collapse

CarNotAvailable =
Class.new(RuntimeError)
NotFound =
Class.new(RuntimeError)
ServerError =
Class.new(RuntimeError)
Unauthorized =
Class.new(RuntimeError)
BASE_URL =
'https://api.mercedes-benz.com/experimental/connectedvehicle/v1/'
TIMEOUT =
10

Instance Method Summary collapse

Methods included from Vehicle

#vehicle, #vehicles

Methods included from Tire

#tires

Methods included from Odometer

#odometer

Methods included from Location

#location

Methods included from Fuel

#fuel

Methods included from Door

#doors, #lock_doors, #unlock_doors

Methods included from Charge

#charge

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



31
32
33
34
35
36
37
# File 'lib/mercedes/client.rb', line 31

def initialize(options = {})
  Configurable::OPTIONS.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Mercedes.send(key))
  end

  http_client.base_url = BASE_URL
end