vpsa 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/vpsa/api/receipts.rb +17 -0
- data/lib/vpsa/client.rb +5 -1
- data/lib/vpsa/searcher/financial/receipt_searcher.rb +11 -0
- data/lib/vpsa/version.rb +1 -1
- data/spec/vpsa/api/receipts_spec.rb +31 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4cb53b94e046ba251de8f3563af8d960df7e156
|
4
|
+
data.tar.gz: 4cf45332c6d317c2f786f15431a0f5c030cccac2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de430bc0efcf142dc54d27f75de06c0b2fdae71db267fb6ac1dd587ca51e1b8809edac9fb496f1b58e65f517d79da56a73bb2592d5737a27d99b0c77f9ea9667
|
7
|
+
data.tar.gz: 034fd6b2233ae57661fab0f6945d8aa5858f5e92ba07350409a7ab26e649ada0f3d7989b643005d422601826508165b93fa7a650b11fac8d118fea742705d324
|
data/README.md
CHANGED
@@ -36,6 +36,7 @@ With the client instance, you can access the following resources:
|
|
36
36
|
* Provisões (client.provisions) **Only Creation**
|
37
37
|
* Dados Login (client.user_data)
|
38
38
|
* Classes de Clientes (client.client_classes) **Listing and finding**
|
39
|
+
* Contas a Receber (client.receipts) **Only listing**
|
39
40
|
|
40
41
|
## Using the resources
|
41
42
|
### Listing
|
@@ -48,6 +49,7 @@ Currently the following entities are implemented:
|
|
48
49
|
* [Terceiros](lib/vpsa/searcher/administrative/third_party_searcher.rb)
|
49
50
|
* [Entidades](lib/vpsa/searcher/administrative/entity_searcher.rb)
|
50
51
|
* [Lançamentos Padrões](lib/vpsa/searcher/financial/default_entry_searcher.rb)
|
52
|
+
* [Contas a Receber](lib/vpsa/searcher/financial/receipt_searcher.rb)
|
51
53
|
* [Classes de Clientes](lib/vpsa/searcher/operational/client_class_searcher.rb)
|
52
54
|
|
53
55
|
### Finding
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Vpsa
|
2
|
+
module Api
|
3
|
+
class Receipts < Client
|
4
|
+
require_all 'vpsa/searcher/financial', 'receipt_searcher'
|
5
|
+
|
6
|
+
base_uri "#{Vpsa::API_ADDRESS}/contas-receber"
|
7
|
+
|
8
|
+
def list(searcher = nil)
|
9
|
+
raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Financial::ReceiptSearcher)
|
10
|
+
|
11
|
+
return parse_response(self.class.get("/", :body => build_body(searcher.as_parameter), :headers => header)) if searcher
|
12
|
+
return parse_response(self.class.get("/", :body => build_body, :headers => header)) unless searcher
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/vpsa/client.rb
CHANGED
@@ -9,7 +9,7 @@ module Vpsa
|
|
9
9
|
default_options.update(verify: false)
|
10
10
|
parser Proc.new {|b| JSON.parse(b) rescue b}
|
11
11
|
|
12
|
-
require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions', 'user_data', 'installments', 'credit_limits', 'client_classes'
|
12
|
+
require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions', 'user_data', 'installments', 'credit_limits', 'client_classes', 'receipts'
|
13
13
|
|
14
14
|
attr_accessor :access_token
|
15
15
|
|
@@ -45,6 +45,10 @@ module Vpsa
|
|
45
45
|
def credit_limits
|
46
46
|
Vpsa::Api::CreditLimits.new(@access_token)
|
47
47
|
end
|
48
|
+
|
49
|
+
def receipts
|
50
|
+
Vpsa::Api::Receipts.new(@access_token)
|
51
|
+
end
|
48
52
|
|
49
53
|
def client_classes
|
50
54
|
Vpsa::Api::ClientClasses.new(@access_token)
|
data/lib/vpsa/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
RSpec.describe Vpsa::Api::Receipts do
|
5
|
+
let(:header) {{"Content-Type" => "application/json", "Accept" => "application/json"}}
|
6
|
+
|
7
|
+
describe "listing" do
|
8
|
+
before(:each) do
|
9
|
+
stub_request(:get, "#{Vpsa::API_ADDRESS}/contas-receber/").to_return(:status => 200)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should issue a get to the receipts url" do
|
13
|
+
expect(Vpsa::Api::Receipts).to receive(:get).with("/", :body => {:token => "abc"}.to_json, :headers => header).and_call_original
|
14
|
+
|
15
|
+
Vpsa.new("abc").receipts.list()
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should issue a get to the reciepts url using the searcher" do
|
19
|
+
searcher = Vpsa::Searcher::Financial::ReceiptSearcher.new({:quantidade => 10, :inicio => 0,
|
20
|
+
:desde => '01-01-2015', :ate => '10-01-2015', :filtroData => 'dataVencimento', :alteradoApos => '01-01-2015 10:10:10'})
|
21
|
+
|
22
|
+
expect(Vpsa::Api::Receipts).to receive(:get).with("/", :body => searcher.as_parameter.merge!({:token => "abc"}).to_json, :headers => header).and_call_original
|
23
|
+
|
24
|
+
Vpsa.new("abc").receipts.list(searcher)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should raise ArgumentError if the parameter is not a ReceiptSearcher" do
|
28
|
+
expect{Vpsa.new("abc").receipts.list(Array.new)}.to raise_error(ArgumentError)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vpsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Berdugo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/vpsa/api/entities.rb
|
60
60
|
- lib/vpsa/api/installments.rb
|
61
61
|
- lib/vpsa/api/provisions.rb
|
62
|
+
- lib/vpsa/api/receipts.rb
|
62
63
|
- lib/vpsa/api/third_parties.rb
|
63
64
|
- lib/vpsa/api/user_data.rb
|
64
65
|
- lib/vpsa/client.rb
|
@@ -74,6 +75,7 @@ files:
|
|
74
75
|
- lib/vpsa/searcher/base.rb
|
75
76
|
- lib/vpsa/searcher/commercial/credit_limit_searcher.rb
|
76
77
|
- lib/vpsa/searcher/financial/default_entry_searcher.rb
|
78
|
+
- lib/vpsa/searcher/financial/receipt_searcher.rb
|
77
79
|
- lib/vpsa/searcher/operational/client_class_searcher.rb
|
78
80
|
- lib/vpsa/version.rb
|
79
81
|
- spec/spec_helper.rb
|
@@ -83,6 +85,7 @@ files:
|
|
83
85
|
- spec/vpsa/api/entities_spec.rb
|
84
86
|
- spec/vpsa/api/installments_spec.rb
|
85
87
|
- spec/vpsa/api/provisions_spec.rb
|
88
|
+
- spec/vpsa/api/receipts_spec.rb
|
86
89
|
- spec/vpsa/api/third_parties_spec.rb
|
87
90
|
- spec/vpsa/api/user_data_spec.rb
|
88
91
|
- spec/vpsa/client_spec.rb
|
@@ -125,6 +128,7 @@ test_files:
|
|
125
128
|
- spec/vpsa/api/entities_spec.rb
|
126
129
|
- spec/vpsa/api/installments_spec.rb
|
127
130
|
- spec/vpsa/api/provisions_spec.rb
|
131
|
+
- spec/vpsa/api/receipts_spec.rb
|
128
132
|
- spec/vpsa/api/third_parties_spec.rb
|
129
133
|
- spec/vpsa/api/user_data_spec.rb
|
130
134
|
- spec/vpsa/client_spec.rb
|