Class: SimpleShipping::Ups::VoidRequest

Inherits:
Request show all
Defined in:
lib/simple_shipping/ups/void_request.rb

Overview

UPS request to void shipment.

Constant Summary

Constants inherited from Request

Request::REQUEST_OPTION

Instance Attribute Summary

Attributes inherited from Abstract::Request

#credentials, #type

Instance Method Summary collapse

Methods inherited from Request

#label_specification

Methods inherited from Abstract::Request

#response, #response_class

Constructor Details

#initialize(credentials, shipment_identification_number, options = {}) ⇒ VoidRequest

Returns a new instance of VoidRequest.

Parameters:

  • credentials (Hash)
  • shipment_identification_number (String)
  • options (Hash) (defaults to: {})


8
9
10
11
12
13
14
# File 'lib/simple_shipping/ups/void_request.rb', line 8

def initialize(credentials, shipment_identification_number, options = {})
  @credentials                    = credentials
  @shipment_identification_number = shipment_identification_number
  @tracking_number                = options[:tracking_number]
  @options                        = options
  @type                           = :process_void
end

Instance Method Details

#bodyObject

Build a request from a shipment object.



17
18
19
20
21
22
23
24
25
# File 'lib/simple_shipping/ups/void_request.rb', line 17

def body
  {
    'common:Request' => {
      'common:RequestOption' => REQUEST_OPTION
    },
    'VoidShipment' => void_shipment,
    :order!        => ['common:Request', 'VoidShipment']
  }
end