Class: FriendlyShipping::Services::RL::SerializeRateQuoteRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/rl/serialize_rate_quote_request.rb

Overview

Serializes an R+L API request to get a shipping rate quote.

Class Method Summary collapse

Class Method Details

.call(shipment:, options:) ⇒ Hash

Returns the serialized request.

Parameters:

  • shipment (Physical::Shipment)

    the shipment for the request

  • options (RateQuoteOptions)

    options for the request

Returns:

  • (Hash)

    the serialized request



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/friendly_shipping/services/rl/serialize_rate_quote_request.rb', line 12

def call(shipment:, options:)
  {
    RateQuote: {
      PickupDate: options.pickup_date.strftime('%m/%d/%Y'),
      Origin: serialize_location(shipment.origin),
      Destination: serialize_location(shipment.destination),
      Items: serialize_items(shipment, options),
      DeclaredValue: options.declared_value,
      AdditionalServices: options.additional_service_codes,
      Pallets: serialize_pallets(shipment)
    }.compact
  }.compact
end