Class: Sesame::Client
- Inherits:
-
Object
show all
- Includes:
- Api
- Defined in:
- lib/sesame/client.rb
Constant Summary
Constants included
from Api
Api::ENDPOINT_URL
Instance Method Summary
collapse
Methods included from Api
#auth_token, #authorized?, #call, #client, #control_sesame, #get, #get_sesame, #get_sesames, #login, #parse_response, #post
Constructor Details
#initialize(email:, password:) ⇒ Client
Returns a new instance of Client.
5
6
7
8
|
# File 'lib/sesame/client.rb', line 5
def initialize(email:, password:)
login(email: email, password: password)
@email = email
end
|
Instance Method Details
#inspect ⇒ Object
20
21
22
|
# File 'lib/sesame/client.rb', line 20
def inspect
%(#<#{self.class.name}:#{format('0x%.14x', (object_id << 1))} user: #{@email}>)
end
|
#sesame(device_id:) ⇒ Object
16
17
18
|
# File 'lib/sesame/client.rb', line 16
def sesame(device_id:)
Sesame.new('device_id' => device_id).auth_token(@auth_token).refresh!
end
|
#sesames ⇒ Object
10
11
12
13
14
|
# File 'lib/sesame/client.rb', line 10
def sesames
get_sesames['sesames'].collect do |sesame_attrs|
Sesame.new(sesame_attrs).auth_token(@auth_token)
end
end
|