Class: TrinsicApi::BrazilCpfProviderOutput

Inherits:
ApiModelBase show all
Defined in:
lib/trinsic_api/models/brazil_cpf_provider_output.rb

Overview

Exposed properties for the brazil-cpf-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 = {}) ⇒ BrazilCpfProviderOutput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
172
173
174
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 115

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#biometric_verificationObject

The biometric verification results. This is an optional configurable check.



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

def biometric_verification
  @biometric_verification
end

#cpf_numberObject

The individual's CPF number. A CPF (Cadastro de Pessoas Físicas) is the Brazilian individual taxpayer identification number for residents and foreigners. It is an 11-digit number managed by the Federal Revenue Service, the last 2 digits are check digits, calculated based on the first 9 digits. The 9th digit indicates the fiscal region responsible for the registration,



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

def cpf_number
  @cpf_number
end

#date_of_birthObject

The date of birth of the individual.



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

def date_of_birth
  @date_of_birth
end

#date_of_registrationObject

The date of registration of the individual with the Federal Revenue Service.



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

def date_of_registration
  @date_of_registration
end

#fiscal_regionsObject

List of Brazilian fiscal regions that could have issued this number. This is calculated based off of the CPF number. A CPF number encodes information about what region it is issued from, but some regions share the identifier. Possible values: Formatted as two characters. The digit represents the region code this applies to. - AC (Acre) - 2 - AL (Alagoas) - 4 - AP (Amapá) - 2 - AM (Amazonas) - 2 - BA (Bahia) - 5 - CE (Ceará) - 3 - DF (Distrito Federal) - 1 - ES (Espírito Santo) - 7 - GO (Goiás) - 1 - MA (Maranhão) - 3 - MT (Mato Grosso) - 1 - MS (Mato Grosso do Sul) - 1 - MG (Minas Gerais) - 6 - PA (Pará) - 2 - PB (Paraíba) - 4 - PR (Paraná) - 9 - PE (Pernambuco) - 4 - PI (Piauí) - 3 - RJ (Rio de Janeiro) - 7 - RN (Rio Grande do Norte) - 4 - RO (Rondônia) - 2 - RS (Rio Grande do Sul) - 0 - RR (Roraima) - 2 - SC (Santa Catarina) - 9 - SP (São Paulo) - 8 - SE (Sergipe) - 5 - TO (Tocantins) - 1



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

def fiscal_regions
  @fiscal_regions
end

#nameObject

The full legal name of the individual.



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

def name
  @name
end

#preview_raw_error_codeObject

The raw error code for the verification, returned by Serpro. This is a temporary preview to support detailed error handling. When building against this please let the Trinsic team know. Preview features can be turned off without an obsoletion notice.



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

def preview_raw_error_code
  @preview_raw_error_code
end

#social_nameObject

The social name of the individual in case the individual would like to use a different name than their full legal name.



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

def social_name
  @social_name
end

#status_codeObject

The CPF Status. Possible values: 0 - Regular. The CPF is valid and in good standing. There are no pending issues, registration inconsistencies, or missing mandatory Individual Income Tax Returns (DIRPF). 2 - Suspended. The CPF record contains incorrect or incomplete registration data (e.g., name, date of birth, or voter registration number). This status is typically caused by discrepancies with the Superior Electoral Court (TSE) database or failure to update personal information. 3 - Deceased Holder. The CPF has been registered as belonging to a deceased individual. This status is recorded to prevent post-mortem misuse. 4 - Pending Regularization. The taxpayer has failed to submit one or more mandatory Individual Income Tax Returns (DIRPF) within the last five years. This can occur for various reasons, such as failure to file a mandatory declaration, changes of address, name, marital status, or other important information that does not conform to the records. Regularization requires submission of the overdue returns. 5 - Canceled by Multiplicity. The CPF has been cancelled due to duplicate registration (multiple CPFs assigned to the same individual or a single CPF linked to multiple individuals). 8 - Null. The CPF registration was cancelled due to confirmed fraud or a serious issuance error. Regularization requires in-person verification at a Federal Revenue Service office and may not be guaranteed. 9 - Cancelled Ex Officio. The CPF was cancelled due to administrative or judicial decision, or other registration inconsistencies.



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

def status_code
  @status_code
end

#status_descriptionObject

Description of the CPF Status.



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

def status_description
  @status_description
end

#year_of_deathObject

Deprecated as of September 1, 2026. The year of death of the individual, if applicable.



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

def year_of_death
  @year_of_death
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



70
71
72
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 70

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



75
76
77
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 75

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 53

def self.attribute_map
  {
    :'preview_raw_error_code' => :'preview_raw_error_code',
    :'cpf_number' => :'cpfNumber',
    :'fiscal_regions' => :'fiscalRegions',
    :'status_code' => :'statusCode',
    :'status_description' => :'statusDescription',
    :'name' => :'name',
    :'social_name' => :'socialName',
    :'date_of_birth' => :'dateOfBirth',
    :'year_of_death' => :'yearOfDeath',
    :'date_of_registration' => :'dateOfRegistration',
    :'biometric_verification' => :'biometricVerification'
  }
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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 224

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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 97

def self.openapi_nullable
  Set.new([
    :'preview_raw_error_code',
    :'cpf_number',
    :'fiscal_regions',
    :'status_code',
    :'status_description',
    :'name',
    :'social_name',
    :'date_of_birth',
    :'year_of_death',
    :'date_of_registration',
    :'biometric_verification'
  ])
end

.openapi_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 80

def self.openapi_types
  {
    :'preview_raw_error_code' => :'String',
    :'cpf_number' => :'String',
    :'fiscal_regions' => :'Array<String>',
    :'status_code' => :'Integer',
    :'status_description' => :'String',
    :'name' => :'String',
    :'social_name' => :'String',
    :'date_of_birth' => :'Date',
    :'year_of_death' => :'String',
    :'date_of_registration' => :'Date',
    :'biometric_verification' => :'BrazilBiometricVerificationOutput'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 193

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      preview_raw_error_code == o.preview_raw_error_code &&
      cpf_number == o.cpf_number &&
      fiscal_regions == o.fiscal_regions &&
      status_code == o.status_code &&
      status_description == o.status_description &&
      name == o.name &&
      social_name == o.social_name &&
      date_of_birth == o.date_of_birth &&
      year_of_death == o.year_of_death &&
      date_of_registration == o.date_of_registration &&
      biometric_verification == o.biometric_verification
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


211
212
213
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 211

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



217
218
219
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 217

def hash
  [preview_raw_error_code, cpf_number, fiscal_regions, status_code, status_description, name, social_name, date_of_birth, year_of_death, date_of_registration, biometric_verification].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



178
179
180
181
182
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 178

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



246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 246

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



186
187
188
189
# File 'lib/trinsic_api/models/brazil_cpf_provider_output.rb', line 186

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