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 +4 -4
- data/lib/myfinance/conta_deposito.rb +12 -1
- data/lib/myfinance/version.rb +1 -1
- data/spec/features/conta_deposito_spec.rb +14 -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: 57f5cd588cb00d27f3279925bcc6bea51f3683d5
|
4
|
+
data.tar.gz: 96f9b46ff5c211bd685aa0795193548002f3a52b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/myfinance/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|