Exception: Correios::Sigep::CancelShipping

Inherits:
CorreiosException show all
Defined in:
lib/sigep/requests/cancel_shipping.rb

Constant Summary collapse

HELPER =
Helper.new
CLIENT =
Client.new

Instance Method Summary collapse

Methods inherited from CorreiosException

#format_error_message, #generate_exception

Constructor Details

#initialize(data = {}) ⇒ CancelShipping

Returns a new instance of CancelShipping.



14
15
16
17
18
19
20
21
# File 'lib/sigep/requests/cancel_shipping.rb', line 14

def initialize(data = {})
  @credentials = Correios.credentials

  @show_request = data[:show_request]
  @label_number = data[:label_number]
  @request_id = data[:request_id]
  super()
end

Instance Method Details

#requestObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/sigep/requests/cancel_shipping.rb', line 23

def request
  puts xml if @show_request == true
  begin
    format_response(CLIENT.client.call(:bloquear_objeto,
                                       soap_action: '',
                                       xml: xml).to_hash)
  rescue Savon::SOAPFault => error
    generate_exception(error)
  end
end