Class: SimpleShipping::Shipment

Inherits:
Abstract::Model show all
Defined in:
lib/simple_shipping/shipment.rb

Overview

Represents a shipment.

Attributes:

  • shipper (an instance of Party

  • recipient (an instance of Party

  • package (an instance of Package

  • payor (:shipper, :recipient). Default value is :shipper

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract::Model

#initialize, set_default_values, validates_submodel

Constructor Details

This class inherits a constructor from SimpleShipping::Abstract::Model

Instance Attribute Details

#packageObject

Returns the value of attribute package.



10
11
12
# File 'lib/simple_shipping/shipment.rb', line 10

def package
  @package
end

#payorObject

Returns the value of attribute payor.



10
11
12
# File 'lib/simple_shipping/shipment.rb', line 10

def payor
  @payor
end

#recipientObject

Returns the value of attribute recipient.



10
11
12
# File 'lib/simple_shipping/shipment.rb', line 10

def recipient
  @recipient
end

#shipperObject

Returns the value of attribute shipper.



10
11
12
# File 'lib/simple_shipping/shipment.rb', line 10

def shipper
  @shipper
end

Instance Method Details

#payor_account_numberObject

Account number of payor.



25
26
27
28
29
30
31
32
# File 'lib/simple_shipping/shipment.rb', line 25

def 
  case payor
  when :shipper
    shipper.   if shipper.respond_to?(:account_number)
  when :recipient
    recipient. if recipient.respond_to?(:account_number)
  end
end