Class: Fakturoid::Oauth::AccessTokenService
- Inherits:
-
Object
- Object
- Fakturoid::Oauth::AccessTokenService
- Defined in:
- lib/fakturoid/oauth/access_token_service.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#oauth ⇒ Object
readonly
Returns the value of attribute oauth.
Instance Method Summary collapse
-
#initialize(oauth) ⇒ AccessTokenService
constructor
A new instance of AccessTokenService.
- #perform_request(method, path, params) ⇒ Object
Constructor Details
#initialize(oauth) ⇒ AccessTokenService
Returns a new instance of AccessTokenService.
8 9 10 11 |
# File 'lib/fakturoid/oauth/access_token_service.rb', line 8 def initialize(oauth) @oauth = oauth @client = oauth.client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/fakturoid/oauth/access_token_service.rb', line 6 def client @client end |
#oauth ⇒ Object (readonly)
Returns the value of attribute oauth.
6 7 8 |
# File 'lib/fakturoid/oauth/access_token_service.rb', line 6 def oauth @oauth end |
Instance Method Details
#perform_request(method, path, params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fakturoid/oauth/access_token_service.rb', line 13 def perform_request(method, path, params) check_access_token fetch_access_token if client.config.credentials.access_token_expired? retried = false begin Request::Api.new(method, path, client).call(params) rescue AuthenticationError raise if retried retried = true fetch_access_token retry end end |