Class: FriendlyShipping::Services::TForceFreight::BOLOptions
- Inherits:
-
FriendlyShipping::ShipmentOptions
- Object
- FriendlyShipping::ShipmentOptions
- FriendlyShipping::Services::TForceFreight::BOLOptions
- Defined in:
- lib/friendly_shipping/services/tforce_freight/bol_options.rb
Overview
Options for creating a Bill of Lading (BOL).
Constant Summary collapse
- BILLING_CODES =
Maps friendly names to billing codes.
{ prepaid: "10", third_party: "30", freight_collect: "40" }.freeze
- REFERENCE_NUMBER_CODES =
Maps friendly names to reference number codes.
{ bill_of_lading_number: "BL", purchase_order_number: "PO", shipper_reference: "SH", consignee_reference: "CO", pm: "PM", proj: "PROJ", quote: "QUOTE", sid: "SID", task: "TASK", vprc: "VPRC", other: "OTHER" }.freeze
- PICKUP_OPTIONS =
Maps friendly names to pickup options.
{ inside: "INPU", liftgate: "LIFO", limited_access: "LAPU", holiday: "WHPU", weekend: "WHPU", tradeshow: "TRPU", residential: "RESP" }.freeze
- DELIVERY_OPTIONS =
Maps friendly names to delivery options.
{ inside: "INDE", liftgate: "LIFD", limited_access: "LADL", holiday: "WHDL", weekend: "WHDL", call_consignee: "NTFN", tradeshow: "TRDS", residential: "RESD" }.freeze
Instance Attribute Summary collapse
-
#billing_code ⇒ String
readonly
Code indicating how to bill this shipment (see BILLING_CODES).
-
#commodity_information_generator ⇒ Proc, #call
readonly
The callable used generate commodity information.
-
#delivery_instructions ⇒ String
readonly
Instructions for delivery.
-
#delivery_options ⇒ Array<String>
readonly
Options for delivery (see DELIVERY_OPTIONS).
-
#document_options ⇒ Array<DocumentOptions>
readonly
Options for documents.
-
#handling_instructions ⇒ String
readonly
Instructions for handling.
-
#pickup_at ⇒ Time
readonly
Date/time of pickup.
-
#pickup_instructions ⇒ String
readonly
Instructions for pickup.
-
#pickup_options ⇒ Array<String>
readonly
Options for pickup (see PICKUP_OPTIONS).
-
#pickup_time_window ⇒ Range
readonly
Time window for pickup.
-
#preview_rate ⇒ Boolean
readonly
Whether to preview rates in the response.
-
#reference_numbers ⇒ Array<Hash>
readonly
Reference numbers for this shipment (see REFERENCE_NUMBER_CODES).
-
#service_code ⇒ String
readonly
The service code to use.
-
#time_in_transit ⇒ Boolean
readonly
Whether to include time in transit in the response.
Instance Method Summary collapse
Methods inherited from FriendlyShipping::ShipmentOptions
Constructor Details
#initialize(service_code: FriendlyShipping::Services::TForceFreight::SHIPPING_METHODS.first.service_code, pickup_at: Time.now, pickup_time_window: Time.now.beginning_of_day..Time.now.end_of_day, preview_rate: false, time_in_transit: false, billing: :prepaid, reference_numbers: [], pickup_instructions: nil, handling_instructions: nil, delivery_instructions: nil, pickup_options: [], delivery_options: [], document_options: [], commodity_information_generator: GenerateCommodityInformation, **kwargs) ⇒ BOLOptions
Returns a new instance of BOLOptions.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 112 def initialize( service_code: FriendlyShipping::Services::TForceFreight::SHIPPING_METHODS.first.service_code, pickup_at: Time.now, pickup_time_window: Time.now.beginning_of_day..Time.now.end_of_day, preview_rate: false, time_in_transit: false, billing: :prepaid, reference_numbers: [], pickup_instructions: nil, handling_instructions: nil, delivery_instructions: nil, pickup_options: [], delivery_options: [], document_options: [], commodity_information_generator: GenerateCommodityInformation, **kwargs ) @service_code = service_code @pickup_at = pickup_at @pickup_time_window = pickup_time_window @preview_rate = preview_rate @time_in_transit = time_in_transit @billing_code = BILLING_CODES.fetch(billing) @reference_numbers = fill_codes(reference_numbers) @pickup_instructions = pickup_instructions @handling_instructions = handling_instructions @delivery_instructions = delivery_instructions @pickup_options = @delivery_options = @document_options = @commodity_information_generator = commodity_information_generator super(**kwargs.reverse_merge(package_options_class: PackageOptions)) end |
Instance Attribute Details
#billing_code ⇒ String (readonly)
Returns code indicating how to bill this shipment (see BILLING_CODES).
69 70 71 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 69 def billing_code @billing_code end |
#commodity_information_generator ⇒ Proc, #call (readonly)
Returns the callable used generate commodity information.
93 94 95 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 93 def commodity_information_generator @commodity_information_generator end |
#delivery_instructions ⇒ String (readonly)
Returns instructions for delivery.
81 82 83 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 81 def delivery_instructions @delivery_instructions end |
#delivery_options ⇒ Array<String> (readonly)
Returns options for delivery (see DELIVERY_OPTIONS).
87 88 89 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 87 def @delivery_options end |
#document_options ⇒ Array<DocumentOptions> (readonly)
Returns options for documents.
90 91 92 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 90 def @document_options end |
#handling_instructions ⇒ String (readonly)
Returns instructions for handling.
78 79 80 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 78 def handling_instructions @handling_instructions end |
#pickup_at ⇒ Time (readonly)
Returns date/time of pickup.
57 58 59 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 57 def pickup_at @pickup_at end |
#pickup_instructions ⇒ String (readonly)
Returns instructions for pickup.
75 76 77 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 75 def pickup_instructions @pickup_instructions end |
#pickup_options ⇒ Array<String> (readonly)
Returns options for pickup (see PICKUP_OPTIONS).
84 85 86 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 84 def @pickup_options end |
#pickup_time_window ⇒ Range (readonly)
Returns time window for pickup.
60 61 62 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 60 def pickup_time_window @pickup_time_window end |
#preview_rate ⇒ Boolean (readonly)
Returns whether to preview rates in the response.
63 64 65 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 63 def preview_rate @preview_rate end |
#reference_numbers ⇒ Array<Hash> (readonly)
Returns reference numbers for this shipment (see REFERENCE_NUMBER_CODES).
72 73 74 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 72 def reference_numbers @reference_numbers end |
#service_code ⇒ String (readonly)
Returns the service code to use.
54 55 56 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 54 def service_code @service_code end |
#time_in_transit ⇒ Boolean (readonly)
Returns whether to include time in transit in the response.
66 67 68 |
# File 'lib/friendly_shipping/services/tforce_freight/bol_options.rb', line 66 def time_in_transit @time_in_transit end |