Class: Aspera::OAuth::Generic

Inherits:
Base
  • Object
show all
Defined in:
lib/aspera/oauth/client/generic.rb

Overview

Generic token creator

Instance Attribute Summary

Attributes inherited from Base

#api, #params, #path_token

Instance Method Summary collapse

Methods inherited from Base

absolute_url?, #authorization, #base_parameters, client_id_digest, #create_token_base, #endpoint_api, #endpoint_url, #renew_token, #renewed_authorization, #token

Constructor Details

#initialize(grant_type:, response_type: nil, apikey: nil, receiver_client_ids: nil, **base_params) ⇒ Generic

Returns a new instance of Generic.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/aspera/oauth/client/generic.rb', line 13

def initialize(
  grant_type:,
  response_type: nil,
  apikey: nil,
  receiver_client_ids: nil,
  **base_params
)
  super(**base_params, cache_ids: [grant_type&.split(':')&.last, apikey, response_type])
  @create_params = {
    grant_type: grant_type
  }
  @create_params[:response_type] = response_type unless response_type.nil?
  @create_params[:apikey] = apikey unless apikey.nil?
  @create_params[:receiver_client_ids] = receiver_client_ids unless receiver_client_ids.nil?
end

Instance Method Details

#create_token ⇒ Object



29
30
31
# File 'lib/aspera/oauth/client/generic.rb', line 29

def create_token
  create_token_base(**@create_params)
end