targetdata 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b329756fa1e0daf4889f08cc5292b57f358537d2674c8e0179f91ecdb0d8b7e
4
- data.tar.gz: f0703077fa07f33028c2bacb7e7cb4c718e02d96ada596686ec2fd114d8bf4ff
3
+ metadata.gz: 8b4007a6b167d7326b97e966cc7ef1365f6eaa6ed9e0167aaff273abeea9452e
4
+ data.tar.gz: 02e68a9ffd57301141b9fe34fa6b7fac5fffd2a26f3f759a9ca96529b3dacd49
5
5
  SHA512:
6
- metadata.gz: 36657fabf70b21af3a6e646e4dbaff17fbf9abca0402441f55ea0a3c127a9f76e72bcd999f4b1eae3290779a6eb831f1d08a3cb0514154f05740763fd003fd2f
7
- data.tar.gz: d1bca2349b336ead78032b9024d7e620ad4277e7902b882dd71f0cc0c7cc83a71f068d3cf5a76a0deed6385768a3305d9d1c41a21f43ffacb0694b178a76136f
6
+ metadata.gz: 5e4b4849044a385f7d6d99939d1febcae1b3888ca1733a5db61fe7d4c8c2c99dcaae93d893991def6550d93e1a97a9200022c729d73bd36937f40d9bad11d346
7
+ data.tar.gz: '0498c5f0007f222e9c10ce5fe62cdafe957907290fe3753ebcb0c0d0be2de8e0e7fff2f42666dbb9c4a97af862e2de6bc34b9ab426172cfa5ebdd96f208f820e'
@@ -16,14 +16,24 @@ module Targetdata
16
16
  private
17
17
  def hash_person string_body
18
18
  parsed = JSON.parse(string_body)
19
-
20
19
  raise Targetdata::Errors::PersonNotFound unless person_found?(parsed)
21
- parsed["result"].first["pessoa"]["cadastral"]
20
+ parse_person_hash parsed
22
21
  end
23
22
 
24
23
  def person_found? hash
25
24
  !hash["result"].empty?
26
25
  end
26
+
27
+ def parse_person_hash hash
28
+ pessoa = hash["result"].first["pessoa"]
29
+ pessoa["cadastral"]["email"] = nil
30
+
31
+ if hash["report"]["email"] >= 1
32
+ pessoa["cadastral"]["email"] = pessoa["contato"]["email"].first["email"]
33
+ end
34
+
35
+ pessoa["cadastral"]
36
+ end
27
37
  end
28
38
  end
29
39
  end
@@ -2,6 +2,7 @@ module Targetdata
2
2
  module Entities
3
3
  class Person
4
4
  attr_accessor :cpf,
5
+ :email,
5
6
  :first_name,
6
7
  :middle_name,
7
8
  :last_name,
@@ -23,6 +24,7 @@ module Targetdata
23
24
 
24
25
  def initialize params = {}
25
26
  @cpf = params['CPF']
27
+ @email = params['email']
26
28
  @first_name = params['nomePrimeiro']
27
29
  @middle_name = params['nomeMeio']
28
30
  @last_name = params['nomeUltimo']
@@ -1,3 +1,3 @@
1
1
  module Targetdata
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: targetdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Pastro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http