Sha256: 8b79d66b35b829a65c79bca771afee22e63940b8de9f2bf5a405fd5f1530dc00
Contents?: true
Size: 632 Bytes
Versions: 1
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true module SolidusEasypost module Calculator class WeightDimensionCalculator < BaseDimensionCalculator protected def compute_for_return_authorization(return_authorization) total_weight = return_authorization.inventory_units.joins(:variant).sum(:weight) SolidusEasypost::ParcelDimension.new(weight: total_weight) end def compute_for_package(package) total_weight = package.contents.sum do |item| item.quantity * item.variant.weight end SolidusEasypost::ParcelDimension.new(weight: total_weight) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_easypost-3.0.0 | lib/solidus_easypost/calculator/weight_dimension_calculator.rb |