Class: Spree::Carton

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/carton.rb

Instance Method Summary collapse

Methods inherited from Base

display_includes

Methods included from Spree::Core::Permalinks

#generate_permalink, #save_permalink

Instance Method Details

#any_exchanges?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/models/spree/carton.rb', line 56

def any_exchanges?
  inventory_units.any?(&:original_return_item)
end

#display_shipped_atObject



44
45
46
# File 'app/models/spree/carton.rb', line 44

def display_shipped_at
  shipped_at.to_fs(:rfc822)
end

#manifestObject



48
49
50
# File 'app/models/spree/carton.rb', line 48

def manifest
  @manifest ||= Spree::ShippingManifest.new(inventory_units: inventory_units).items
end

#manifest_for_order(order) ⇒ Object



52
53
54
# File 'app/models/spree/carton.rb', line 52

def manifest_for_order(order)
  Spree::ShippingManifest.new(inventory_units: inventory_units).for_order(order).items
end

#order_emailsObject



36
37
38
# File 'app/models/spree/carton.rb', line 36

def order_emails
  orders.map(&:email).uniq
end

#order_numbersObject



32
33
34
# File 'app/models/spree/carton.rb', line 32

def order_numbers
  orders.map(&:number)
end

#shipment_numbersObject



40
41
42
# File 'app/models/spree/carton.rb', line 40

def shipment_numbers
  shipments.map(&:number)
end

#to_paramObject



24
25
26
# File 'app/models/spree/carton.rb', line 24

def to_param
  number
end

#tracking_urlObject



28
29
30
# File 'app/models/spree/carton.rb', line 28

def tracking_url
  @tracking_url ||= shipping_method.build_tracking_url(tracking)
end