vpsa 0.0.9 → 0.0.10

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: 03cd78da745990c1ac149242b249855294e82df3
4
- data.tar.gz: 5a47b16ae4a96519ac5afe237fe1ff61ec1cc00e
3
+ metadata.gz: b7a0462fe237beea1b5d08e1cdc6a75b8fceffd5
4
+ data.tar.gz: 567dfc7a22eedeca18590c3d24c7ad47d757209b
5
5
  SHA512:
6
- metadata.gz: 3f236572b709fca6b8264dae274ac582f78b11f15b2bdcbf06405f6ef9a8e4dcfc020fb41b560be9e87855e8253c5b54743561c32ba2eb8c3096143d44242707
7
- data.tar.gz: c843f2b6da979799acb8cea52861fa009beec8227e5abf7626c9b2a72fa6627e15725aa4f4a286463fba6436e352a5477ab68ea106fcde9cdef9cc2086306124
6
+ metadata.gz: 8956cd9a7d663fec4ef106fceb6b86d2e4baff490ab42781a3f22e655273c6318177882e7edcbe4ebdecb36a7fd60bb2c600b0365f2359f9215a3c8bcaf58fb7
7
+ data.tar.gz: 7b15bbda9e1a49e06a930d32d587df030c13318757dd74c0ac93ff68fa519135067262dbdabfb44a71b4867a275d5bc7067982d59525d8153bace551d657944c
data/lib/vpsa.rb CHANGED
@@ -3,6 +3,9 @@ require "vpsa/version"
3
3
  module Vpsa
4
4
  LIBNAME = 'vpsa'
5
5
  LIBDIR = File.expand_path("../#{LIBNAME}", __FILE__)
6
+
7
+ API_ADDRESS = "https://www.vpsa.com.br/apps/api"
8
+ #API_ADDRESS = "http://192.168.1.204:8080/vpsa/api"
6
9
 
7
10
  class << self
8
11
  def included(base)
@@ -3,7 +3,7 @@ module Vpsa
3
3
  class ClientClasses < Client
4
4
  require_all 'vpsa/searcher/operational', 'client_class_searcher'
5
5
 
6
- base_uri "https://www.vpsa.com.br/apps/api/classificacoes-clientes"
6
+ base_uri "#{Vpsa::API_ADDRESS}/classificacoes-clientes"
7
7
 
8
8
  def list(searcher = nil)
9
9
  raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Operational::ClientClassSearcher)
@@ -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 "https://www.vpsa.com.br/apps/api/limitescredito"
6
+ base_uri "#{Vpsa::API_ADDRESS}/limitescredito"
7
7
 
8
8
  def list(searcher = nil)
9
9
  raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Commercial::CreditLimitSearcher)
@@ -3,7 +3,7 @@ module Vpsa
3
3
  class DefaultEntries < Client
4
4
  require_all 'vpsa/searcher/financial', 'default_entry_searcher'
5
5
 
6
- base_uri "https://www.vpsa.com.br/apps/api/lancamentos-padroes"
6
+ base_uri "#{Vpsa::API_ADDRESS}/lancamentos-padroes"
7
7
 
8
8
  def list(searcher = nil)
9
9
  raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Financial::DefaultEntrySearcher)
@@ -3,7 +3,7 @@ module Vpsa
3
3
  class Entities < Client
4
4
  require_all 'vpsa/searcher/administrative', 'entity_searcher'
5
5
 
6
- base_uri "https://www.vpsa.com.br/apps/api/entidades"
6
+ base_uri "#{Vpsa::API_ADDRESS}/entidades"
7
7
 
8
8
  def list(searcher = nil)
9
9
  raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Administrative::EntitySearcher)
@@ -3,10 +3,11 @@ module Vpsa
3
3
  class Installments < Client
4
4
  require_all 'vpsa/entity/commercial', 'installment'
5
5
 
6
- base_uri "https://www.vpsa.com.br/apps/api/crediarios"
6
+ base_uri "#{Vpsa::API_ADDRESS}/configuracao-credito"
7
7
 
8
8
  def configure(data)
9
- return parse_response(self.class.post("/", :body => build_body(data), :headers => header))
9
+ #return parse_response(self.class.put("/", :body => build_body(data), :headers => header))
10
+ return parse_response(self.class.put("/", :body => data.to_json, :headers => header))
10
11
  end
11
12
 
12
13
  def information
@@ -1,7 +1,7 @@
1
1
  module Vpsa
2
2
  module Api
3
3
  class Provisions < Client
