Class: Pescheck::V2Candidate

Inherits:
ApiModelBase show all
Defined in:
lib/pescheck-client/models/v2_candidate.rb

Overview

Bucket-level candidate facts. Required-ness varies per profile; serializer is lenient. Note: v2 tightens nationality vs v1 - v1 accepted any free-form string, v2 requires an ISO 3166-1 alpha-2 code so downstream consumers (watchlist matching, document readers, etc.) can rely on the value.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ V2Candidate

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/pescheck-client/models/v2_candidate.rb', line 112

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::V2Candidate` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::V2Candidate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  else
    self.first_name = nil
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  else
    self.last_name = nil
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  else
    self.email = nil
  end

  if attributes.key?(:'initials')
    self.initials = attributes[:'initials']
  end

  if attributes.key?(:'date_of_birth')
    self.date_of_birth = attributes[:'date_of_birth']
  end

  if attributes.key?(:'gender')
    self.gender = attributes[:'gender']
  end

  if attributes.key?(:'nationality')
    self.nationality = attributes[:'nationality']
  end

  if attributes.key?(:'postal_code')
    self.postal_code = attributes[:'postal_code']
  end

  if attributes.key?(:'house_number')
    self.house_number = attributes[:'house_number']
  end

  if attributes.key?(:'extension')
    self.extension = attributes[:'extension']
  end
end

Instance Attribute Details

#date_of_birthObject

Returns the value of attribute date_of_birth.



27
28
29
# File 'lib/pescheck-client/models/v2_candidate.rb', line 27

def date_of_birth
  @date_of_birth
end

#emailObject

Returns the value of attribute email.



23
24
25
# File 'lib/pescheck-client/models/v2_candidate.rb', line 23

def email
  @email
end

#extensionObject

Returns the value of attribute extension.



38
39
40
# File 'lib/pescheck-client/models/v2_candidate.rb', line 38

def extension
  @extension
end

#first_nameObject

Returns the value of attribute first_name.



19
20
21
# File 'lib/pescheck-client/models/v2_candidate.rb', line 19

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender.



29
30
31
# File 'lib/pescheck-client/models/v2_candidate.rb', line 29

def gender
  @gender
end

#house_numberObject

Returns the value of attribute house_number.



36
37
38
# File 'lib/pescheck-client/models/v2_candidate.rb', line 36

def house_number
  @house_number
end

#initialsObject

Returns the value of attribute initials.



25
26
27
# File 'lib/pescheck-client/models/v2_candidate.rb', line 25

def initials
  @initials
end

#last_nameObject

Returns the value of attribute last_name.



21
22
23
# File 'lib/pescheck-client/models/v2_candidate.rb', line 21

def last_name
  @last_name
end

#nationalityObject

ISO 3166-1 alpha-2 country code (e.g. "NL", "DE", "US"). * AD - AD * AE - AE * AF - AF * AG - AG * AI - AI * AL - AL * AM - AM * AN - AN * AO - AO * AQ - AQ * AR - AR * AS - AS * AT - AT * AU - AU * AW - AW * AX - AX * AZ - AZ * BA - BA * BB - BB * BD - BD * BE - BE * BF - BF * BG - BG * BH - BH * BI - BI * BJ - BJ * BL - BL * BM - BM * BN - BN * BO - BO * BR - BR * BS - BS * BT - BT * BV - BV * BW - BW * BY - BY * BZ - BZ * CA - CA * CC - CC * CD - CD * CF - CF * CG - CG * CH - CH * CI - CI * CK - CK * CL - CL * CM - CM * CN - CN * CO - CO * CR - CR * CU - CU * CV - CV * CW - CW * CX - CX * CY - CY * CZ - CZ * DE - DE * DJ - DJ * DK - DK * DM - DM * DO - DO * DZ - DZ * EC - EC * EE - EE * EG - EG * EH - EH * ER - ER * ES - ES * ET - ET * FI - FI * FJ - FJ * FK - FK * FM - FM * FO - FO * FR - FR * GA - GA * GB - GB * GD - GD * GE - GE * GF - GF * GG - GG * GH - GH * GI - GI * GL - GL * GM - GM * GN - GN * GP - GP * GQ - GQ * GR - GR * GS - GS * GT - GT * GU - GU * GW - GW * GY - GY * HK - HK * HM - HM * HN - HN * HR - HR * HT - HT * HU - HU * ID - ID * IE - IE * IL - IL * IM - IM * IN - IN * IO - IO * IQ - IQ * IR - IR * IS - IS * IT - IT * JE - JE * JM - JM * JO - JO * JP - JP * KE - KE * KG - KG * KH - KH * KI - KI * KM - KM * KN - KN * KP - KP * KR - KR * KW - KW * KY - KY * KZ - KZ * LA - LA * LB - LB * LC - LC * LI - LI * LK - LK * LR - LR * LS - LS * LT - LT * LU - LU * LV - LV * LY - LY * MA - MA * MC - MC * MD - MD * ME - ME * MG - MG * MH - MH * MK - MK * ML - ML * MM - MM * MN - MN * MO - MO * MP - MP * MQ - MQ * MR - MR * MS - MS * MT - MT * MU - MU * MV - MV * MW - MW * MX - MX * MY - MY * MZ - MZ * NA - NA * NC - NC * NE - NE * NF - NF * NG - NG * NI - NI * NL - NL * NO - NO * NP - NP * NR - NR * NU - NU * NZ - NZ * OM - OM * PA - PA * PE - PE * PF - PF * PG - PG * PH - PH * PK - PK * PL - PL * PM - PM * PN - PN * PR - PR * PS - PS * PT - PT * PW - PW * PY - PY * QA - QA * RE - RE * RO - RO * RS - RS * RU - RU * RW - RW * SA - SA * SB - SB * SC - SC * SD - SD * SE - SE * SG - SG * SH - SH * SI - SI * SJ - SJ * SK - SK * SL - SL * SM - SM * SN - SN * SO - SO * SR - SR * ST - ST * SV - SV * SY - SY * SZ - SZ * TC - TC * TD - TD * TF - TF * TG - TG * TH - TH * TJ - TJ * TK - TK * TL - TL * TM - TM * TN - TN * TO - TO * TR - TR * TT - TT * TV - TV * TW - TW * TZ - TZ * UA - UA * UG - UG * UM - UM * US - US * UY - UY * UZ - UZ * VA - VA * VC - VC * VE - VE * VG - VG * VI - VI * VN - VN * VU - VU * WF - WF * WS - WS * XK - XK * YE - YE * YT - YT * ZA - ZA * ZM - ZM * ZW - ZW



32
33
34
# File 'lib/pescheck-client/models/v2_candidate.rb', line 32

def nationality
  @nationality
end

#postal_codeObject

Returns the value of attribute postal_code.



34
35
36
# File 'lib/pescheck-client/models/v2_candidate.rb', line 34

def postal_code
  @postal_code
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



79
80
81
# File 'lib/pescheck-client/models/v2_candidate.rb', line 79

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/pescheck-client/models/v2_candidate.rb', line 84

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/pescheck-client/models/v2_candidate.rb', line 63

def self.attribute_map
  {
    :'first_name' => :'first_name',
    :'last_name' => :'last_name',
    :'email' => :'email',
    :'initials' => :'initials',
    :'date_of_birth' => :'date_of_birth',
    :'gender' => :'gender',
    :'nationality' => :'nationality',
    :'postal_code' => :'postal_code',
    :'house_number' => :'house_number',
    :'extension' => :'extension'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/pescheck-client/models/v2_candidate.rb', line 352

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



105
106
107
108
# File 'lib/pescheck-client/models/v2_candidate.rb', line 105

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/pescheck-client/models/v2_candidate.rb', line 89

def self.openapi_types
  {
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'email' => :'String',
    :'initials' => :'String',
    :'date_of_birth' => :'String',
    :'gender' => :'String',
    :'nationality' => :'String',
    :'postal_code' => :'String',
    :'house_number' => :'String',
    :'extension' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/pescheck-client/models/v2_candidate.rb', line 322

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      email == o.email &&
      initials == o.initials &&
      date_of_birth == o.date_of_birth &&
      gender == o.gender &&
      nationality == o.nationality &&
      postal_code == o.postal_code &&
      house_number == o.house_number &&
      extension == o.extension
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


339
340
341
# File 'lib/pescheck-client/models/v2_candidate.rb', line 339

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



345
346
347
# File 'lib/pescheck-client/models/v2_candidate.rb', line 345

def hash
  [first_name, last_name, email, initials, date_of_birth, gender, nationality, postal_code, house_number, extension].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/pescheck-client/models/v2_candidate.rb', line 175

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @first_name.nil?
    invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
  end

  if @first_name.to_s.length > 255
    invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.')
  end

  if @last_name.nil?
    invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
  end

  if @last_name.to_s.length > 255
    invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.')
  end

  if @email.nil?
    invalid_properties.push('invalid value for "email", email cannot be nil.')
  end

  if !@date_of_birth.nil? && @date_of_birth.to_s.length > 10
    invalid_properties.push('invalid value for "date_of_birth", the character length must be smaller than or equal to 10.')
  end

  if !@postal_code.nil? && @postal_code.to_s.length > 255
    invalid_properties.push('invalid value for "postal_code", the character length must be smaller than or equal to 255.')
  end

  if !@house_number.nil? && @house_number.to_s.length > 50
    invalid_properties.push('invalid value for "house_number", the character length must be smaller than or equal to 50.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/pescheck-client/models/v2_candidate.rb', line 374

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/pescheck-client/models/v2_candidate.rb', line 215

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @first_name.nil?
  return false if @first_name.to_s.length > 255
  return false if @last_name.nil?
  return false if @last_name.to_s.length > 255
  return false if @email.nil?
  return false if !@date_of_birth.nil? && @date_of_birth.to_s.length > 10
  nationality_validator = EnumAttributeValidator.new('String', ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", ""])
  return false unless nationality_validator.valid?(@nationality)
  return false if !@postal_code.nil? && @postal_code.to_s.length > 255
  return false if !@house_number.nil? && @house_number.to_s.length > 50
  true
end