Sha256: e645dc18f976dcfe45f2e4d48a365516332f5d7741ece65497cfdabe26476b29
Contents?: true
Size: 921 Bytes
Versions: 1
Compression:
Stored size: 921 Bytes
Contents
module Targetdata module Api class Pf include Auth include Requester def initialize cpf @cpf = cpf end def person response = get_person Entities::Person.new hash_person(response.body.to_s) end private def hash_person string_body parsed = JSON.parse(string_body) raise Targetdata::Errors::PersonNotFound unless person_found?(parsed) parse_person_hash parsed end def person_found? hash !!hash["result"] end def parse_person_hash hash pessoa = hash["result"].first["pessoa"] pessoa["cadastral"]["email"] = nil if hash["report"]["email"] >= 1 pessoa["cadastral"]["email"] = pessoa["contato"]["email"].first["email"] end pessoa["cadastral"] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
targetdata-0.4.1 | lib/targetdata/api/pf.rb |