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, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

#admin_form_preference_names, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#any_exchanges?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'app/models/spree/carton.rb', line 54

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

#display_shipped_atObject



42
43
44
# File 'app/models/spree/carton.rb', line 42

def display_shipped_at
  shipped_at.to_s(:rfc822)
end

#manifestObject



46
47
48
# File 'app/models/spree/carton.rb', line 46

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

#manifest_for_order(order) ⇒ Object



50
51
52
# File 'app/models/spree/carton.rb', line 50

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

#order_emailsObject



34
35
36
# File 'app/models/spree/carton.rb', line 34

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

#order_numbersObject



30
31
32
# File 'app/models/spree/carton.rb', line 30

def order_numbers
  orders.map(&:number)
end

#shipment_numbersObject



38
39
40
# File 'app/models/spree/carton.rb', line 38

def shipment_numbers
  shipments.map(&:number)
end

#to_paramObject



22
23
24
# File 'app/models/spree/carton.rb', line 22

def to_param
  number
end

#tracking_urlObject



26
27
28
# File 'app/models/spree/carton.rb', line 26

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