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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ce11a33b8bdb6a47fc804d5164d84ef0d34d5f9
4
- data.tar.gz: 80e4f5f46b85dd5a1424611631e67769b0b8288b
3
+ metadata.gz: 9f1621ba54bf57f2b4fe5c020bec296c5b92e18b
4
+ data.tar.gz: 8f8306ded00a2ef04499e79ebe9bb7b90d2e2fdc
5
5
  SHA512:
6
- metadata.gz: 814f92a8d01dfb82ff6732c327514069eeef0be3d1999676d9bc591298b13bfdd50e273930907e5bf9eea6e5c35d153310117647c9c4562e55644c0c44d41e52
7
- data.tar.gz: ab2ccda7aa896b905bd72fed66bda8c55583238b9f5ba81eb79a2f61326adfb15d22995b2bc800aaab0d23a34f5deb9275eb2517467cf64abd2909cdc6959a4e
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
- receivable_account = {
10
- 'receivable_account' => faturamento
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
@@ -1,3 +1,3 @@
1
1
  module Myfinance
2
- VERSION = '0.0.13'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -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 '#conta_a_receber' do
67
- double conta_a_receber_double = double('conta_a_receber')
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 "#apaga_conta_a_receber" do
73
- double conta_a_receber_double = double('conta_a_receber')
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 "#altera_conta_a_receber" do
79
- double conta_a_receber_parameters_double = double('conta_a_receber_parameters')
80
- double conta_a_receber_double = double('conta_a_receber')
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
- end
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.13
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-01-15 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler