Class: WalmartApIs::ClientRegistrationResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/client_registration_response.rb

Overview

RFC 7591 ยง3.2.1 registration response.

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:, redirect_uris:, token_endpoint_auth_method:, client_id_issued_at: SKIP, client_secret: SKIP, client_secret_expires_at: SKIP, grant_types: SKIP, client_name: SKIP, scope: SKIP, additional_properties: nil) ⇒ ClientRegistrationResponse

Returns a new instance of ClientRegistrationResponse.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 80

def initialize(client_id:, redirect_uris:, token_endpoint_auth_method:,
               client_id_issued_at: SKIP, client_secret: SKIP,
               client_secret_expires_at: SKIP, grant_types: SKIP,
               client_name: SKIP, scope: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id
  @client_id_issued_at = client_id_issued_at unless client_id_issued_at == SKIP
  @client_secret = client_secret unless client_secret == SKIP
  @client_secret_expires_at = client_secret_expires_at unless client_secret_expires_at == SKIP
  @redirect_uris = redirect_uris
  @token_endpoint_auth_method = token_endpoint_auth_method
  @grant_types = grant_types unless grant_types == SKIP
  @client_name = client_name unless client_name == SKIP
  @scope = scope unless scope == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#client_idString

Issued client identifier.

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 14

def client_id
  @client_id
end

#client_id_issued_atInteger

Issue time (Unix epoch seconds).

Returns:

  • (Integer)


18
19
20
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 18

def client_id_issued_at
  @client_id_issued_at
end

#client_nameString

Registered client name.

Returns:

  • (String)


42
43
44
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 42

def client_name
  @client_name
end

#client_secretString

Issued only for confidential clients. Treat as a secret; never log.

Returns:

  • (String)


22
23
24
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 22

def client_secret
  @client_secret
end

#client_secret_expires_atInteger

Secret expiry (Unix epoch seconds); 0 = never. Absent for public clients.

Returns:

  • (Integer)


26
27
28
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 26

def client_secret_expires_at
  @client_secret_expires_at
end

#grant_typesArray[String]

Registered grant types.

Returns:

  • (Array[String])


38
39
40
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 38

def grant_types
  @grant_types
end

#redirect_urisArray[String]

Registered callback URIs.

Returns:

  • (Array[String])


30
31
32
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 30

def redirect_uris
  @redirect_uris
end

#scopeString

Registered scopes.

Returns:

  • (String)


46
47
48
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 46

def scope
  @scope
end

#token_endpoint_auth_methodString

The registered client authentication method.

Returns:

  • (String)


34
35
36
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 34

def token_endpoint_auth_method
  @token_endpoint_auth_method
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_id = hash.key?('client_id') ? hash['client_id'] : nil
  redirect_uris = hash.key?('redirect_uris') ? hash['redirect_uris'] : nil
  token_endpoint_auth_method =
    hash.key?('token_endpoint_auth_method') ? hash['token_endpoint_auth_method'] : nil
  client_id_issued_at =
    hash.key?('client_id_issued_at') ? hash['client_id_issued_at'] : SKIP
  client_secret = hash.key?('client_secret') ? hash['client_secret'] : SKIP
  client_secret_expires_at =
    hash.key?('client_secret_expires_at') ? hash['client_secret_expires_at'] : SKIP
  grant_types = hash.key?('grant_types') ? hash['grant_types'] : SKIP
  client_name = hash.key?('client_name') ? hash['client_name'] : SKIP
  scope = hash.key?('scope') ? hash['scope'] : SKIP

  # 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.
  ClientRegistrationResponse.new(client_id: client_id,
                                 redirect_uris: redirect_uris,
                                 token_endpoint_auth_method: token_endpoint_auth_method,
                                 client_id_issued_at: client_id_issued_at,
                                 client_secret: client_secret,
                                 client_secret_expires_at: client_secret_expires_at,
                                 grant_types: grant_types,
                                 client_name: client_name,
                                 scope: scope,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['client_id_issued_at'] = 'client_id_issued_at'
  @_hash['client_secret'] = 'client_secret'
  @_hash['client_secret_expires_at'] = 'client_secret_expires_at'
  @_hash['redirect_uris'] = 'redirect_uris'
  @_hash['token_endpoint_auth_method'] = 'token_endpoint_auth_method'
  @_hash['grant_types'] = 'grant_types'
  @_hash['client_name'] = 'client_name'
  @_hash['scope'] = 'scope'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 64

def self.optionals
  %w[
    client_id_issued_at
    client_secret
    client_secret_expires_at
    grant_types
    client_name
    scope
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
156
157
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 148

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

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
144
145
# File 'lib/walmart_ap_is/models/client_registration_response.rb', line 138

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