4
- base_uri "https://www.vpsa.com.br/apps/api/provisoes-contas"
4
+ base_uri "#{Vpsa::API_ADDRESS}/provisoes-contas"
5
5
 
6
6
  def create(data)
7
7
  return parse_response(self.class.post("/", :body => build_body(data), :headers => header))
@@ -5,7 +5,7 @@ module Vpsa
5
5
  require_all 'vpsa/entity/administrative', 'third_party', 'address', 'phone'
6
6
  require_all 'vpsa/entity/commercial', 'credit_limit'
7
7
 
8
- base_uri "https://www.vpsa.com.br/apps/api/terceiros"
8
+ base_uri "#{Vpsa::API_ADDRESS}/terceiros"
9
9
 
10
10
  def list(searcher = nil)
11
11
  raise ArgumentError unless searcher.nil? || searcher.is_a?(Vpsa::Searcher::Administrative::ThirdPartySearcher)
@@ -1,7 +1,7 @@
1
1
  module Vpsa
2
2
  module Api
3
3
  class UserData < Client
4
- base_uri "https://www.vpsa.com.br/apps/api/dados-login"
4
+ base_uri "#{Vpsa::API_ADDRESS}/dados-login"
5
5
 
6
6
  def get
7
7
  return parse_response(self.class.get("/", :body => build_body, :headers => header))
data/lib/vpsa/client.rb CHANGED
@@ -5,6 +5,7 @@ module Vpsa
5
5
  extend Vpsa::ClassMethods
6
6
  include HTTParty
7
7
 
8
+ debug_output $stdout
8
9
  default_options.update(verify: false)
9
10
  parser Proc.new {|b| JSON.parse(b) rescue b}
10
11
 
data/lib/vpsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vpsa
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::ClientClasses do
5
5
 
6
6
  describe "listing" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/classificacoes-clientes/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/classificacoes-clientes/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the client classes url" do
@@ -29,7 +29,7 @@ RSpec.describe Vpsa::Api::ClientClasses do
29
29
 
30
30
  describe "finding" do
31
31
  before(:each) do
32
- stub_request(:get, "https://www.vpsa.com.br/apps/api/classificacoes-clientes/5").to_return(:status => 200)
32
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/classificacoes-clientes/5").to_return(:status => 200)
33
33
  end
34
34
 
35
35
  it "should issue a get to the client classes url" do
@@ -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, "https://www.vpsa.com.br/apps/api/limitescredito/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/limitescredito/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the credit_limits url" do
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::DefaultEntries do
5
5
 
6
6
  describe "listing" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/lancamentos-padroes/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/lancamentos-padroes/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the default_entries url" do
@@ -29,7 +29,7 @@ RSpec.describe Vpsa::Api::DefaultEntries do
29
29
 
30
30
  describe "finding" do
31
31
  before(:each) do
32
- stub_request(:get, "https://www.vpsa.com.br/apps/api/lancamentos-padroes/5").to_return(:status => 200)
32
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/lancamentos-padroes/5").to_return(:status => 200)
33
33
  end
34
34
 
35
35
  it "should issue a get to the default entry url" do
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::Entities do
5
5
 
6
6
  describe "listing" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/entidades/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/entidades/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the entities url" do
@@ -29,7 +29,7 @@ RSpec.describe Vpsa::Api::Entities do
29
29
 
30
30
  describe "finding" do
31
31
  before(:each) do
32
- stub_request(:get, "https://www.vpsa.com.br/apps/api/entidades/5").to_return(:status => 200)
32
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/entidades/5").to_return(:status => 200)
33
33
  end
34
34
 
35
35
  it "should issue a get to the entity url" do
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::Installments do
5
5
 
6
6
  describe "information" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/crediarios/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/configuracao-credito/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the installments url" do
@@ -17,13 +17,13 @@ RSpec.describe Vpsa::Api::Installments do
17
17
 
18
18
  describe "configuration" do
19
19
  before(:each) do
20
- stub_request(:post, "https://www.vpsa.com.br/apps/api/crediarios/").to_return(:status => 201)
20
+ stub_request(:put, "#{Vpsa::API_ADDRESS}/configuracao-credito/").to_return(:status => 201)
21
21
  end
22
22
 
23
23
  let(:installment_param) {{}}
24
24
 
25
25
  it "should issue a post to the installments url" do
26
- expect(Vpsa::Api::Installments).to receive(:post).with("/", :body => installment_param.merge!({:token => "abc"}).to_json, :headers => header).and_call_original
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
28
  Vpsa.new("abc").installments.configure(installment_param)
29
29
  end
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::Provisions do
5
5
 
