Class: MyTado::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/my_tado/client.rb

Overview

The main object from where everything else happens

Constant Summary collapse

IMPLEMENTED_ENDPOINTS =
%i[me day_report home presence weather zones zone_state].freeze

Instance Method Summary collapse

Constructor Details

#initialize(credentials_source) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/my_tado/client.rb', line 10

def initialize(credentials_source)
  @credentials_source = credentials_source
end

Instance Method Details

#access_tokenObject



18
19
20
# File 'lib/my_tado/client.rb', line 18

def access_token
  oauth_client.access_token
end

#credentialsObject



14
15
16
# File 'lib/my_tado/client.rb', line 14

def credentials
  @credentials ||= CredentialGetter.new(@credentials_source)
end

#home_idObject



22
23
24
# File 'lib/my_tado/client.rb', line 22

def home_id
  @home_id ||= credentials.home_id || me["homeId"]
end