Class: Targetdata::Entities::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/targetdata/entities/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Person

Returns a new instance of Person.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/targetdata/entities/person.rb', line 25

def initialize params = {}
  @cpf                    = params['CPF']
  @email                  = params['email']
  @first_name             = params['nomePrimeiro']
  @middle_name            = params['nomeMeio']
  @last_name              = params['nomeUltimo']
  @gender                 = params['sexo']
  @birth                  = params['dataNascimento']
  @status_receita_federal = params['statusReceitaFederal']
  @rg_number              = params['rgNumero']
  @rg_orgao_emissor       = params['rgOrgaoEmissor']
  @rg_uf                  = params['rgUf']
  @voter_registration     = params['tituloEleitoral']
  @death                  = params['obito']
  @nationality            = params['nacionalidade']
  @minor                  = params['menorDeIdade']
  @marital_status         = params['estadoCivil']
  @mother_first_name      = params['maeNomePrimeiro']
  @mother_middle_name     = params['maeNomeMeio']
  @mother_last_name       = params['maeNomeUltimo']
  @schooling              = params['escolaridade']
end

Instance Attribute Details

#birthObject

Returns the value of attribute birth.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def birth
  @birth
end

#cpfObject

Returns the value of attribute cpf.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def cpf
  @cpf
end

#deathObject

Returns the value of attribute death.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def death
  @death
end

#emailObject

Returns the value of attribute email.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def gender
  @gender
end

#last_nameObject

Returns the value of attribute last_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def last_name
  @last_name
end

#marital_statusObject

Returns the value of attribute marital_status.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def marital_status
  @marital_status
end

#middle_nameObject

Returns the value of attribute middle_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def middle_name
  @middle_name
end

#minorObject

Returns the value of attribute minor.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def minor
  @minor
end

#mother_first_nameObject

Returns the value of attribute mother_first_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def mother_first_name
  @mother_first_name
end

#mother_last_nameObject

Returns the value of attribute mother_last_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def mother_last_name
  @mother_last_name
end

#mother_middle_nameObject

Returns the value of attribute mother_middle_name.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def mother_middle_name
  @mother_middle_name
end

#nationalityObject

Returns the value of attribute nationality.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def nationality
  @nationality
end

#rg_numberObject

Returns the value of attribute rg_number.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def rg_number
  @rg_number
end

#rg_orgao_emissorObject

Returns the value of attribute rg_orgao_emissor.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def rg_orgao_emissor
  @rg_orgao_emissor
end

#rg_ufObject

Returns the value of attribute rg_uf.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def rg_uf
  @rg_uf
end

#schoolingObject

Returns the value of attribute schooling.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def schooling
  @schooling
end

#status_receita_federalObject

Returns the value of attribute status_receita_federal.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def status_receita_federal
  @status_receita_federal
end

#voter_registrationObject

Returns the value of attribute voter_registration.



4
5
6
# File 'lib/targetdata/entities/person.rb', line 4

def voter_registration
  @voter_registration
end

Instance Method Details

#full_nameObject



48
49
50
# File 'lib/targetdata/entities/person.rb', line 48

def full_name
  "#{@first_name} #{@middle_name} #{@last_name}".strip
end

#to_jsonObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/targetdata/entities/person.rb', line 52

def to_json
  {
    cpf: @cpf,
    first_name: @first_name,
    middle_name: @middle_name,
    last_name: @last_name,
    gender: @gender,
    birth: @birth,
    status_receita_federal: @status_receita_federal,
    rg_number: @rg_number,
    rg_orgao_emissor: @rg_orgao_emissor,
    rg_uf: @rg_uf,
    voter_registration: @voter_registration,
    death: @death,
    nationality: @nationality,
    minor: @minor,
    marital_status: @marital_status,
    mother_first_name: @mother_first_name,
    mother_middle_name: @mother_middle_name,
    mother_last_name: @mother_last_name,
    schooling: @schooling
  }.to_json
end