Class: FriendlyShipping::Services::TForceFreight::RatesOptions
- Inherits:
-
FriendlyShipping::ShipmentOptions
- Object
- FriendlyShipping::ShipmentOptions
- FriendlyShipping::Services::TForceFreight::RatesOptions
- Defined in:
- lib/friendly_shipping/services/tforce_freight/rates_options.rb
Overview
Options for getting rates for a shipment.
Constant Summary collapse
- BILLING_CODES =
Maps friendly names to billing codes.
{ prepaid: "10", third_party: "30", freight_collect: "40" }.freeze
- TYPE_CODES =
Maps friendly names to type codes.
{ l: "L", # LTL (Less Than Truckload) only f: "F", # GFP (Ground w/Freight Pricing) only b: "B" # Both (LTL and GFP) }.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
-
#accessorial_rate ⇒ Boolean
readonly
Indicates that the rate is accessorial.
-
#billing_address ⇒ Physical::Location
readonly
The billing address.
-
#billing_code ⇒ Symbol
readonly
How the shipment is billed (see BILLING_CODES).
-
#commodity_information_generator ⇒ Callable
readonly
A callable that takes a shipment.
-
#customer_context ⇒ String
readonly
Customer context.
-
#delivery_options ⇒ Array<String] shipment delivery service options (see {DELIVERY_OPTIONS})
readonly
Array<String] shipment delivery service options (see DELIVERY_OPTIONS).
-
#density_eligible ⇒ Boolean
readonly
Indicates that the rate request is density based.
-
#pickup_date ⇒ Date
readonly
Date of the pickup.
-
#pickup_options ⇒ Array<String>
readonly
Shipment pick up service options (see PICKUP_OPTIONS).
-
#quote_number ⇒ Boolean
readonly
Requests a quote number be included in the response.
-
#shipping_method ⇒ ShippingMethod
readonly
The shipping method.
-
#time_in_transit ⇒ Boolean
readonly
Requests transit timing information be included in the response.
-
#type_code ⇒ String
readonly
Rating call type (see TYPE_CODES).
Instance Method Summary collapse
-
#initialize(billing_address:, shipping_method:, pickup_date: Date.today, billing: :prepaid, type: :l, density_eligible: false, accessorial_rate: false, time_in_transit: true, quote_number: false, pickup_options: [], delivery_options: [], customer_context: nil, commodity_information_generator: GenerateCommodityInformation, **kwargs) ⇒ RatesOptions
constructor
A new instance of RatesOptions.
Methods inherited from FriendlyShipping::ShipmentOptions
Constructor Details
#initialize(billing_address:, shipping_method:, pickup_date: Date.today, billing: :prepaid, type: :l, density_eligible: false, accessorial_rate: false, time_in_transit: true, quote_number: false, pickup_options: [], delivery_options: [], customer_context: nil, commodity_information_generator: GenerateCommodityInformation, **kwargs) ⇒ RatesOptions
Returns a new instance of RatesOptions.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 101 def initialize( billing_address:, shipping_method:, pickup_date: Date.today, billing: :prepaid, type: :l, density_eligible: false, accessorial_rate: false, time_in_transit: true, quote_number: false, pickup_options: [], delivery_options: [], customer_context: nil, commodity_information_generator: GenerateCommodityInformation, **kwargs ) @pickup_date = pickup_date @billing_address = billing_address @billing_code = BILLING_CODES.fetch(billing) @shipping_method = shipping_method @type_code = TYPE_CODES.fetch(type) @density_eligible = density_eligible @accessorial_rate = accessorial_rate @time_in_transit = time_in_transit @quote_number = quote_number @pickup_options = @delivery_options = @customer_context = customer_context @commodity_information_generator = commodity_information_generator super(**kwargs.reverse_merge(package_options_class: PackageOptions)) end |
Instance Attribute Details
#accessorial_rate ⇒ Boolean (readonly)
Returns indicates that the rate is accessorial.
64 65 66 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 64 def accessorial_rate @accessorial_rate end |
#billing_address ⇒ Physical::Location (readonly)
Returns the billing address.
46 47 48 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 46 def billing_address @billing_address end |
#billing_code ⇒ Symbol (readonly)
Returns how the shipment is billed (see BILLING_CODES).
55 56 57 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 55 def billing_code @billing_code end |
#commodity_information_generator ⇒ Callable (readonly)
Returns a callable that takes a shipment.
82 83 84 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 82 def commodity_information_generator @commodity_information_generator end |
#customer_context ⇒ String (readonly)
Returns customer context.
79 80 81 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 79 def customer_context @customer_context end |
#delivery_options ⇒ Array<String] shipment delivery service options (see {DELIVERY_OPTIONS}) (readonly)
Returns Array<String] shipment delivery service options (see DELIVERY_OPTIONS).
76 77 78 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 76 def @delivery_options end |
#density_eligible ⇒ Boolean (readonly)
Returns indicates that the rate request is density based.
61 62 63 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 61 def density_eligible @density_eligible end |
#pickup_date ⇒ Date (readonly)
Returns date of the pickup.
52 53 54 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 52 def pickup_date @pickup_date end |
#pickup_options ⇒ Array<String> (readonly)
Returns shipment pick up service options (see PICKUP_OPTIONS).
73 74 75 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 73 def @pickup_options end |
#quote_number ⇒ Boolean (readonly)
Returns requests a quote number be included in the response.
70 71 72 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 70 def quote_number @quote_number end |
#shipping_method ⇒ ShippingMethod (readonly)
Returns the shipping method.
49 50 51 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 49 def shipping_method @shipping_method end |
#time_in_transit ⇒ Boolean (readonly)
Returns requests transit timing information be included in the response.
67 68 69 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 67 def time_in_transit @time_in_transit end |
#type_code ⇒ String (readonly)
Returns rating call type (see TYPE_CODES).
58 59 60 |
# File 'lib/friendly_shipping/services/tforce_freight/rates_options.rb', line 58 def type_code @type_code end |