8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/friendly_shipping/services/ups_freight/generate_freight_ship_request_hash.rb', line 8
def call(shipment:, options:)
{
FreightShipRequest: {
Shipment: {
ShipperNumber: options.shipper_number,
ShipFrom: GenerateLocationHash.call(location: shipment.origin),
ShipTo: GenerateLocationHash.call(location: shipment.destination),
PaymentInformation: payment_information(options),
Service: {
Code: options.shipping_method.service_code
},
Commodity: options.commodity_information_generator.call(shipment: shipment, options: options),
Documents: {
Image: options.document_options.map { |doc_opts| GenerateDocumentOptionsHash.call(document_options: doc_opts) }
},
ShipmentServiceOptions: shipment_service_options(options),
HandlingInstructions: options.handling_instructions,
PickupInstructions: options.pickup_instructions,
DeliveryInstructions: options.delivery_instructions,
PickupRequest: GeneratePickupRequestHash.call(pickup_request_options: options.pickup_request_options),
}.compact.
merge(GenerateHandlingUnitsHash.call(shipment: shipment, options: options)).
merge(GenerateReferenceHash.call(reference_numbers: options.reference_numbers))
}
}
end
|