Class: DnaPaymentsPartnerReportingSettlementApIs::AuthTokenRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb

Overview

AuthTokenRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(client_id:, client_secret:, additional_properties: nil) ⇒ AuthTokenRequest

Returns a new instance of AuthTokenRequest.



50
51
52
53
54
55
56
57
58
59
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 50

def initialize(client_id:, client_secret:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @grant_type = 'client_credentials'
  @scope = 'partners_reporting'
  @client_id = client_id
  @client_secret = client_secret
  @additional_properties = additional_properties
end

Instance Attribute Details

#client_idString

Provided to the integrator following successful creation of a test account.

Returns:

  • (String)


23
24
25
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 23

def client_id
  @client_id
end

#client_secretString

Provided to the integrator following successful creation of a test account.

Returns:

  • (String)


28
29
30
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 28

def client_secret
  @client_secret
end

#grant_typeString (readonly)

Authorisation type required to confirm the action required.

Returns:

  • (String)


14
15
16
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 14

def grant_type
  @grant_type
end

#scopeString (readonly)

Scope of the action to be performed with the credentials.

Returns:

  • (String)


18
19
20
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 18

def scope
  @scope
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_id = hash.key?('client_id') ? hash['client_id'] : nil
  client_secret = hash.key?('client_secret') ? hash['client_secret'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  AuthTokenRequest.new(client_id: client_id,
                       client_secret: client_secret,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['grant_type'] = 'grant_type'
  @_hash['scope'] = 'scope'
  @_hash['client_id'] = 'client_id'
  @_hash['client_secret'] = 'client_secret'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 41

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
95
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 90

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} grant_type: #{@grant_type.inspect}, scope: #{@scope.inspect}, client_id:"\
  " #{@client_id.inspect}, client_secret: #{@client_secret.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb', line 83

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} grant_type: #{@grant_type}, scope: #{@scope}, client_id: #{@client_id},"\
  " client_secret: #{@client_secret}, additional_properties: #{@additional_properties}>"
end