Class: FriendlyShipping::Services::TForceFreight::GenerateRatesRequestHash

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/tforce_freight/generate_rates_request_hash.rb

Overview

Generates a rates request hash for JSON serialization.

Class Method Summary collapse

Class Method Details

.call(shipment:, options:) ⇒ Hash

Returns rates request hash.

Parameters:

  • shipment (Physical::Shipment)

    the shipment for which we want to get rates

  • options (RatesOptions)

    options for obtaining rates for this shipment

Returns:

  • (Hash)

    rates request hash



12
13
14
15
16
17
18
19
20
21
# File 'lib/friendly_shipping/services/tforce_freight/generate_rates_request_hash.rb', line 12

def call(shipment:, options:)
  {
    requestOptions: request_options(options),
    shipFrom: GenerateLocationHash.call(location: shipment.origin),
    shipTo: GenerateLocationHash.call(location: shipment.destination),
    payment: payment(options),
    serviceOptions: service_options(options),
    commodities: options.commodity_information_generator.call(shipment: shipment, options: options)
  }
end