Class: Ecobee::Register

Inherits:
Object
  • Object
show all
Defined in:
lib/ecobee/register.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_key: nil, http: nil, scope: DEFAULT_SCOPE) ⇒ Register

Returns a new instance of Register.



6
7
8
9
10
11
12
13
# File 'lib/ecobee/register.rb', line 6

def initialize(
  app_key: nil,
  http: nil,
  scope: DEFAULT_SCOPE
)
  @result = get_pin(app_key: app_key, http: http, scope: scope)
  @expire = Time.now.to_i + result['expires_in'] * 60
end

Instance Attribute Details

#expireObject (readonly)

Returns the value of attribute expire.



4
5
6
# File 'lib/ecobee/register.rb', line 4

def expire
  @expire
end

#resultObject (readonly)

Returns the value of attribute result.



4
5
6
# File 'lib/ecobee/register.rb', line 4

def result
  @result
end

Instance Method Details

#codeObject



15
16
17
# File 'lib/ecobee/register.rb', line 15

def code
  @result['code']
end

#intervalObject



19
20
21
# File 'lib/ecobee/register.rb', line 19

def interval
  @result['interval']
end

#pinObject



23
24
25
# File 'lib/ecobee/register.rb', line 23

def pin
  @result['ecobeePin']
end

#scopeObject



27
28
29
# File 'lib/ecobee/register.rb', line 27

def scope
  @result['scope']
end