myfinance-rails 0.0.13 → 0.1.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 +4 -4
- data/lib/myfinance/conta_a_receber.rb +20 -7
- data/lib/myfinance/version.rb +1 -1
- data/spec/features/contas_a_receber_spec.rb +24 -12
- 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: 9f1621ba54bf57f2b4fe5c020bec296c5b92e18b
|
4
|
+
data.tar.gz: 8f8306ded00a2ef04499e79ebe9bb7b90d2e2fdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 303543c14f930986776e36ffd562d4f9d278d5a6b9279d44910d74d36839bbccfe574911f688f6fd490b0ca1f4e11359a943a7b6d3670d3e752066dc4decdd5a
|
7
|
+
data.tar.gz: b5c6a970faf24df05595c8e5d64172e8e6c78c89d76cf628b96dc91cf8ea235504f1e5536fbb3f4c7a232a2ee1097d5fe29d3b746e6770de9f48add4be4cb1db
|
@@ -1,16 +1,12 @@
|
|
1
1
|
module Myfinance
|
2
|
-
|
3
2
|
def self.cria_conta_a_receber_entidade(nome_da_entidade,faturamento)
|
4
3
|
entity_id = entidade_id(nome_da_entidade)
|
5
4
|
cria_conta_a_receber(entity_id,faturamento)
|
6
5
|
end
|
7
6
|
|
8
|
-
def self.cria_conta_a_receber(entity_id,faturamento)
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
response = lpost "/entities/#{entity_id}/receivable_accounts.json", receivable_account
|
13
|
-
response
|
7
|
+
def self.cria_conta_a_receber(entity_id, faturamento)
|
8
|
+
lpost "/entities/#{entity_id}/receivable_accounts.json",
|
9
|
+
parametro_conta_a_receber(faturamento)
|
14
10
|
end
|
15
11
|
|
16
12
|
def self.conta_a_receber(id, entity_id)
|
@@ -24,4 +20,21 @@ module Myfinance
|
|
24
20
|
def self.altera_conta_a_receber(id, entity_id, faturamento)
|
25
21
|
lput "/entities/#{entity_id}/receivable_accounts/#{id}.json", faturamento
|
26
22
|
end
|
23
|
+
|
24
|
+
def self.recebe_conta_a_receber(id, entity_id, faturamento)
|
25
|
+
lput "/entities/#{entity_id}/receivable_accounts/#{id}/receive.json",
|
26
|
+
parametro_conta_a_receber(faturamento)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.desfaz_recebimento_de_conta_a_receber(id, entity_id)
|
30
|
+
lput "/entities/#{entity_id}/receivable_accounts/#{id}/undo_receivement.json", {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.parametro_conta_a_receber(faturamento)
|
34
|
+
receivable_account = {
|
35
|
+
'receivable_account' => faturamento
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
private_class_method :parametro_conta_a_receber
|
27
40
|
end
|
data/lib/myfinance/version.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
describe 'Manipulando Contas a Receber', type: :feature do
|
2
|
-
|
3
2
|
require 'myfinance'
|
4
3
|
|
5
4
|
it 'Se a cav não der acesso, ja devemos dar erro na chamado do setup' do
|
6
|
-
expect { Myfinance.setup('nowaythiskeucanwork') }.to raise_error
|
5
|
+
expect { Myfinance.setup('nowaythiskeucanwork') }.to raise_error(RuntimeError)
|
7
6
|
end
|
8
7
|
|
9
8
|
it 'Se a cav não der acesso, ja devemos dar erro na chamado do setup' do
|
@@ -56,29 +55,42 @@ describe 'Manipulando Contas a Receber', type: :feature do
|
|
56
55
|
|
57
56
|
]
|
58
57
|
}
|
59
|
-
conta_a_receber = Myfinance.cria_conta_a_receber_entidade('Minhas Finanças',faturamento)
|
58
|
+
conta_a_receber = Myfinance.cria_conta_a_receber_entidade('Minhas Finanças', faturamento)
|
60
59
|
expect(conta_a_receber['receivable_account']).to_not be_nil
|
61
60
|
|
62
|
-
conta_a_receber = Myfinance.cria_conta_a_receber(entidade_id,faturamento)
|
61
|
+
conta_a_receber = Myfinance.cria_conta_a_receber(entidade_id, faturamento)
|
63
62
|
expect(conta_a_receber['receivable_account']).to_not be_nil
|
64
63
|
end
|
65
64
|
|
66
|
-
it '
|
67
|
-
|
65
|
+
it '.conta_a_receber' do
|
66
|
+
conta_a_receber_double = double('conta_a_receber')
|
68
67
|
expect(Myfinance).to receive(:lget).once.with("/entities/2/receivable_accounts/1.json").and_return conta_a_receber_double
|
69
68
|
expect(Myfinance.conta_a_receber(1,2)).to eql(conta_a_receber_double)
|
70
69
|
end
|
71
70
|
|
72
|
-
it "
|
73
|
-
|
71
|
+
it ".apaga_conta_a_receber" do
|
72
|
+
conta_a_receber_double = double('conta_a_receber')
|
74
73
|
expect(Myfinance).to receive(:ldelete).once.with("/entities/2/receivable_accounts/1.json").and_return conta_a_receber_double
|
75
74
|
expect(Myfinance.apaga_conta_a_receber(1, 2)).to eql(conta_a_receber_double)
|
76
75
|
end
|
77
76
|
|
78
|
-
it "
|
79
|
-
|
80
|
-
|
77
|
+
it ".altera_conta_a_receber" do
|
78
|
+
conta_a_receber_parameters_double = double('conta_a_receber_parameters')
|
79
|
+
conta_a_receber_double = double('conta_a_receber')
|
81
80
|
expect(Myfinance).to receive(:lput).once.with("/entities/2/receivable_accounts/1.json", conta_a_receber_parameters_double).and_return conta_a_receber_double
|
82
81
|
expect(Myfinance.altera_conta_a_receber(1, 2, conta_a_receber_parameters_double)).to eql(conta_a_receber_double)
|
83
82
|
end
|
84
|
-
|
83
|
+
|
84
|
+
it ".recebe_conta_a_receber" do
|
85
|
+
conta_a_receber_parameters_double = double('conta_a_receber_parameters')
|
86
|
+
conta_a_receber_double = double('conta_a_receber')
|
87
|
+
expect(Myfinance).to receive(:lput).once.with("/entities/2/receivable_accounts/1/receive.json", 'receivable_account' => conta_a_receber_parameters_double).and_return conta_a_receber_double
|
88
|
+
expect(Myfinance.recebe_conta_a_receber(1, 2, conta_a_receber_parameters_double)).to eql(conta_a_receber_double)
|
89
|
+
end
|
90
|
+
|
91
|
+
it ".desfaz_recebimento_de_conta_a_receber" do
|
92
|
+
conta_a_receber_double = double('conta_a_receber')
|
93
|
+
expect(Myfinance).to receive(:lput).once.with("/entities/2/receivable_accounts/1/undo_receivement.json", {}).and_return conta_a_receber_double
|
94
|
+
expect(Myfinance.desfaz_recebimento_de_conta_a_receber(1, 2)).to eql(conta_a_receber_double)
|
95
|
+
end
|
96
|
+
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.0
|
4
|
+
version: 0.1.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-
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|