Class: CyberSourceMergedSpec::SenderInformation2

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

Overview

SenderInformation2 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(account: SKIP, first_name: SKIP, last_name: SKIP, email: SKIP, phone_number: SKIP, country_code: SKIP, create_date: SKIP, postal_code: SKIP, risk_popularity_score: SKIP, additional_properties: nil) ⇒ SenderInformation2

Returns a new instance of SenderInformation2.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 83

def initialize(account: SKIP, first_name: SKIP, last_name: SKIP,
               email: SKIP, phone_number: SKIP, country_code: SKIP,
               create_date: SKIP, postal_code: SKIP,
               risk_popularity_score: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account =  unless  == SKIP
  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @email = email unless email == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @country_code = country_code unless country_code == SKIP
  @create_date = create_date unless create_date == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @risk_popularity_score = risk_popularity_score unless risk_popularity_score == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountAccount14

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 14

def 
  @account
end

#country_codeString

The country code of the sender.

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 34

def country_code
  @country_code
end

#create_dateString

The date when the sender's account was created.

Returns:

  • (String)


38
39
40
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 38

def create_date
  @create_date
end

#emailString

The email address of the sender.

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 26

def email
  @email
end

#first_nameString

The first name of the sender.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 18

def first_name
  @first_name
end

#last_nameString

The last name of the sender.

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 22

def last_name
  @last_name
end

#phone_numberString

The phone number of the sender.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 30

def phone_number
  @phone_number
end

#postal_codeString

The postal code of the sender.

Returns:

  • (String)


42
43
44
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 42

def postal_code
  @postal_code
end

#risk_popularity_scoreString

The risk popularity score of the sender.

Returns:

  • (String)


46
47
48
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 46

def risk_popularity_score
  @risk_popularity_score
end

Class Method Details

.from_element(root) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 138

def self.from_element(root)
   = XmlUtilities.from_element(root, 'Account14', Account14)
  first_name = XmlUtilities.from_element(root, 'firstName', String)
  last_name = XmlUtilities.from_element(root, 'lastName', String)
  email = XmlUtilities.from_element(root, 'email', String)
  phone_number = XmlUtilities.from_element(root, 'phoneNumber', String)
  country_code = XmlUtilities.from_element(root, 'countryCode', String)
  create_date = XmlUtilities.from_element(root, 'createDate', String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)
  risk_popularity_score = XmlUtilities.from_element(root,
                                                    'riskPopularityScore',
                                                    String)

  new(account: ,
      first_name: first_name,
      last_name: last_name,
      email: email,
      phone_number: phone_number,
      country_code: country_code,
      create_date: create_date,
      postal_code: postal_code,
      risk_popularity_score: risk_popularity_score,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
136
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 103

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = Account14.from_hash(hash['account']) if hash['account']
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP
  country_code = hash.key?('countryCode') ? hash['countryCode'] : SKIP
  create_date = hash.key?('createDate') ? hash['createDate'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  risk_popularity_score =
    hash.key?('riskPopularityScore') ? hash['riskPopularityScore'] : 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.
  SenderInformation2.new(account: ,
                         first_name: first_name,
                         last_name: last_name,
                         email: email,
                         phone_number: phone_number,
                         country_code: country_code,
                         create_date: create_date,
                         postal_code: postal_code,
                         risk_popularity_score: risk_popularity_score,
                         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/cyber_source_merged_spec/models/sender_information2.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account'] = 'account'
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['email'] = 'email'
  @_hash['phone_number'] = 'phoneNumber'
  @_hash['country_code'] = 'countryCode'
  @_hash['create_date'] = 'createDate'
  @_hash['postal_code'] = 'postalCode'
  @_hash['risk_popularity_score'] = 'riskPopularityScore'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    account
    first_name
    last_name
    email
    phone_number
    country_code
    create_date
    postal_code
    risk_popularity_score
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



192
193
194
195
196
197
198
199
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 192

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account.inspect}, first_name: #{@first_name.inspect},"\
  " last_name: #{@last_name.inspect}, email: #{@email.inspect}, phone_number:"\
  " #{@phone_number.inspect}, country_code: #{@country_code.inspect}, create_date:"\
  " #{@create_date.inspect}, postal_code: #{@postal_code.inspect}, risk_popularity_score:"\
  " #{@risk_popularity_score.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



183
184
185
186
187
188
189
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 183

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account}, first_name: #{@first_name}, last_name: #{@last_name},"\
  " email: #{@email}, phone_number: #{@phone_number}, country_code: #{@country_code},"\
  " create_date: #{@create_date}, postal_code: #{@postal_code}, risk_popularity_score:"\
  " #{@risk_popularity_score}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/cyber_source_merged_spec/models/sender_information2.rb', line 163

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

  XmlUtilities.add_as_subelement(doc, root, 'Account14', )
  XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name)
  XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name)
  XmlUtilities.add_as_subelement(doc, root, 'email', email)
  XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number)
  XmlUtilities.add_as_subelement(doc, root, 'countryCode', country_code)
  XmlUtilities.add_as_subelement(doc, root, 'createDate', create_date)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'riskPopularityScore',
                                 risk_popularity_score)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end