Class: CorreiosSigep::LogisticReverse::BaseClient
- Inherits:
-
Object
- Object
- CorreiosSigep::LogisticReverse::BaseClient
show all
- Defined in:
- lib/correios_sigep/logistic_reverse/base_client.rb
Constant Summary
collapse
- DEFAULT_TIMEOUT =
30
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseClient.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/correios_sigep/logistic_reverse/base_client.rb', line 6
def initialize
timeout = CorreiosSigep.configuration.timeout || DEFAULT_TIMEOUT
user = CorreiosSigep.configuration.user
password = CorreiosSigep.configuration.password
options = {
adapter: :net_http_persistent,
proxy: CorreiosSigep.configuration.proxy,
wsdl: wsdl,
open_timeout: timeout,
read_timeout: timeout,
basic_auth: [user, password],
headers: { 'SOAPAction' => '' }
}
options.delete(:proxy) unless options[:proxy]
@client = Savon.client(options)
end
|
Instance Method Details
#invoke(method, message) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/correios_sigep/logistic_reverse/base_client.rb', line 33
def invoke(method, message)
@client.instance_variable_set(
:@wsdl,
Wasabi::Document.new(CorreiosSigep.configuration.wsdl_base_url)
) if wsdl_base_url_changed?
@client.call(method, message: message)
end
|
#wsdl ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/correios_sigep/logistic_reverse/base_client.rb', line 25
def wsdl
@wsdl ||= if ENV['GEM_ENV'] == 'test'
'https://apphom.correios.com.br/logisticaReversaWS/logisticaReversaService/logisticaReversaWS?wsdl'
else
'https://cws.correios.com.br/logisticaReversaWS/logisticaReversaService/logisticaReversaWS?wsdl'
end
end
|