Class: Oauth2ApiClient
- Inherits:
-
Object
- Object
- Oauth2ApiClient
- Defined in:
- lib/oauth2_api_client.rb,
lib/oauth2_api_client/version.rb,
lib/oauth2_api_client/response_error.rb,
lib/oauth2_api_client/token_provider.rb
Overview
The Oauth2ApiClient class is a client wrapped around the oauth2 and http-rb gem to interact with APIs using oauth2 for authentication with automatic token caching and renewal.
Defined Under Namespace
Classes: ResponseError, TokenProvider
Constant Summary collapse
- VERSION =
"3.1.0"
Instance Method Summary collapse
-
#initialize(base_url:, base_request: HTTP, token:) ⇒ Oauth2ApiClient
constructor
Creates a new Oauth2ApiClient.
-
#token ⇒ String
Returns a oauth2 token to use for authentication.
Constructor Details
#initialize(base_url:, base_request: HTTP, token:) ⇒ Oauth2ApiClient
Creates a new Oauth2ApiClient
44 45 46 47 48 |
# File 'lib/oauth2_api_client.rb', line 44 def initialize(base_url:, base_request: HTTP, token:) @base_url = base_url @token = token @request = base_request end |
Instance Method Details
#token ⇒ String
Returns a oauth2 token to use for authentication
54 55 56 |
# File 'lib/oauth2_api_client.rb', line 54 def token @token.respond_to?(:to_str) ? @token.to_str : @token.token end |