vpsa 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8eec1315d01c5d12bcf6dc30b9ccd143fa057f93
4
- data.tar.gz: fe9ee2c60a53f3123aa799f92f922b2d5eff06bb
3
+ metadata.gz: ef29e2bf484ce5e55c7c79c0b5447200fefcac05
4
+ data.tar.gz: 2726286c44320cf0d728fba79beecdee594a361c
5
5
  SHA512:
6
- metadata.gz: 67c881e6521434b03321f75bb67f31fdc9e0e701df6d8e76f739ce3b90988dfd0c20b86879c1094f381f0a02b0ce8bee9af1810bc4ad6b7a6f81ce69c0cec3a5
7
- data.tar.gz: 04a810247fb540d11d78f0766b7f83b88de7bf7624eadca7ddb16ed3ac483aa757822d82818fc4a280c09ea6d15bbcb4199b6ad7cb8abea9b9aaa14a36d727e6
6
+ metadata.gz: 1444efdd3881bf88d899bc968e41347a5f9f7f5c7cd47220f6ea13e29778d05dfa6899acb785a3bb74038d50246599b4da9f81d4bf0998e46c1b41f2232b6266
7
+ data.tar.gz: b443b4440cbff8c60cc7bc70de9ea73805ac2b6f62097c4761f47b2315363a3e0fe4bdeae36eb26ff5a65c6ca00c7310cec13c9839e808504e9d4114e8ebdbe0
@@ -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}/limitescredito"
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
@@ -30,8 +30,8 @@ module Vpsa
30
30
  end
31
31
 
32
32
  def update_credit_limit(id, data)
33
- return parse_response(self.class.put("/#{id}/limites_credito", :body => build_body(data), :headers => header)) if data.is_a?(Hash)
34
- return parse_response(self.class.put("/#{id}/limites_credito", :body => build_body(data.as_parameter), :headers => header)) if data.is_a?(Vpsa::Entity::Commercial::CreditLimit)
33
+ return parse_response(self.class.put("/#{id}/limites_credito/#{id}", :body => build_body(data), :headers => header)) if data.is_a?(Hash)
34
+ return parse_response(self.class.put("/#{id}/limites_credito/#{id}", :body => build_body(data.as_parameter), :headers => header)) if data.is_a?(Vpsa::Entity::Commercial::CreditLimit)
35
35
  raise ArgumentError
36
36
  end
37
37
 
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"}
@@ -4,9 +4,42 @@ module Vpsa
4
4
  module Entity
5
5
  module Commercial
6
6
  class Installment < Base
7
- attr_accessor :"bloquearSemAnalise", :bloqueio, :"mensagemBloqueio", :"liberarValorExcedente", :"liberarBloqueioManual", :"venderSemAnalise"
8
- attr_accessor :"creditoMaximoPorCliente", :"valorCreditoMaximoPorCliente", :"calculoValorCredito", :"limiteMensalMaximo"
7
+ attr_accessor :"bloquearClienteSemAnalise", :bloqueioAutomatico, :"mensagemBloqueio", :"permissaoValorExcedente"
8
+ attr_accessor :"permiteLiberarBloqueioManual", :"permiteVenderSemAnalise"
9
+ attr_accessor :"creditoMaximoCliente", :"valorCredMaximoCliente", :"limiteMensal", :limiteCreditoSobreRenda, :limiteSobreRenda
10
+ attr_accessor :totalCredito
9
11
  end
10
12
  end
11
13
  end
12
- end
14
+ end
15
+
16
+
17
+ # private boolean bloquearClienteSemAnalise;//
18
+ # private boolean bloqueioAutomatico;//
19
+ # private String mensagemBloqueio;//
20
+ # private boolean permissaoValorExcedente;//
21
+ #
22
+ # private boolean permiteLiberarBloqueioManual;//
23
+ # private boolean permiteVenderSemAnalise;//
24
+ #
25
+ # private BigDecimal creditoMaximoCliente;//
26
+ # private boolean valorCredMaximoCliente;//
27
+ #
28
+ #
29
+ # private String limiteMensal;//
30
+ #
31
+ # private boolean limiteCreditoSobreRenda;
32
+ # private BigDecimal limiteSobreRenda;
33
+
34
+ # private BigDecimal totalCredito;
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ # private boolean bloquearPorChequeDevolvido;
44
+ #
45
+ //
@@ -8,4 +8,4 @@ module Vpsa
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
data/lib/vpsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vpsa
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
@@ -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}/limitescredito/").to_return(:status => 200)
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
@@ -25,7 +25,7 @@ RSpec.describe Vpsa::Api::Installments do
25
25
  it "should issue a post to the installments url" do
26
26
  expect(Vpsa::Api::Installments).to receive(:put).with("/", :body => installment_param.merge!({:token => "abc"}).to_json, :headers => header).and_call_original
27
27
 
28
- Vpsa.new("abc").installments.configure(installment_param)
28
+ Vpsa.new("abc").installments.configure( installment_param)
29
29
  end
