Exception: Correios::Sigep::CheckServiceAvailability
- Inherits:
-
CorreiosException
- Object
- StandardError
- CorreiosException
- Correios::Sigep::CheckServiceAvailability
- Defined in:
- lib/sigep/requests/check_service_availability.rb
Constant Summary collapse
- HELPER =
Helper.new
- CLIENT =
Client.new
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ CheckServiceAvailability
constructor
A new instance of CheckServiceAvailability.
- #request ⇒ Object
Methods inherited from CorreiosException
#format_error_message, #generate_exception
Constructor Details
#initialize(data = {}) ⇒ CheckServiceAvailability
Returns a new instance of CheckServiceAvailability.
14 15 16 17 18 19 20 21 22 |
# File 'lib/sigep/requests/check_service_availability.rb', line 14 def initialize(data = {}) @credentials = Correios.credentials @show_request = data[:show_request] @service_code = data[:service_code] @source_zip_code = data[:source_zip_code] @target_zip_code = data[:target_zip_code] super() end |
Instance Method Details
#request ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sigep/requests/check_service_availability.rb', line 24 def request puts xml if @show_request == true begin format_response(CLIENT.client.call(:verifica_disponibilidade_servico, soap_action: '', xml: xml).to_hash) rescue Savon::SOAPFault => error generate_exception(error) end end |