Class: AccessTokenWrapper::Base
- Inherits:
-
Object
- Object
- AccessTokenWrapper::Base
- Defined in:
- lib/access_token_wrapper/base.rb
Direct Known Subclasses
Constant Summary collapse
- EXPIRY_GRACE_SEC =
30
Instance Attribute Summary collapse
-
#raw_token ⇒ Object
readonly
Returns the value of attribute raw_token.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(raw_token, &callback) ⇒ AccessTokenWrapper::Base
constructor
This is the core functionality.
Constructor Details
#initialize(raw_token, &callback) ⇒ AccessTokenWrapper::Base
This is the core functionality
27 28 29 30 |
# File 'lib/access_token_wrapper/base.rb', line 27 def initialize(raw_token, &callback) @raw_token = raw_token @callback = callback end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/access_token_wrapper/base.rb', line 34 def method_missing(method_name, *args, &block) refresh_token! if token_expiring? @raw_token.send(method_name, *args, &block) rescue OAuth2::Error => exception if non_refreshable_exception?(exception) raise else refresh_token!(exception) @raw_token.send(method_name, *args, &block) end end |
Instance Attribute Details
#raw_token ⇒ Object (readonly)
Returns the value of attribute raw_token.
11 12 13 |
# File 'lib/access_token_wrapper/base.rb', line 11 def raw_token @raw_token end |
Instance Method Details
#config ⇒ Object
7 8 9 |
# File 'lib/access_token_wrapper/base.rb', line 7 def config AccessTokenWrapper.configuration end |