class SimpleShipping::Shipment

Represents a shipment.

Attributes:

Attributes

package[RW]
payor[RW]
recipient[RW]
shipper[RW]

Public Instance Methods

payor_account_number() click to toggle source

Account number of payor.

# File lib/simple_shipping/shipment.rb, line 25
def payor_account_number
  case payor
  when :shipper
    shipper.account_number   if shipper.respond_to?(:account_number)
  when :recipient
    recipient.account_number if recipient.respond_to?(:account_number)
  end
end

Private Instance Methods

validate_payor_account_number() click to toggle source

Validate presence of payor account number.

@return [void]

# File lib/simple_shipping/shipment.rb, line 37
def validate_payor_account_number
  errors.add(:abstract, "Payor account number is missing") unless payor_account_number
end