Class: CyberSourceMergedSpec::AuthenticatedIdentity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/authenticated_identity.rb

Overview

AuthenticatedIdentity 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(data: SKIP, provider: SKIP, id: SKIP, relying_party_id: SKIP, user_authentication_method: SKIP, additional_properties: nil) ⇒ AuthenticatedIdentity

Returns a new instance of AuthenticatedIdentity.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 62

def initialize(data: SKIP, provider: SKIP, id: SKIP, relying_party_id: SKIP,
               user_authentication_method: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @data = data unless data == SKIP
  @provider = provider unless provider == SKIP
  @id = id unless id == SKIP
  @relying_party_id = relying_party_id unless relying_party_id == SKIP
  unless user_authentication_method == SKIP
    @user_authentication_method =
      user_authentication_method
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#dataString

Data related to the authenticated identity. Contains verification payload from the identity provider.

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 15

def data
  @data
end

#idString

Unique identifier for the authenticated identity. A distinctive and non-transparent identifier for correlation purposes.

Returns:

  • (String)


25
26
27
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 25

def id
  @id
end

#providerProvider

Provider of the authenticated identity. Identifies the authentication service or identity provider.

Returns:



20
21
22
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 20

def provider
  @provider
end

#relying_party_idString

Identifier of the relying party that requested the authentication.

Returns:

  • (String)


29
30
31
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 29

def relying_party_id
  @relying_party_id
end

#user_authentication_methodUserAuthenticationMethod

The method used to authenticate the user.



33
34
35
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 33

def user_authentication_method
  @user_authentication_method
end

Class Method Details

.from_element(root) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 107

def self.from_element(root)
  data = XmlUtilities.from_element(root, 'data', String)
  provider = XmlUtilities.from_element(root, 'provider', String)
  id = XmlUtilities.from_element(root, 'id', String)
  relying_party_id = XmlUtilities.from_element(root, 'relyingPartyId',
                                               String)
  user_authentication_method = XmlUtilities.from_element(
    root, 'userAuthenticationMethod', String
  )

  new(data: data,
      provider: provider,
      id: id,
      relying_party_id: relying_party_id,
      user_authentication_method: user_authentication_method,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  data = hash.key?('data') ? hash['data'] : SKIP
  provider = hash.key?('provider') ? hash['provider'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  relying_party_id =
    hash.key?('relyingPartyId') ? hash['relyingPartyId'] : SKIP
  user_authentication_method =
    hash.key?('userAuthenticationMethod') ? hash['userAuthenticationMethod'] : 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.
  AuthenticatedIdentity.new(data: data,
                            provider: provider,
                            id: id,
                            relying_party_id: relying_party_id,
                            user_authentication_method: user_authentication_method,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['data'] = 'data'
  @_hash['provider'] = 'provider'
  @_hash['id'] = 'id'
  @_hash['relying_party_id'] = 'relyingPartyId'
  @_hash['user_authentication_method'] = 'userAuthenticationMethod'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
54
55
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 47

def self.optionals
  %w[
    data
    provider
    id
    relying_party_id
    user_authentication_method
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} data: #{@data.inspect}, provider: #{@provider.inspect}, id: #{@id.inspect},"\
  " relying_party_id: #{@relying_party_id.inspect}, user_authentication_method:"\
  " #{@user_authentication_method.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 142

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} data: #{@data}, provider: #{@provider}, id: #{@id}, relying_party_id:"\
  " #{@relying_party_id}, user_authentication_method: #{@user_authentication_method},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cyber_source_merged_spec/models/authenticated_identity.rb', line 125

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'data', data)
  XmlUtilities.add_as_subelement(doc, root, 'provider', provider)
  XmlUtilities.add_as_subelement(doc, root, 'id', id)
  XmlUtilities.add_as_subelement(doc, root, 'relyingPartyId',
                                 relying_party_id)
  XmlUtilities.add_as_subelement(doc, root, 'userAuthenticationMethod',
                                 user_authentication_method)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end