Class: Delivery::CalculateShippingOptions
- Inherits:
-
BaseService
- Object
- BaseService
- Delivery::CalculateShippingOptions
- Defined in:
- app/services/delivery/calculate_shipping_options.rb
Overview
Builds the option payload WyShipping.calculate_shipping_from_options
consumes for one delivery — addresses, country, package dimensions/weights,
residential flag, COD/insurance values, LTL/freight defaults, RMA carrier
restrictions, WWW estimate flags. Pure construction; does not call carriers.
Extracted from Delivery#calculate_shipping_options (god-object
decomposition); the model keeps a thin delegator. The seed hash is mutated
in place and returned, preserving the original method's contract.
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
-
#initialize(delivery, seed_options = {}) ⇒ CalculateShippingOptions
constructor
A new instance of CalculateShippingOptions.
-
#process ⇒ Hash
The options hash WyShipping consumes.
Methods inherited from BaseService
#log_debug, #log_error, #log_info, #log_warning, #logger, #tagged_logger
Constructor Details
#initialize(delivery, seed_options = {}) ⇒ CalculateShippingOptions
Returns a new instance of CalculateShippingOptions.
17 18 19 20 21 |
# File 'app/services/delivery/calculate_shipping_options.rb', line 17 def initialize(delivery, = {}) super() @delivery = delivery @opts = end |
Instance Method Details
#process ⇒ Hash
Returns the options hash WyShipping consumes.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/services/delivery/calculate_shipping_options.rb', line 24 def process apply_resource_shipping_method! apply_addresses! apply_store_and_service_flags! apply_freight_flags! apply_packages_and_insurance! apply_cod! apply_rma_carrier_restrictions! apply_www_flags! opts end |