Class: TrinsicApi::PeruDniProviderOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/trinsic_api/models/peru_dni_provider_output.rb

Overview

Exposed properties for the ‘peru-dni-lookup` Provider which do not directly map to the normalized IdentityData model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PeruDniProviderOutput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
172
173
174
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 137

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::PeruDniProviderOutput` 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 `TrinsicApi::PeruDniProviderOutput`. 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?(:'address')
    self.address = attributes[:'address']
  end

  if attributes.key?(:'array_name')
    if (value = attributes[:'array_name']).is_a?(Array)
      self.array_name = value
    end
  else
    self.array_name = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#addressObject

Information about the general area in which the DNI holder resides. This field is not always available.



20
21
22
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 20

def address
  @address
end

#array_nameObject

All names that appear on DNI, as an array of strings. Format: - All uppercase - Ordered by paternal family name, then maternal family name, then given names.



23
24
25
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 23

def array_name
  @array_name
end

#civil_statusObject

Marital status as it appears on the DNI. This field is not always available. Valid values: - "Single" - "Married" - "Divorced" - "Widowed"



26
27
28
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 26

def civil_status
  @civil_status
end

#date_of_birthObject

Date of birth as it appears on the DNI. This field is not always available.



29
30
31
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 29

def date_of_birth
  @date_of_birth
end

#document_numberObject

The user’s National Identity Document number (Documento Nacional de Identidad or DNI). Format: - 8 digits - Does NOT include verification digit. On the DNI card, a ninth digit appears next to the first eight. It is 0-9 or A-K. This is NOT included in the DNI number when returned from Peru’s database. - Does NOT include dots or hyphens



32
33
34
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 32

def document_number
  @document_number
end

#document_typeObject

Should always be "DNI".



35
36
37
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 35

def document_type
  @document_type
end

#expedition_dateObject

Date that the DNI was issued. This field is not always available. Format: - yyyy-MM-dd



38
39
40
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 38

def expedition_date
  @expedition_date
end

#expiration_dateObject

Date that the DNI will expire. DNI expires every 8 years, unless the citizen is >= 60 years old, in which case it never expires. This field is not always available. Format: - yyyy-MM-dd



41
42
43
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 41

def expiration_date
  @expiration_date
end

#first_nameObject

Given names as they appear on DNI. Format: - All uppercase - Space-separated - Will include all given names



44
45
46
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 44

def first_name
  @first_name
end

#full_nameObject

All names as they appear on DNI. Format: - All uppercase - Space-separated - Will include all names, given and family - Ordered by given names first, then paternal family name, then maternal family name



47
48
49
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 47

def full_name
  @full_name
end

#last_nameObject

Family names as they appear on DNI. Format: - All uppercase - Will include all family names - Ordered by paternal family name first, then maternal family name



50
51
52
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 50

def last_name
  @last_name
end

#maternal_last_nameObject

Maternal last name as it appears on DNI. Format: - All uppercase



53
54
55
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 53

def maternal_last_name
  @maternal_last_name
end

#paternal_last_nameObject

Paternal last name as it appears on DNI. Format: - All uppercase



56
57
58
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 56

def paternal_last_name
  @paternal_last_name
end

#sexObject

Sex as it appears on DNI. This field is not always available. Values: - "Male" - "Female"



59
60
61
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 59

def sex
  @sex
end

#ubigeo_reniecObject

In Peru, geographical locations have an official geographical code called UBIGEO, from the spanish "UBIcación GEOgráfica" (Geographic Location). This is an administrative geocode, is different from a postal code (which Peru also has) and is used to specifically delineate the administrative region, province and district hierarchy. There are two coding systems for UBIGEO: one from INEI (National Institute of Statistics and Informatics) and another from RENIEC (National Registry of Identification and Civil Status). The two coding systems are similar but are not 100% the same (some numbers will map to different geographic locations). This field follows the coding system from RENIEC. This field is not always available. Format: - Always 6 digits - First two digits represent region - Middle two are province - Last two are district Given the example 081304, that would correspond to: - 08 - Cusco Region - 0813 - Urubamba Province - 081304 - Machupicchu District