30
30
  end
31
31
  end
@@ -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, "#{Vpsa::API_ADDRESS}/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
@@ -103,12 +103,12 @@ RSpec.describe Vpsa::Api::ThirdParties do
103
103
  before(:each) do
104
104
  @credit_limit = Vpsa::Entity::Commercial::CreditLimit.new({"total" => BigDecimal.new("154.32")})
105
105
 
106
- stub_request(:put, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito").to_return(:status => 200)
106
+ stub_request(:put, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito/5").to_return(:status => 200)
107
107
  end
108
108
 
109
109
  describe "with raw parameters" do
110
110
  it "should put to the third party credit limit url" do
111
- expect(Vpsa::Api::ThirdParties).to receive(:put).with("/5/limites_credito", :body => credit_limit_params.to_json, :headers => header).and_call_original
111
+ expect(Vpsa::Api::ThirdParties).to receive(:put).with("/5/limites_credito/5", :body => credit_limit_params.to_json, :headers => header).and_call_original
112
112
 
113
113
  Vpsa.new("abc").third_parties.update_credit_limit(5, {"total" => BigDecimal.new("154.32")})
114
114
  end
@@ -116,7 +116,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
116
116
 
117
117
  describe "with entity parameter" do
118
118
  it "should put to the third party credit limit url" do
119
- expect(Vpsa::Api::ThirdParties).to receive(:put).with("/5/limites_credito", :body => @credit_limit.as_parameter.merge!(:token => "abc").to_json, :headers => header).and_call_original
119
+ expect(Vpsa::Api::ThirdParties).to receive(:put).with("/5/limites_credito/5", :body => @credit_limit.as_parameter.merge!(:token => "abc").to_json, :headers => header).and_call_original
120
120
 
121
121
  Vpsa.new("abc").third_parties.update_credit_limit(5, @credit_limit)
122
122
  end
@@ -2,16 +2,17 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe Vpsa::Entity::Commercial::Installment do
4
4
  describe "as_parameter" do
5
- let(:installment_as_parameter) {{"bloquearSemAnalise" => true, "bloqueio" => "MANUAL", "mensagemBloqueio" => "Seu crédito está bloqueado! :(",
6
- "liberarValorExcedente" => false, "liberarBloqueioManual" => true, "venderSemAnalise" => false, "creditoMaximoPorCliente" => true,
7
- "valorCreditoMaximoPorCliente" => BigDecimal.new("1000.35"), "calculoValorCredito" => "LIMITE_SOBRE_RENDA",
8
- "limiteMensalMaximo" => "SOBRE_TOTAL_DE_CREDITO"}}
5
+
6
+ let(:installment_as_parameter) {{"bloquearClienteSemAnalise" => true, "bloqueioAutomatico" => true, "mensagemBloqueio" => "Seu crédito está bloqueado! :(",
7
+ "permissaoValorExcedente" => false, "permiteLiberarBloqueioManual" => true, "permiteVenderSemAnalise" => false, "valorCredMaximoCliente" => true,
8
+ "creditoMaximoCliente" => BigDecimal.new("1000.35"), "limiteMensal" => "SOBRE_TOTAL_DE_CREDITO", "limiteCreditoSobreRenda" => true,
9
+ "limiteSobreRenda" => BigDecimal.new("10.35")}}
9
10
 
10
11
  it "should return the installment as parameter" do
11
- installment = Vpsa::Entity::Commercial::Installment.new({"bloquearSemAnalise" => true, "bloqueio" => "MANUAL", "mensagemBloqueio" => "Seu crédito está bloqueado! :(",
12
- "liberarValorExcedente" => false, "liberarBloqueioManual" => true, "venderSemAnalise" => false, "creditoMaximoPorCliente" => true,
13
- "valorCreditoMaximoPorCliente" => BigDecimal.new("1000.35"), "calculoValorCredito" => "LIMITE_SOBRE_RENDA",
14
- "limiteMensalMaximo" => "SOBRE_TOTAL_DE_CREDITO"})
12
+ installment = Vpsa::Entity::Commercial::Installment.new({"bloquearClienteSemAnalise" => true, "bloqueioAutomatico" => true, "mensagemBloqueio" => "Seu crédito está bloqueado! :(",
13
+ "permissaoValorExcedente" => false, "permiteLiberarBloqueioManual" => true, "permiteVenderSemAnalise" => false, "valorCredMaximoCliente" => true,
14
+ "creditoMaximoCliente" => BigDecimal.new("1000.35"), "limiteMensal" => "SOBRE_TOTAL_DE_CREDITO", "limiteCreditoSobreRenda" => true,
15
+ "limiteSobreRenda" => BigDecimal.new("10.35")})
15
16
 
16
17
  expect(installment.as_parameter).to eq(installment_as_parameter)
17
18
  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.18
4
+ version: 0.0.19
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-06-18 00:00:00.000000000 Z
11
+ date: 2015-06-19 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