myfinance-rails 0.2.0 → 0.3.0

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: b1d0a342fa46b7fe310ab6cf6f7816987a9c7186
4
- data.tar.gz: 19c2ba771beb72837f9b2c30f5e867a35db25347
3
+ metadata.gz: 57f5cd588cb00d27f3279925bcc6bea51f3683d5
4
+ data.tar.gz: 96f9b46ff5c211bd685aa0795193548002f3a52b
5
5
  SHA512:
6
- metadata.gz: 8473f2a1cc5aa6bdeafd6a7bc4dc890e657f70003b7b869ebf34f5247f9df9c8f99abdadc7b73530f2f0fcbab8700edff25e77e96f3990fe22435414e4f51d9e
7
- data.tar.gz: a19152b3221b3770aa9b9e25883d32b2889147309a0d77d864c47ccb15db442e359cf741cd4311e8df929ca31d04c35a113276237012fcdad529188fc9f31d1c
6
+ metadata.gz: 061902573778b544bd25f99cd21970bacb16def8e6083a8593e680e86dbe6502d6513903ed34ce6db1e3225dfcaaf319c7739a41aef64f631f95bc473e950240
7
+ data.tar.gz: 5b614f64b5cb5856f7e18dc6f30d432ed7e70064588cb569cf8802346714a8600ab7610a5619a59efc4e6260b21d2efa8a9fc55cc19c8f0791ecc1658e3b5f82
@@ -3,5 +3,16 @@ module Myfinance
3
3
  def self.contas_deposito(entity_id)
4
4
  lget "/entities/#{entity_id}/deposit_accounts.json"
5
5
  end
6
- end
7
6
 
7
+ def self.conta_deposito_id(entity_id, nome)
8
+ mid = nil
9
+ contas_deposito(entity_id).each do | item |
10
+ conta = item["deposit_account"]
11
+ if conta["name"].strip == nome.strip
12
+ mid = conta["id"]
13
+ break
14
+ end
15
+ end
16
+ mid
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Myfinance
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -7,4 +7,18 @@ describe 'Manipulando Contas de Depósito', type: :feature do
7
7
  expect(Myfinance).to receive(:lget).once.with("/entities/1/deposit_accounts.json").and_return contas_deposito_double
8
8
  expect(Myfinance.contas_deposito(1)).to eql(contas_deposito_double)
9
9
  end
10
+
11
+ describe '#conta_deposito_id' do
12
+ let!(:deposit_accounts_double) { [{"deposit_account"=>{"id"=>14330, "name"=>"Bradesco"}}, {"deposit_account"=>{"id"=>14331, "name"=>"Itaú"}}] }
13
+ before do
14
+ allow(Myfinance).to receive(:contas_deposito).with(1).and_return(deposit_accounts_double)
15
+ end
16
+
17
+ it "returns nil if no deposit account found" do
18
+ expect(Myfinance.conta_deposito_id(1, "Citi")).to be nil
19
+ end
20
+ it "returns informed deposit account" do
21
+ expect(Myfinance.conta_deposito_id(1, "Itaú")).to eql 14331
22
+ end
23
+ end
10
24
  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.2.0
4
+ version: 0.3.0
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: 2015-12-23 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler