Module: TelphinApi::Authorization
- Included in:
- TelphinApi
- Defined in:
- lib/telphin_api/authorization.rb
Overview
Note:
TelphinApi::Authorization
extends TelphinApi
so these methods should be called from the latter.
A module containing the methods for authorization.
Constant Summary collapse
- OPTIONS =
Authorization options.
{ client: { token_url: '/oauth/token.php' }, client_credentials: { 'auth_scheme' => 'request_body' } }
Instance Method Summary collapse
-
#authorization_url ⇒ Object
Not used for this strategy.
-
#authorize(options = {}) ⇒ TelphinApi::Client
Authorization (getting the access token and building a
TelphinApi::Client
with it).
Instance Method Details
#authorization_url ⇒ Object
Not used for this strategy
19 20 21 |
# File 'lib/telphin_api/authorization.rb', line 19 def fail(NotImplementedError, 'The authorization endpoint is not used in this strategy') end |
#authorize(options = {}) ⇒ TelphinApi::Client
Authorization (getting the access token and building a TelphinApi::Client
with it).
26 27 28 29 30 31 |
# File 'lib/telphin_api/authorization.rb', line 26 def ( = {}) [:client_id] ||= TelphinApi.app_key [:client_secret] ||= TelphinApi.app_secret token = client.client_credentials.get_token(, OPTIONS[:client_credentials].dup) Client.new(token) end |