myfinance-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5096f3fdce0ff776d195cd13f5cec9c6583d615
4
- data.tar.gz: b4177508bbc9976362c047ee9bbc5fae236aa95c
3
+ metadata.gz: d6021b9433531bc5ccdbe374ef381f385549b2fc
4
+ data.tar.gz: 10a749967c5f4ec4b715c371224d49952c5b8884
5
5
  SHA512:
6
- metadata.gz: d490ee81a0f3b14a49b23cea8e1861c7e92b8593cd1d9bb4a78230e03585991108b637c7e3abbb43f6630f7dd1ebe92ea6f2814613180979674aa91f71c74858
7
- data.tar.gz: 2761ebc5414bc9f59f89886c5a81485c039f8d58a35b31e6379163366813dc77b72879c53b2e5ddc6e98a186471d89e16ff159164545443d3af87a89bc33bc11
6
+ metadata.gz: 81c27ef81b085a63f8273be09b2fd722b490a3669b5bd07ec6672308d0748269705042cf0d1cf009d1d5818c8a533253f07bf8fd6d52835fd9778a12daad6640
7
+ data.tar.gz: f7f875bc67e0afdb85403876cc7a92d6d388b1fd912944ea45f3f142eb8df7a5588a152d2e87d87d42311cd367ecf8904faa573a07371805bab838a404e784e4
@@ -1,10 +1,10 @@
1
1
  module Myfinance
2
2
 
3
- def self.pessoa_id(cnpj)
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'] == cnpj or pessoa['federation_subscription_number'] == cnpj
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(cnpj)
29
- mid = pessoa_id(cnpj)
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
@@ -1,3 +1,3 @@
1
1
  module Myfinance
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -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.0
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-02-23 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler