Class: Biro::Ph3a::Response
- Inherits:
-
BaseResponse
- Object
- BaseResponse
- Biro::Ph3a::Response
- Defined in:
- lib/biro/gateways/ph3a/response.rb
Instance Attribute Summary
Attributes inherited from BaseResponse
Instance Method Summary collapse
- #addresses ⇒ Object
- #age ⇒ Object
- #birthdate ⇒ Object
- #blood_type ⇒ Object
- #ccf ⇒ Object
- #ccf_history ⇒ Object
- #ccf_total ⇒ Object
- #compound_name ⇒ Object
- #contact_persons ⇒ Object
- #contact_persons_history ⇒ Object
- #cpf ⇒ Object
- #death ⇒ Object
- #death_date ⇒ Object
- #death_year ⇒ Object
- #deficiency ⇒ Object
- #deficiency_list ⇒ Object
- #digital_behavior ⇒ Object
- #education ⇒ Object
- #emails ⇒ Object
- #eye_color ⇒ Object
- #fathers_document ⇒ Object
- #fathers_name ⇒ Object
- #first_name ⇒ Object
- #gender ⇒ Object
- #hair_color ⇒ Object
- #height ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #last_name ⇒ Object
- #marital_status ⇒ Object
- #match_name ⇒ Object
- #middle_name ⇒ Object
- #mothers_document ⇒ Object
- #mothers_name ⇒ Object
- #nacionality ⇒ Object
- #name ⇒ Object
- #name_cpf_brasil ⇒ Object
- #number_dependents ⇒ Object
- #pep ⇒ Object
- #person_household ⇒ Object
- #phones ⇒ Object
- #professional_info ⇒ Object
- #retired ⇒ Object
- #rg ⇒ Object
- #rg_state ⇒ Object
- #second_name ⇒ Object
- #skin_color ⇒ Object
- #spouses_document ⇒ Object
- #spouses_name ⇒ Object
- #vehicles ⇒ Object
- #voter_id ⇒ Object
- #weight ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/biro/gateways/ph3a/response.rb', line 6 def initialize response @body = response.body end |
Instance Method Details
#addresses ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 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 ⇒ Object
31 32 33 |
# File 'lib/biro/gateways/ph3a/response.rb', line 31 def age person_data_result.dig(:age).to_i end |
#birthdate ⇒ Object
35 36 37 |
# File 'lib/biro/gateways/ph3a/response.rb', line 35 def birthdate person_data_result.dig(:birth_date) end |
#blood_type ⇒ Object
39 40 41 |
# File 'lib/biro/gateways/ph3a/response.rb', line 39 def blood_type person_data_result.dig(:blood_type) end |
#ccf ⇒ Object
43 44 45 |
# File 'lib/biro/gateways/ph3a/response.rb', line 43 def ccf person_data_result.dig(:ccf) end |
#ccf_history ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# 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 ⇒ Object
59 60 61 |
# File 'lib/biro/gateways/ph3a/response.rb', line 59 def ccf_total person_data_result.dig(:ccf_total).to_i end |
#compound_name ⇒ Object
63 64 65 |
# File 'lib/biro/gateways/ph3a/response.rb', line 63 def compound_name person_data_result.dig(:compound_name) end |
#contact_persons ⇒ Object
67 68 69 |
# File 'lib/biro/gateways/ph3a/response.rb', line 67 def contact_persons person_data_result.dig(:contact_persons) end |
#contact_persons_history ⇒ Object
71 72 73 |
# File 'lib/biro/gateways/ph3a/response.rb', line 71 def contact_persons_history person_data_result.dig(:contact_persons_history) end |
#cpf ⇒ Object
95 96 97 |
# File 'lib/biro/gateways/ph3a/response.rb', line 95 def cpf person_data_result.dig(:document) end |
#death ⇒ Object
276 277 278 |
# File 'lib/biro/gateways/ph3a/response.rb', line 276 def death person_data_result.dig(:supposed_death) end |
#death_date ⇒ Object
75 76 77 |
# File 'lib/biro/gateways/ph3a/response.rb', line 75 def death_date person_data_result.dig(:death_date) end |
#death_year ⇒ Object
79 80 81 |
# File 'lib/biro/gateways/ph3a/response.rb', line 79 def death_year person_data_result.dig(:death_year) end |
#deficiency ⇒ Object
83 84 85 |
# File 'lib/biro/gateways/ph3a/response.rb', line 83 def deficiency person_data_result.dig(:deficiency) end |
#deficiency_list ⇒ Object
87 88 89 |
# File 'lib/biro/gateways/ph3a/response.rb', line 87 def deficiency_list person_data_result.dig(:deficiencys) end |
#digital_behavior ⇒ Object
91 92 93 |
# File 'lib/biro/gateways/ph3a/response.rb', line 91 def digital_behavior person_data_result.dig(:digital_behavior) end |
#education ⇒ Object
99 100 101 102 103 104 |
# 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 ⇒ Object
106 107 108 109 110 111 112 113 |
# 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 ⇒ Object
115 116 117 |
# File 'lib/biro/gateways/ph3a/response.rb', line 115 def eye_color person_data_result.dig(:eye_color) end |
#fathers_document ⇒ Object
119 120 121 |
# File 'lib/biro/gateways/ph3a/response.rb', line 119 def fathers_document person_data_result.dig(:father_document) end |
#fathers_name ⇒ Object
123 124 125 |
# File 'lib/biro/gateways/ph3a/response.rb', line 123 def fathers_name person_data_result.dig(:father_name) end |
#first_name ⇒ Object
127 128 129 |
# File 'lib/biro/gateways/ph3a/response.rb', line 127 def first_name person_data_result.dig(:first_name) end |
#gender ⇒ Object
131 132 133 |
# File 'lib/biro/gateways/ph3a/response.rb', line 131 def gender person_data_result.dig(:genre) end |
#hair_color ⇒ Object
135 136 137 |
# File 'lib/biro/gateways/ph3a/response.rb', line 135 def hair_color person_data_result.dig(:hair_color) end |
#height ⇒ Object
139 140 141 |
# File 'lib/biro/gateways/ph3a/response.rb', line 139 def height person_data_result.dig(:height) end |
#last_name ⇒ Object
151 152 153 |
# File 'lib/biro/gateways/ph3a/response.rb', line 151 def last_name person_data_result.dig(:last_name) end |
#marital_status ⇒ Object
155 156 157 |
# File 'lib/biro/gateways/ph3a/response.rb', line 155 def marital_status person_data_result.dig(:marital_status) end |
#match_name ⇒ Object
159 160 161 |
# File 'lib/biro/gateways/ph3a/response.rb', line 159 def match_name person_data_result.dig(:match_name) end |
#middle_name ⇒ Object
163 164 165 |
# File 'lib/biro/gateways/ph3a/response.rb', line 163 def middle_name person_data_result.dig(:middle_name) end |
#mothers_document ⇒ Object
167 168 169 |
# File 'lib/biro/gateways/ph3a/response.rb', line 167 def mothers_document person_data_result.dig(:mother_document) end |
#mothers_name ⇒ Object
171 172 173 |
# File 'lib/biro/gateways/ph3a/response.rb', line 171 def mothers_name person_data_result.dig(:mother_name) end |
#nacionality ⇒ Object
175 176 177 |
# File 'lib/biro/gateways/ph3a/response.rb', line 175 def nacionality person_data_result.dig(:nacionality) end |
#name ⇒ Object
179 180 181 |
# File 'lib/biro/gateways/ph3a/response.rb', line 179 def name person_data_result.dig(:name) end |
#name_cpf_brasil ⇒ Object
183 184 185 |
# File 'lib/biro/gateways/ph3a/response.rb', line 183 def name_cpf_brasil person_data_result.dig(:name_cpf_brasil) end |
#number_dependents ⇒ Object
187 188 189 |
# File 'lib/biro/gateways/ph3a/response.rb', line 187 def number_dependents person_data_result.dig(:number_dependents).to_i end |
#pep ⇒ Object
208 209 210 |
# File 'lib/biro/gateways/ph3a/response.rb', line 208 def pep person_data_result.dig(:politically_exposed_person) end |
#person_household ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# 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 ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# 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 ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# 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 ⇒ Object
256 257 258 |
# File 'lib/biro/gateways/ph3a/response.rb', line 256 def retired person_data_result.dig(:retired_data) end |
#rg ⇒ Object
143 144 145 |
# File 'lib/biro/gateways/ph3a/response.rb', line 143 def rg person_data_result.dig(:id_card) end |
#rg_state ⇒ Object
147 148 149 |
# File 'lib/biro/gateways/ph3a/response.rb', line 147 def rg_state person_data_result.dig(:id_card_state) end |
#second_name ⇒ Object
260 261 262 |
# File 'lib/biro/gateways/ph3a/response.rb', line 260 def second_name person_data_result.dig(:second_name) end |
#skin_color ⇒ Object
264 265 266 |
# File 'lib/biro/gateways/ph3a/response.rb', line 264 def skin_color person_data_result.dig(:skin_color) end |
#spouses_document ⇒ Object
268 269 270 |
# File 'lib/biro/gateways/ph3a/response.rb', line 268 def spouses_document person_data_result.dig(:spouse_document) end |
#spouses_name ⇒ Object
272 273 274 |
# File 'lib/biro/gateways/ph3a/response.rb', line 272 def spouses_name person_data_result.dig(:spouse_name) end |
#vehicles ⇒ Object
280 281 282 |
# File 'lib/biro/gateways/ph3a/response.rb', line 280 def vehicles person_data_result.dig(:vehicles) end |
#voter_id ⇒ Object
284 285 286 |
# File 'lib/biro/gateways/ph3a/response.rb', line 284 def voter_id person_data_result.dig(:voter_registration) end |
#weight ⇒ Object
288 289 290 |
# File 'lib/biro/gateways/ph3a/response.rb', line 288 def weight person_data_result.dig(:weight).to_f end |