Class: SEFAZ::Utils::Connection
- Inherits:
-
Object
- Object
- SEFAZ::Utils::Connection
- Defined in:
- lib/sefaz/utils/connection.rb
Overview
Classe base de conexão SOAP da biblioteca
Direct Known Subclasses
Instance Method Summary collapse
- #build(operation, hash) ⇒ Object
- #call(operation, hash) ⇒ Object
- #connected? ⇒ Boolean
-
#initialize(pkcs12, wsdl, soap_header) ⇒ Connection
constructor
A new instance of Connection.
- #operations ⇒ Object
Constructor Details
#initialize(pkcs12, wsdl, soap_header) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sefaz/utils/connection.rb', line 8 def initialize(pkcs12, wsdl, soap_header) @conn = Savon.client( wsdl: wsdl, ssl_verify_mode: :none, ssl_cert: pkcs12.certificate, ssl_cert_key: pkcs12.key, soap_header: soap_header, soap_version: 2, convert_request_keys_to: :none, convert_response_tags_to: lambda { |key| key.to_sym }, namespace_identifier: nil ) end |
Instance Method Details
#build(operation, hash) ⇒ Object
25 26 27 |
# File 'lib/sefaz/utils/connection.rb', line 25 def build(operation, hash) @conn.build_request(operation, message: hash) end |
#call(operation, hash) ⇒ Object
29 30 31 |
# File 'lib/sefaz/utils/connection.rb', line 29 def call(operation, hash) @conn.call(operation, message: hash) end |
#connected? ⇒ Boolean
22 |
# File 'lib/sefaz/utils/connection.rb', line 22 def connected?; (@conn.operations.length > 0) end |
#operations ⇒ Object
23 |
# File 'lib/sefaz/utils/connection.rb', line 23 def operations; (@conn.operations) end |