Class: Ecobee::Register
- Inherits:
-
Object
- Object
- Ecobee::Register
- Defined in:
- lib/ecobee/register.rb
Instance Attribute Summary collapse
-
#expire ⇒ Object
readonly
Returns the value of attribute expire.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(app_key: nil, http: nil, scope: DEFAULT_SCOPE) ⇒ Register
constructor
A new instance of Register.
- #interval ⇒ Object
- #pin ⇒ Object
- #scope ⇒ Object
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
#expire ⇒ Object (readonly)
Returns the value of attribute expire.
4 5 6 |
# File 'lib/ecobee/register.rb', line 4 def expire @expire end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/ecobee/register.rb', line 4 def result @result end |
Instance Method Details
#code ⇒ Object
15 16 17 |
# File 'lib/ecobee/register.rb', line 15 def code @result['code'] end |
#interval ⇒ Object
19 20 21 |
# File 'lib/ecobee/register.rb', line 19 def interval @result['interval'] end |
#pin ⇒ Object
23 24 25 |
# File 'lib/ecobee/register.rb', line 23 def pin @result['ecobeePin'] end |
#scope ⇒ Object
27 28 29 |
# File 'lib/ecobee/register.rb', line 27 def scope @result['scope'] end |