Class: Wework::Token::Store
- Inherits:
-
Object
- Object
- Wework::Token::Store
- Defined in:
- lib/wework/token/store.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
Instance Method Summary collapse
- #access_token ⇒ Object
- #expired? ⇒ Boolean
-
#initialize(agent) ⇒ Store
constructor
A new instance of Store.
- #refresh_token ⇒ Object
Constructor Details
#initialize(agent) ⇒ Store
Returns a new instance of Store.
7 8 9 |
# File 'lib/wework/token/store.rb', line 7 def initialize(agent) @agent = agent end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
5 6 7 |
# File 'lib/wework/token/store.rb', line 5 def agent @agent end |
Instance Method Details
#access_token ⇒ Object
11 12 13 |
# File 'lib/wework/token/store.rb', line 11 def access_token refresh_token if expired? end |
#expired? ⇒ Boolean
15 16 17 |
# File 'lib/wework/token/store.rb', line 15 def expired? raise NotImplementedError, "Subclasses must implement a token_expired? method" end |
#refresh_token ⇒ Object
19 20 21 |
# File 'lib/wework/token/store.rb', line 19 def refresh_token agent.request.get 'gettoken', params: {corpid: agent.corp_id, corpsecret: agent.agent_secret} end |