myfinance-rails 0.4.0 → 0.4.1
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 +4 -4
- data/lib/myfinance/pessoa.rb +4 -4
- data/lib/myfinance/version.rb +1 -1
- data/spec/features/pessoas_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6021b9433531bc5ccdbe374ef381f385549b2fc
|
4
|
+
data.tar.gz: 10a749967c5f4ec4b715c371224d49952c5b8884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81c27ef81b085a63f8273be09b2fd722b490a3669b5bd07ec6672308d0748269705042cf0d1cf009d1d5818c8a533253f07bf8fd6d52835fd9778a12daad6640
|
7
|
+
data.tar.gz: f7f875bc67e0afdb85403876cc7a92d6d388b1fd912944ea45f3f142eb8df7a5588a152d2e87d87d42311cd367ecf8904faa573a07371805bab838a404e784e4
|
data/lib/myfinance/pessoa.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Myfinance
|
2
2
|
|
3
|
-
def self.pessoa_id(
|
3
|
+
def self.pessoa_id(cnpj_ou_nome)
|
4
4
|
@everyone ||= all_people
|
5
5
|
mid = nil
|
6
6
|
@everyone.each do | pessoa |
|
7
|
-
if pessoa['federation_subscription_number_only_numbers'] ==
|
7
|
+
if pessoa['federation_subscription_number_only_numbers'] == cnpj_ou_nome or pessoa['federation_subscription_number'] == cnpj_ou_nome or pessoa['name'] == cnpj_ou_nome
|
8
8
|
mid = pessoa['id']
|
9
9
|
break
|
10
10
|
end
|
@@ -25,8 +25,8 @@ module Myfinance
|
|
25
25
|
everyone
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.pessoa(
|
29
|
-
mid = pessoa_id(
|
28
|
+
def self.pessoa(cnpj_ou_nome)
|
29
|
+
mid = pessoa_id(cnpj_ou_nome)
|
30
30
|
response = lget "/people/#{mid}.json"
|
31
31
|
response['person'] if response
|
32
32
|
end
|
data/lib/myfinance/version.rb
CHANGED
@@ -43,4 +43,21 @@ describe 'Manipulando Pessoas', type: :feature do
|
|
43
43
|
expect(id).to be_nil
|
44
44
|
end
|
45
45
|
|
46
|
+
it 'Se procurar por um cnpj cadastrado, deve voltar id' do
|
47
|
+
Myfinance.setup('2acecbb483842ebbfb2c638070bf019b70e757190166d277')
|
48
|
+
id = Myfinance.pessoa_id('27206831000170')
|
49
|
+
expect(id).to_not be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'Se procurar por nome cadastrado, deve voltar id' do
|
53
|
+
Myfinance.setup('2acecbb483842ebbfb2c638070bf019b70e757190166d277')
|
54
|
+
id = Myfinance.pessoa_id('Ciclano')
|
55
|
+
expect(id).to_not be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'Se procurar por nome não cadastrado, deve voltar id nulo' do
|
59
|
+
Myfinance.setup('2acecbb483842ebbfb2c638070bf019b70e757190166d277')
|
60
|
+
id = Myfinance.pessoa_id('Ciclano Ciclano')
|
61
|
+
expect(id).to be_nil
|
62
|
+
end
|
46
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myfinance-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Lopes Neto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|