Class: FriendlyShipping::Services::UpsFreight::LabelOptions

Inherits:
RatesOptions show all
Defined in:
lib/friendly_shipping/services/ups_freight/label_options.rb

Overview

Options for generating UPS Freight labels for a shipment.

Constant Summary collapse

REFERENCE_NUMBER_CODES =

Maps friendly names to reference number codes.

{
  bill_of_lading_number: "57",
  purchase_order_number: "28",
  shipper_reference: "SH",
  consignee_reference: "CO",
  pm: "PM",
  proj: "PROJ",
  quote: "QUOTE",
  sid: "SID",
  task: "TASK",
  vprc: "VPRC",
  other: "OTHER"
}.freeze

Constants inherited from RatesOptions

RatesOptions::BILLING_CODES

Instance Attribute Summary collapse

Attributes inherited from RatesOptions

#billing_address, #billing_code, #commodity_information_generator, #customer_context, #pickup_request_options, #shipper_number, #shipping_method

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(document_options: [], email_options: [], pickup_options: nil, delivery_options: nil, pickup_instructions: nil, delivery_instructions: nil, handling_instructions: nil, reference_numbers: [], **kwargs) ⇒ LabelOptions

Returns a new instance of LabelOptions.

Parameters:

  • document_options (Array<LabelDocumentOptions>) (defaults to: [])
  • email_options (Array<LabelEmailOptions>) (defaults to: [])
  • pickup_options (LabelPickupOptions) (defaults to: nil)
  • delivery_options (LabelDeliveryOptions) (defaults to: nil)
  • pickup_instructions (String) (defaults to: nil)
  • delivery_instructions (String) (defaults to: nil)
  • handling_instructions (String) (defaults to: nil)
  • reference_numbers (Array<Hash>) (defaults to: [])

    reference numbers for the Bill of Lading



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 55

def initialize(
  document_options: [],
  email_options: [],
  pickup_options: nil,
  delivery_options: nil,
  pickup_instructions: nil,
  delivery_instructions: nil,
  handling_instructions: nil,
  reference_numbers: [],
  **kwargs
)
  @pickup_options = pickup_options
  @delivery_options = delivery_options
  @document_options = document_options
  @email_options = email_options
  @pickup_instructions = pickup_instructions
  @delivery_instructions = delivery_instructions
  @handling_instructions = handling_instructions
  @reference_numbers = fill_codes(reference_numbers)
  super(**kwargs.reverse_merge(package_options_class: LabelPackageOptions))
end

Instance Attribute Details

#delivery_instructionsString (readonly)

Returns:

  • (String)


39
40
41
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 39

def delivery_instructions
  @delivery_instructions
end

#delivery_optionsLabelDeliveryOptions (readonly)



33
34
35
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 33

def delivery_options
  @delivery_options
end

#document_optionsArray<LabelDocumentOptions> (readonly)

Returns:



24
25
26
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 24

def document_options
  @document_options
end

#email_optionsArray<LabelEmailOptions> (readonly)

Returns:



27
28
29
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 27

def email_options
  @email_options
end

#handling_instructionsString (readonly)

Returns:

  • (String)


42
43
44
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 42

def handling_instructions
  @handling_instructions
end

#pickup_instructionsString (readonly)

Returns:

  • (String)


36
37
38
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 36

def pickup_instructions
  @pickup_instructions
end

#pickup_optionsLabelPickupOptions (readonly)

Returns:



30
31
32
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 30

def pickup_options
  @pickup_options
end

#reference_numbersArray<Hash> (readonly)

Returns:

  • (Array<Hash>)


45
46
47
# File 'lib/friendly_shipping/services/ups_freight/label_options.rb', line 45

def reference_numbers
  @reference_numbers
end