Class: NestConnect::GlobalConfig
- Inherits:
-
Object
- Object
- NestConnect::GlobalConfig
- Defined in:
- lib/nest_connect/global_config.rb
Constant Summary collapse
- DEFAULT_PATH =
ENV["HOME"] + '/.nest_connect/config'
- @@path =
nil
Class Method Summary collapse
Instance Method Summary collapse
- #access_token ⇒ Object
- #access_token=(token) ⇒ Object
-
#initialize(store = nil) ⇒ GlobalConfig
constructor
A new instance of GlobalConfig.
Constructor Details
#initialize(store = nil) ⇒ GlobalConfig
Returns a new instance of GlobalConfig.
17 18 19 |
# File 'lib/nest_connect/global_config.rb', line 17 def initialize(store = nil) @store = store || ConfigStore.new(self.class.path) end |
Class Method Details
.path ⇒ Object
13 14 15 |
# File 'lib/nest_connect/global_config.rb', line 13 def self.path @@path || DEFAULT_PATH end |
.path=(new_path) ⇒ Object
9 10 11 |
# File 'lib/nest_connect/global_config.rb', line 9 def self.path=(new_path) @@path = new_path end |
Instance Method Details
#access_token ⇒ Object
21 22 23 |
# File 'lib/nest_connect/global_config.rb', line 21 def access_token @_access_token ||= store[:access_token] || configure_access_token end |
#access_token=(token) ⇒ Object
25 26 27 |
# File 'lib/nest_connect/global_config.rb', line 25 def access_token=(token) store.save(:access_token, token) end |