Class: Spree::DeliveryRateProvider::Freight
- Defined in:
- app/models/spree/delivery_rate_provider/freight.rb
Overview
Quotes nothing, and says so.
International freight is priced by a forwarder after someone looks at the order — the carton count, the cubic meters, the destination port — not by an API at checkout. So this provider returns a rate with no price, carrying the logistics summary the merchant will send to the forwarder in place of an amount.
Which freight method a shipment is offered is Spree::DeliveryMethodRules::VolumeRule's job: a merchant configures "Pallet" and "40ft container" as ordinary delivery methods on this provider, each bounded by the cubic meters it covers.
See docs/plans/6.0-b2b-wholesale-shipping.md.
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.requires_address? ⇒ Boolean
Freight ships to an address like any carrier does.
-
.uses_calculator? ⇒ Boolean
There is no price to calculate, so the method's calculator is never consulted and admin UIs hide its pricing form.
Instance Method Summary collapse
Methods inherited from Base
#book, #estimates, #initialize, #release, service_catalog
Methods included from ApiTyped
#api_type, api_type_for, #api_typed_family, class_name_for, find, registered_class
Methods included from IntegrationBackedProvider
Constructor Details
This class inherits a constructor from Spree::DeliveryRateProvider::Base
Class Method Details
.requires_address? ⇒ Boolean
Freight ships to an address like any carrier does.
25 26 27 |
# File 'app/models/spree/delivery_rate_provider/freight.rb', line 25 def self.requires_address? true end |
.uses_calculator? ⇒ Boolean
There is no price to calculate, so the method's calculator is never consulted and admin UIs hide its pricing form.
20 21 22 |
# File 'app/models/spree/delivery_rate_provider/freight.rb', line 20 def self.uses_calculator? false end |
Instance Method Details
#estimate(package) ⇒ Spree::DeliveryRateProvider::Estimate
31 32 33 34 35 36 37 38 |
# File 'app/models/spree/delivery_rate_provider/freight.rb', line 31 def estimate(package) Estimate.new( cost: 0, unpriced: true, name: delivery_method.name, metadata: { 'freight_summary' => package.freight_summary.as_json } ) end |