correios_sigep 0.0.5 → 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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2E3ZDYxYTU0NGM0NjEzYmQzYjg5YzhhNDYzMGZmNTQzYjQzMjVhMg==
4
+ YzgyMmI0OWEwOTU1MWM2YzcwNDY5YWU2OGI5Y2NiMmY3MzEzZWExNQ==
5
5
  data.tar.gz: !binary |-
6
- ZDdmMmQ3MDNmOTg0ZmY4MjY0YmZkN2EyYTMwODY3MGIwODYxNjMzNQ==
6
+ MWJlYWRkYTgyNDVkZjgxNDg5OTQ5NmFiNWY0MzdmZWFlZGExNTQ1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTUzMzMyMjJhZTk5ZmEyY2RlMWU0NDk4NjVjYTNhYjA5MTg4N2VkZjZhYjRk
10
- MmExYmM3ODM2MzM4ZWMzOGE4MGJhODg5ODZmN2U0Zjk4MTc0MDMwZWMxMzli
11
- Yzc3ZGU0NTg3ZTE3ZTc3ZjliMTc3MmU3ZTljNDY3OWYyY2M0YmI=
9
+ ZTMwNDIyMWMzMTUxNTQ2YTYzOGEwNmYxZWE3NDk3YWIyNjMzMDIxOGFmNjg3
10
+ NmE2YzRjNDZjOGFkYzc5Njk2ZjdhYzVlYmMzYWUwYTUxZTZlMjM0NGI4ZDBi
11
+ NDAzYTZjMzYzODhmNzA5ZjliM2M1MTBlZDE4ZTE1MGM3YzNmYTg=
12
12
  data.tar.gz: !binary |-
13
- YzlmYzgzZjA4MmE5M2EwZDY5OTM1ZjUwNDNiMDk0OTkwYjNjY2I4NGQzNDBj
14
- YTljNzNhZjYyNDRkMGM0OWQ4OWQ1YWYwNWM3NmMxMjJmMTEwNmYxNjg1MmZm
15
- MTQzNGZkZTZlZDExNzI0MDIxNWQ3NzBiY2Q2ODFjNzI3ZTBmN2I=
13
+ NzcyYzg0ZjM0OTlkNmYzMThjNWUzNTgwMzMwYmViMzNhNTMyMDE3ZmQ5Zjc4
14
+ M2IxMGViMDlkOTAxNTcyNzJjZmRjYzhmMzNjODhjNzQ1ZmQxYzQ5Y2U3ZDg1
15
+ Mzc5NTIxZDliNjgzZDRjNGFhYzg3ZTExMmM2Y2JiNmFjMzBjMDI=
@@ -1,6 +1,6 @@
1
1
  module CorreiosSigep
2
2
  class Configuration
3
3
  attr_accessor :administrative_code, :card, :contract, :password,
4
- :service_code, :user, :wsdl_base_url
4
+ :service_code, :user, :wsdl_base_url, :proxy
5
5
  end
6
6
  end
@@ -2,7 +2,10 @@ module CorreiosSigep
2
2
  module LogisticReverse
3
3
  class BaseClient
4
4
  def initialize
5
- @client = Savon.client(wsdl: wsdl)
5
+ options = { wsdl: wsdl, proxy: CorreiosSigep.configuration.proxy }
6
+ options.delete(:proxy) unless options[:proxy]
7
+
8
+ @client = Savon.client(options)
6
9
  end
7
10
 
8
11
  def wsdl
@@ -1,3 +1,3 @@
1
1
  module CorreiosSigep
2
- VERSION = '0.0.5'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -3,8 +3,38 @@ require 'spec_helper'
3
3
  module CorreiosSigep
4
4
  module LogisticReverse
5
5
  describe BaseClient do
6
+ context 'setting up a proxy' do
7
+ subject { described_class.new }
8
+
9
+ context 'with a proxy' do
10
+ before { CorreiosSigep.configuration.proxy = 'http://localhost' }
11
+ let(:params) do
12
+ {
13
+ wsdl: described_class.new.wsdl,
14
+ proxy: CorreiosSigep.configuration.proxy
15
+ }
16
+ end
17
+
18
+ it 'initializes @client with proxy' do
19
+ expect(Savon).to receive(:client).with(params) { true }
20
+ subject
21
+ end
22
+ end
23
+
24
+ context 'without a proxy' do
25
+ before { CorreiosSigep.configuration.proxy = nil }
26
+ let(:params) { { wsdl: described_class.new.wsdl } }
27
+
28
+ it 'initializes @client without proxy' do
29
+ expect(Savon).to receive(:client).with(params) { true }
30
+ subject
31
+ end
32
+ end
33
+ end
34
+
6
35
  describe '#wsdl' do
7
36
  subject { described_class.new.wsdl }
37
+
8
38
  context 'in a test environment' do
9
39
  it 'return the staging url' do
10
40
  allow(ENV).to receive(:[]).with('GEM_ENV').and_return 'test'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correios_sigep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Ribeiro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-14 00:00:00.000000000 Z
12
+ date: 2015-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon