Class: Spree::Calculator::Shipping::DigitalDelivery

Inherits:
ShippingCalculator show all
Defined in:
app/models/spree/calculator/shipping/digital_delivery.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ShippingCalculator

#compute_shipment

Methods inherited from Spree::Calculator

calculators, #compute, #description, #to_s

Class Method Details

.descriptionObject



9
10
11
# File 'app/models/spree/calculator/shipping/digital_delivery.rb', line 9

def self.description
  Spree.t('digital.digital_delivery')
end

Instance Method Details

#available?(package) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/spree/calculator/shipping/digital_delivery.rb', line 17

def available?(package)
  package.contents.all? { |content| content.variant.digital? }
end

#compute_package(_package = nil) ⇒ Object



13
14
15
# File 'app/models/spree/calculator/shipping/digital_delivery.rb', line 13

def compute_package(_package = nil)
  preferred_amount
end