Class: Aspera::OAuth::Generic

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

Overview

Generic token creator

Instance Attribute Summary

Attributes inherited from Base

#scope

Instance Method Summary collapse

Methods inherited from Base

#create_token_call, #optional_scope_client_id, #token

Constructor Details

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

Returns a new instance of Generic.



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

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

Instance Method Details

#create_tokenObject



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

def create_token
  return create_token_call(optional_scope_client_id.merge(@create_params))
end