class Biro::Ph3a::Response
Public Class Methods
new(response)
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 6 def initialize response @body = response.body end
Public Instance Methods
addresses()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 10 def addresses Array.wrap(person_data_result.dig(:addresses)&.dig(:source)&.dig(:address)).map do |t| { city: t.dig(:city), complement: t.dig(:complement), country: t.dig(:country), is_enabled: t.dig(:is_enabled), match: t.dig(:match), neighboorhood: t.dig(:district), number: t.dig(:number), score: t.dig(:score).to_i, state: t.dig(:state), street: t.dig(:street), type: t.dig(:type), zip_code: t.dig(:zip_code), phone_area_code: t.dig(:area_code), phone: t.dig(:phone) } end end
age()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 31 def age person_data_result.dig(:age).to_i end
birthdate()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 35 def birthdate person_data_result.dig(:birth_date) end
blood_type()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 39 def blood_type person_data_result.dig(:blood_type) end
ccf()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 43 def ccf person_data_result.dig(:ccf) end
ccf_history()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 47 def ccf_history Array.wrap(person_data_result.dig(:ccf_historico)&.dig(:ccf)).map do |t| { agency: t.dig(:agencia).to_i, bank_code: t.dig(:codigo_banco).to_i, reason: t.dig(:motivo), amount: t.dig(:quantidade), occurrence_date: t.dig(:ultima_ocorrencia), } end end
ccf_total()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 59 def ccf_total person_data_result.dig(:ccf_total).to_i end
compound_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 63 def compound_name person_data_result.dig(:compound_name) end
contact_persons()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 67 def contact_persons person_data_result.dig(:contact_persons) end
contact_persons_history()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 71 def contact_persons_history person_data_result.dig(:contact_persons_history) end
cpf()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 95 def cpf person_data_result.dig(:document) end
death()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 276 def death person_data_result.dig(:supposed_death) end
death_date()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 75 def death_date person_data_result.dig(:death_date) end
death_year()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 79 def death_year person_data_result.dig(:death_year) end
deficiency()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 83 def deficiency person_data_result.dig(:deficiency) end
deficiency_list()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 87 def deficiency_list person_data_result.dig(:deficiencys) end
digital_behavior()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 91 def digital_behavior person_data_result.dig(:digital_behavior) end
education()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 99 def education { description: person_data_result.dig(:education_level)&.dig(:description), level: person_data_result.dig(:education_level)&.dig(:education_level).to_i } end
emails()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 106 def emails Array.wrap(person_data_result.dig(:emails)&.dig(:email)).map do |t| { address: t.dig(:email_value), is_enabled: t.dig(:is_enabled), } end end
eye_color()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 115 def eye_color person_data_result.dig(:eye_color) end
fathers_document()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 119 def fathers_document person_data_result.dig(:father_document) end
fathers_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 123 def fathers_name person_data_result.dig(:father_name) end
first_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 127 def first_name person_data_result.dig(:first_name) end
gender()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 131 def gender person_data_result.dig(:genre) end
hair_color()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 135 def hair_color person_data_result.dig(:hair_color) end
height()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 139 def height person_data_result.dig(:height) end
last_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 151 def last_name person_data_result.dig(:last_name) end
marital_status()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 155 def marital_status person_data_result.dig(:marital_status) end
match_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 159 def match_name person_data_result.dig(:match_name) end
middle_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 163 def middle_name person_data_result.dig(:middle_name) end
mothers_document()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 167 def mothers_document person_data_result.dig(:mother_document) end
mothers_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 171 def mothers_name person_data_result.dig(:mother_name) end
nacionality()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 175 def nacionality person_data_result.dig(:nacionality) end
name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 179 def name person_data_result.dig(:name) end
name_cpf_brasil()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 183 def name_cpf_brasil person_data_result.dig(:name_cpf_brasil) end
number_dependents()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 187 def number_dependents person_data_result.dig(:number_dependents).to_i end
pep()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 208 def pep person_data_result.dig(:politically_exposed_person) end
person_household()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 212 def person_household Array.wrap(person_data_result.dig(:person_household)&.dig(:person_household)).map do |t| { addresses: person_household_addresses(t.dig(:adresses)), call_name: t.dig(:call_name), complete_name: t.dig(:complete_name), document: t.dig(:document), father_name: t.dig(:father_name), first_name: t.dig(:first_name), genre: t.dig(:genre), iptu: t.dig(:iptu), kinship: t.dig(:kinship), last_name: t.dig(:last_name), match_name: t.dig(:match_name), middle_name: t.dig(:middle_name), mother_name: t.dig(:mother_name), second_name: t.dig(:second_name), suffix_name: t.dig(:suffix_name), vehicles: t.dig(:vehicles) } end end
phones()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 191 def phones Array.wrap(person_data_result.dig(:phones)&.dig(:phone)).map do |t| { area_code: t.dig(:area_code).to_i, at_procon: t.dig(:at_procon), document: t.dig(:document), full_name: t.dig(:full_name), is_enabled: t.dig(:is_enabled), is_household: t.dig(:is_household), is_mobile: t.dig(:is_mobile), number_simple: t.dig(:number_simple), number: t.dig(:phone_number), operator_name: t.dig(:phone_operator_name) } end end
professional_info()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 235 def professional_info Array.wrap(person_data_result.dig(:professional_data)&.dig(:professional_data)).map do |t| { cbo: t.dig(:cbo).to_i, cbo_description: t.dig(:cbo_descricao), company_cnpj: t.dig(:cnpj), company_address: t.dig(:cmpany_address), admission_date: t.dig(:data_admissao), resignation_date: t.dig(:data_demissao), family_salary: t.dig(:family_salary), pis: t.dig(:pis), social_name: t.dig(:razao_social), income_from: t.dig(:renda_de).to_f, income_to: t.dig(:renda_ate).to_f, salary: t.dig(:salario).to_f, admission_type: t.dig(:tipo_admissao).to_i, resignation_type: t.dig(:tipo_demissao).to_i } end end
retired()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 256 def retired person_data_result.dig(:retired_data) end
rg()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 143 def rg person_data_result.dig(:id_card) end
rg_state()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 147 def rg_state person_data_result.dig(:id_card_state) end
second_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 260 def second_name person_data_result.dig(:second_name) end
skin_color()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 264 def skin_color person_data_result.dig(:skin_color) end
spouses_document()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 268 def spouses_document person_data_result.dig(:spouse_document) end
spouses_name()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 272 def spouses_name person_data_result.dig(:spouse_name) end
vehicles()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 280 def vehicles person_data_result.dig(:vehicles) end
voter_id()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 284 def voter_id person_data_result.dig(:voter_registration) end
weight()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 288 def weight person_data_result.dig(:weight).to_f end
Private Instance Methods
person_data_result()
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 294 def person_data_result @body.dig(:get_person_data_response)&.dig(:get_person_data_result) end
person_household_addresses(address_list)
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 298 def person_household_addresses address_list Array.wrap(address_list.dig(:source)&.dig(:address)).map do |t| { city: t.dig(:city), complement: t.dig(:complement), country: t.dig(:country), is_enabled: t.dig(:is_enabled), match: t.dig(:match), neighboorhood: t.dig(:district), number: t.dig(:number), score: t.dig(:score).to_i, state: t.dig(:state), street: t.dig(:street), type: t.dig(:type), zip_code: t.dig(:zip_code), phone_area_code: t.dig(:area_code), phone: t.dig(:phone), phones: person_household_phones(t.dig(:phones)) } end end
person_household_phones(phones)
click to toggle source
# File lib/biro/gateways/ph3a/response.rb, line 320 def person_household_phones phones return if phones.blank? Array.wrap(phones.dig(:phone)).map do |t| { area_code: t.dig(:area_code).to_i, at_procon: t.dig(:at_procon), document: t.dig(:document), full_name: t.dig(:full_name), is_enabled: t.dig(:is_enabled), is_household: t.dig(:is_household), is_mobile: t.dig(:is_mobile), number_simple: t.dig(:number_simple), number: t.dig(:phone_number), operator_name: t.dig(:phone_operator_name) } end end