Class: FriendlyShipping::Services::UpsFreight::GenerateFreightRateRequestHash

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups_freight/generate_freight_rate_request_hash.rb

Class Method Summary collapse

Class Method Details

.call(shipment:, options:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/friendly_shipping/services/ups_freight/generate_freight_rate_request_hash.rb', line 11

def call(shipment:, options:)
  {
    FreightRateRequest: {
      Request: request_options(options.customer_context),
      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),
      TimeInTransitIndicator: 'true',
      PickupRequest: GeneratePickupRequestHash.call(pickup_request_options: options.pickup_request_options),
    }.compact.merge(handling_units(shipment, options).reduce(&:merge).to_h)
  }
end