62
63
64
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 62

def ubigeo_reniec
  @ubigeo_reniec
end

#verification_digitObject

The final (ninth) digit of the DNI, which serves as a checksum over the first eight digits. This field is not always available. Format: - Single character - Either 0-9 or A-K Read more here: elcomercio.pe/mag/respuestas/cual-es-el-digito-verificador-de-mi-dni-documento-nacional-de-identidad-reniec-peru-nnda-nnlt-noticia/



65
66
67
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 65

def verification_digit
  @verification_digit
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 431

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = TrinsicApi.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



90
91
92
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 90

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 95

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 68

def self.attribute_map
  {
    :'address' => :'address',
    :'array_name' => :'arrayName',
    :'civil_status' => :'civilStatus',
    :'date_of_birth' => :'dateOfBirth',
    :'document_number' => :'documentNumber',
    :'document_type' => :'documentType',
    :'expedition_date' => :'expeditionDate',
    :'expiration_date' => :'expirationDate',
    :'first_name' => :'firstName',
    :'full_name' => :'fullName',
    :'last_name' => :'lastName',
    :'maternal_last_name' => :'maternalLastName',
    :'paternal_last_name' => :'paternalLastName',
    :'sex' => :'sex',
    :'ubigeo_reniec' => :'ubigeoReniec',
    :'verification_digit' => :'verificationDigit'
  }
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



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 407

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



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 122

def self.openapi_nullable
  Set.new([
    :'address',
    :'civil_status',
    :'date_of_birth',
    :'expedition_date',
    :'expiration_date',
    :'sex',
    :'ubigeo_reniec',
    :'verification_digit'
  ])
end

.openapi_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 100

def self.openapi_types
  {
    :'address' => :'PeruDniAddress',
    :'array_name' => :'Array<String>',
    :'civil_status' => :'String',
    :'date_of_birth' => :'Date',
    :'document_number' => :'String',
    :'document_type' => :'String',
    :'expedition_date' => :'Date',
    :'expiration_date' => :'Date',
    :'first_name' => :'String',
    :'full_name' => :'String',
    :'last_name' => :'String',
    :'maternal_last_name' => :'String',
    :'paternal_last_name' => :'String',
    :'sex' => :'String',
    :'ubigeo_reniec' => :'String',
    :'verification_digit' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 371

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address == o.address &&
      array_name == o.array_name &&
      civil_status == o.civil_status &&
      date_of_birth == o.date_of_birth &&
      document_number == o.document_number &&
      document_type == o.document_type &&
      expedition_date == o.expedition_date &&
      expiration_date == o.expiration_date &&
      first_name == o.first_name &&
      full_name == o.full_name &&
      last_name == o.last_name &&
      maternal_last_name == o.maternal_last_name &&
      paternal_last_name == o.paternal_last_name &&
      sex == o.sex &&
      ubigeo_reniec == o.ubigeo_reniec &&
      verification_digit == o.verification_digit
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 502

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


394
395
396
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 394

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



400
401
402
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 400

def hash
  [address, array_name, civil_status, date_of_birth, document_number, document_type, expedition_date, expiration_date, first_name, full_name, last_name, maternal_last_name, paternal_last_name, sex, ubigeo_reniec, verification_digit].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 236

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

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

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

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

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

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

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

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

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



478
479
480
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 478

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 484

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



472
473
474
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 472

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 276

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @array_name.nil?
  return false if @document_number.nil?
  return false if @document_type.nil?
  return false if @first_name.nil?
  return false if @full_name.nil?
  return false if @last_name.nil?
  return false if @maternal_last_name.nil?
  return false if @paternal_last_name.nil?
  true
end