vpsa 0.0.13 → 0.0.14
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/vpsa/api/credit_limits.rb +1 -1
- data/lib/vpsa/api/sales.rb +12 -0
- data/lib/vpsa/client.rb +5 -1
- data/lib/vpsa/version.rb +1 -1
- data/spec/vpsa/api/credit_limits_spec.rb +1 -1
- data/spec/vpsa/api/sales_spec.rb +23 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a333f8cb914196de8f67bb89f2e57d20ed2c5989
|
4
|
+
data.tar.gz: 6457977c5332482be43d0ea6c25dce5343d61f00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67c28b55e97a040f704dbb5c005e9ebbe62ba9e35c907c7add0176a796209563b289c0cb3393f5d5361a558487d0291573262292e36caee2f4b36a3f08d7f56
|
7
|
+
data.tar.gz: fbd51195054ec5e9deda2d6aceecd1fe87887872324479b94e20d9d420bd6dd1461c9f3e0203f9722a5f12def22531d44aed39c1068f54096b69af15420f253b
|
@@ -3,7 +3,7 @@ module Vpsa
|
|
3
3
|
class CreditLimits < Client
|
4
4
|
require_all 'vpsa/searcher/commercial', 'credit_limit_searcher'
|
5
5
|
|
6
|
-
base_uri "#{Vpsa::API_ADDRESS}/
|
6
|
+
base_uri "#{Vpsa::API_ADDRESS}/limites_credito"
|
7
7
|
|
8
8
|
def list(searcher = nil)
|
9
9
|
raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Commercial::CreditLimitSearcher)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Vpsa
|
2
|
+
module Api
|
3
|
+
class Sales < Client
|
4
|
+
|
5
|
+
base_uri "#{Vpsa::API_ADDRESS}/externa/historico-vendas-terceiro"
|
6
|
+
|
7
|
+
def sales_history(id)
|
8
|
+
return parse_response(self.class.get("/buscar?terceiro=#{id}", :body => build_body, :headers => header))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
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', 'receipts'
|
12
|
+
require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions', 'user_data', 'installments', 'credit_limits', 'client_classes', 'receipts', 'sales'
|
13
13
|
|
14
14
|
attr_accessor :access_token
|
15
15
|
|
@@ -54,6 +54,10 @@ module Vpsa
|
|
54
54
|
Vpsa::Api::ClientClasses.new(@access_token)
|
55
55
|
end
|
56
56
|
|
57
|
+
def sales
|
58
|
+
Vpsa::Api::Sales.new(@access_token)
|
59
|
+
end
|
60
|
+
|
57
61
|
protected
|
58
62
|
def header
|
59
63
|
{"Content-Type" => "application/json", "Accept" => "application/json"}
|
data/lib/vpsa/version.rb
CHANGED
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::CreditLimits do
|
|
5
5
|
|
6
6
|
describe "listing" do
|
7
7
|
before(:each) do
|
8
|
-
stub_request(:get, "#{Vpsa::API_ADDRESS}/
|
8
|
+
stub_request(:get, "#{Vpsa::API_ADDRESS}/limites_credito/").to_return(:status => 200)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should issue a get to the credit_limits url" do
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Vpsa::Api::Sales do
|
4
|
+
let(:header) {{"Content-Type" => "application/json", "Accept" => "application/json"}}
|
5
|
+
|
6
|
+
describe "information" do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
stub_request(:get, "https://www.vpsa.com.br/apps/api/externa/historico-vendas-terceiro/buscar?terceiro=1").
|
10
|
+
with(:body => "{\"token\":\"abc\"}",
|
11
|
+
:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
|
12
|
+
to_return(:status => 200, :body => "", :headers => {})
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should issue a get to the sales url" do
|
17
|
+
expect(Vpsa::Api::Sales).to receive(:get).with("/buscar?terceiro=1", :body => {:token => "abc"}.to_json, :headers => header).and_call_original
|
18
|
+
|
19
|
+
Vpsa.new("abc").sales.sales_history(1)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
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.14
|
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-05-
|
11
|
+
date: 2015-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/vpsa/api/installments.rb
|
61
61
|
- lib/vpsa/api/provisions.rb
|
62
62
|
- lib/vpsa/api/receipts.rb
|
63
|
+
- lib/vpsa/api/sales.rb
|
63
64
|
- lib/vpsa/api/third_parties.rb
|
64
65
|
- lib/vpsa/api/user_data.rb
|
65
66
|
- lib/vpsa/client.rb
|
@@ -86,6 +87,7 @@ files:
|
|
86
87
|
- spec/vpsa/api/installments_spec.rb
|
87
88
|
- spec/vpsa/api/provisions_spec.rb
|
88
89
|
- spec/vpsa/api/receipts_spec.rb
|
90
|
+
- spec/vpsa/api/sales_spec.rb
|
89
91
|
- spec/vpsa/api/third_parties_spec.rb
|
90
92
|
- spec/vpsa/api/user_data_spec.rb
|
91
93
|
- spec/vpsa/client_spec.rb
|
@@ -129,6 +131,7 @@ test_files:
|
|
129
131
|
- spec/vpsa/api/installments_spec.rb
|
130
132
|
- spec/vpsa/api/provisions_spec.rb
|
131
133
|
- spec/vpsa/api/receipts_spec.rb
|
134
|
+
- spec/vpsa/api/sales_spec.rb
|
132
135
|
- spec/vpsa/api/third_parties_spec.rb
|
133
136
|
- spec/vpsa/api/user_data_spec.rb
|
134
137
|
- spec/vpsa/client_spec.rb
|