Class: FriendlyShipping::Services::RL::BOLOptions

Inherits:
FriendlyShipping::ShipmentOptions show all
Defined in:
lib/friendly_shipping/services/rl/bol_options.rb

Overview

Bill of Lading (BOL) options class. Used when serializing R+L API requests.

Constant Summary collapse

ADDITIONAL_SERVICE_CODES =

Optional service codes that can be used for R+L shipments.

%w[
  OriginLiftgate
  DestinationLiftgate
  InsidePickup
  InsideDelivery
  LimitedAccessPickup
  LimitedAccessDelivery
  Freezable
  DeliveryAppointment
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(pickup_time_window:, pickup_instructions: nil, declared_value: nil, special_instructions: nil, reference_numbers: {}, additional_service_codes: [], structures_serializer: BOLStructuresSerializer, packages_serializer: BOLPackagesSerializer, generate_universal_pro: false, **kwargs) ⇒ BOLOptions

Returns a new instance of BOLOptions.

Parameters:

  • pickup_time_window (Range)
  • pickup_instructions (String) (defaults to: nil)
  • declared_value (Numeric) (defaults to: nil)
  • special_instructions (String) (defaults to: nil)
  • reference_numbers (Hash) (defaults to: {})
  • additional_service_codes (Array<String>) (defaults to: [])
  • generate_universal_pro (Boolean) (defaults to: false)
  • structures_serializer (Callable) (defaults to: BOLStructuresSerializer)

    a callable that takes structures and an options object to create an Array of item hashes per the R+L Carriers docs

  • packages_serializer (Callable) (defaults to: BOLPackagesSerializer)

    a callable that takes packages and an options object to create an Array of item hashes per the R+L Carriers docs (DEPRECATED: use structures_serializer instead)

  • kwargs (Hash)

Options Hash (**kwargs):

  • :package_options (Array<PackageOptions>)

    the options for packages in this shipment

  • :package_options_class (Class)

    the class to use for package options when none are provided



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

def initialize(
  pickup_time_window:,
  pickup_instructions: nil,
  declared_value: nil,
  special_instructions: nil,
  reference_numbers: {},
  additional_service_codes: [],
  structures_serializer: BOLStructuresSerializer,
  packages_serializer: BOLPackagesSerializer,
  generate_universal_pro: false,
  **kwargs
)
  @pickup_time_window = pickup_time_window
  @pickup_instructions = pickup_instructions
  @declared_value = declared_value
  @special_instructions = special_instructions
  @reference_numbers = reference_numbers
  @additional_service_codes = additional_service_codes
  @structures_serializer = structures_serializer
  @packages_serializer = packages_serializer
  @generate_universal_pro = generate_universal_pro
  validate_additional_service_codes!
  super(**kwargs)
end

Instance Attribute Details

#additional_service_codesArray<String> (readonly)

Returns additional service codes.

Returns:

  • (Array<String>)

    additional service codes



28
29
30
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 28

def additional_service_codes
  @additional_service_codes
end

#declared_valueNumeric (readonly)

Returns the declared value of this shipment.

Returns:

  • (Numeric)

    the declared value of this shipment



19
20
21
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 19

def declared_value
  @declared_value
end

#generate_universal_proBoolean (readonly)

Returns whether to generate universal PRO number.

Returns:

  • (Boolean)

    whether to generate universal PRO number



31
32
33
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 31

def generate_universal_pro
  @generate_universal_pro
end

#packages_serializerCallable (readonly)

Deprecated.

Returns:

  • (Callable)


38
39
40
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 38

def packages_serializer
  @packages_serializer
end

#pickup_instructionsString (readonly)

Returns the pickup instructions.

Returns:

  • (String)

    the pickup instructions



16
17
18
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 16

def pickup_instructions
  @pickup_instructions
end

#pickup_time_windowRange (readonly)

Returns the pickup time window.

Returns:

  • (Range)

    the pickup time window



13
14
15
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 13

def pickup_time_window
  @pickup_time_window
end

#reference_numbersHash (readonly)

Returns reference numbers for the shipment.

Returns:

  • (Hash)

    reference numbers for the shipment



25
26
27
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 25

def reference_numbers
  @reference_numbers
end

#special_instructionsString (readonly)

Returns any special instructions.

Returns:

  • (String)

    any special instructions



22
23
24
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 22

def special_instructions
  @special_instructions
end

#structures_serializerCallable (readonly)

Returns the structures serializer.

Returns:

  • (Callable)

    the structures serializer



34
35
36
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 34

def structures_serializer
  @structures_serializer
end