6
6
  describe "creation" do
7
7
  before(:each) do
8
- stub_request(:post, "https://www.vpsa.com.br/apps/api/provisoes-contas/").to_return(:status => 201)
8
+ stub_request(:post, "#{Vpsa::API_ADDRESS}/provisoes-contas/").to_return(:status => 201)
9
9
  end
10
10
 
11
11
  let(:provision_param) {{:"idLancamentoPadrao" => 3, :"idEntidade" => 1, :"idTerceiro" => 2, :data => "25-02-2019", :valor => "123.50", :historico => "histórico"}}
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
5
5
 
6
6
  describe "listing" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/terceiros/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/terceiros/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the third_parties url" do
@@ -29,7 +29,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
29
29
 
30
30
  describe "finding" do
31
31
  before(:each) do
32
- stub_request(:get, "https://www.vpsa.com.br/apps/api/terceiros/5").to_return(:status => 200)
32
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/terceiros/5").to_return(:status => 200)
33
33
  end
34
34
 
35
35
  it "should issue a get to the third party url" do
@@ -58,7 +58,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
58
58
 
59
59
  @third_party.classes = ["SOCIO_PROPRIETARIO", "FUNCIONARIO"]
60
60
 
61
- stub_request(:post, "https://www.vpsa.com.br/apps/api/terceiros/").to_return(:status => 201)
61
+ stub_request(:post, "#{Vpsa::API_ADDRESS}/terceiros/").to_return(:status => 201)
62
62
  end
63
63
 
64
64
  describe "with raw parameters" do
@@ -87,7 +87,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
87
87
  describe "credit limit" do
88
88
  context "information" do
89
89
  before(:each) do
90
- stub_request(:get, "https://www.vpsa.com.br/apps/api/terceiros/5/limites_credito").to_return(:status => 200)
90
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito").to_return(:status => 200)
91
91
  end
92
92
 
93
93
  it "should issue a get to the third party credit limit url" do
@@ -103,7 +103,7 @@ 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, "https://www.vpsa.com.br/apps/api/terceiros/5/limites_credito").to_return(:status => 200)
106
+ stub_request(:put, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito").to_return(:status => 200)
107
107
  end
108
108
 
109
109
  describe "with raw parameters" do
@@ -133,7 +133,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
133
133
  let(:credit_limit_block_params) {{"justificativa" => "Cliente caloteiro", :token => "abc"}}
134
134
 
135
135
  before(:each) do
136
- stub_request(:put, "https://www.vpsa.com.br/apps/api/terceiros/5/limites_credito/bloquear").to_return(:status => 200)
136
+ stub_request(:put, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito/bloquear").to_return(:status => 200)
137
137
  end
138
138
 
139
139
  it "should put to the third party credit block url" do
@@ -147,7 +147,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
147
147
  let(:credit_limit_unlock_params) {{"justificativa" => "Cliente pagou", :token => "abc"}}
148
148
 
149
149
  before(:each) do
150
- stub_request(:put, "https://www.vpsa.com.br/apps/api/terceiros/5/limites_credito/desbloquear").to_return(:status => 200)
150
+ stub_request(:put, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito/desbloquear").to_return(:status => 200)
151
151
  end
152
152
 
153
153
  it "should put to the third party credit unlock url" do
@@ -161,7 +161,7 @@ RSpec.describe Vpsa::Api::ThirdParties do
161
161
  let(:history_params) {{"desde" => Date.parse("01/01/2015"), "ate" => Date.parse("11/01/2015"), :token => "abc"}}
162
162
 
163
163
  before(:each) do
164
- stub_request(:get, "https://www.vpsa.com.br/apps/api/terceiros/5/limites_credito/historico").to_return(:status => 200)
164
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/terceiros/5/limites_credito/historico").to_return(:status => 200)
165
165
  end
166
166
 
167
167
  it "should issue a get to the third party credit history url" do
@@ -5,7 +5,7 @@ RSpec.describe Vpsa::Api::UserData do
5
5
 
6
6
  describe "finding" do
7
7
  before(:each) do
8
- stub_request(:get, "https://www.vpsa.com.br/apps/api/dados-login/").to_return(:status => 200)
8
+ stub_request(:get, "#{Vpsa::API_ADDRESS}/dados-login/").to_return(:status => 200)
9
9
  end
10
10
 
11
11
  it "should issue a get to the dados-login url" do
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.9
4
+ version: 0.0.10
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-02-23 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.4.5
116
+ rubygems_version: 2.4.6
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: This gem provides integration with VPSA APIs (http://www.vpsa.com.br/)