Class: Shipment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/shipment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#special_instructionsObject

Returns the value of attribute special_instructions.



11
12
13
# File 'app/models/shipment.rb', line 11

def special_instructions
  @special_instructions
end

Instance Method Details

#create_shipping_chargeObject



23
24
25
26
27
28
29
30
31
32
# File 'app/models/shipment.rb', line 23

def create_shipping_charge
  if shipping_method
    self.charge ||= Charge.create({
        :order => order,
        :secondary_type => "ShippingCharge",
        :description => "#{I18n.t(:shipping)} (#{shipping_method.name})",
        :adjustment_source => self,
      })
  end
end

#shipped=(value) ⇒ Object



18
19
20
21
# File 'app/models/shipment.rb', line 18

def shipped=(value)
  return unless value == "1" && shipped_at.nil?
  self.shipped_at = Time.now
end

#shipped?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/shipment.rb', line 14

def shipped?
  self.shipped_at
end