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



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

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



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

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



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

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



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

def generate_universal_pro
  @generate_universal_pro
end

#packages_serializerCallable (readonly)

Deprecated.

Returns:

  • (Callable)


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

def packages_serializer
  @packages_serializer
end

#pickup_instructionsString (readonly)

Returns the pickup instructions.

Returns:

  • (String)

    the pickup instructions



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

def pickup_instructions
  @pickup_instructions
end

#pickup_time_windowRange (readonly)

Returns the pickup time window.

Returns:

  • (Range)

    the pickup time window



9
10
11
# File 'lib/friendly_shipping/services/rl/bol_options.rb', line 9

def pickup_time_window
  @pickup_time_window
end

#reference_numbersHash (readonly)

Returns reference numbers for the shipment.

Returns:

  • (Hash)

    reference numbers for the shipment



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

def reference_numbers
  @reference_numbers
end

#special_instructionsString (readonly)

Returns any special instructions.

Returns:

  • (String)

    any special instructions



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

def special_instructions
  @special_instructions
end

#structures_serializerCallable (readonly)

Returns the structures serializer.

Returns:

  • (Callable)

    the structures serializer



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

def structures_serializer
  @structures_serializer
end