Class: TrinsicApi::PeruDniProviderOutput

Inherits:
ApiModelBase 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

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ PeruDniProviderOutput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 145

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
  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']
  end

  if attributes.key?(:'document_type')
    self.document_type = attributes[:'document_type']
  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']
  end

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

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

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

  if attributes.key?(:'paternal_last_name')
    self.paternal_last_name = attributes[:'paternal_last_name']
  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 individual'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: https://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

.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



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 279

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
134
135
136
137
138
139
140
141
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 122

def self.openapi_nullable
  Set.new([
    :'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'
  ])
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



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 243

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


266
267
268
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 266

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



272
273
274
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 272

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



228
229
230
231
232
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 228

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 301

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



236
237
238
239
# File 'lib/trinsic_api/models/peru_dni_provider_output.rb', line 236

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end