Sha256: 8804581df2edaf33f4f7f1bc6eaf41876c2dffdd6c6eb6ada1728193f90fe18e

Contents?: true

Size: 820 Bytes

Versions: 5

Compression:

Stored size: 820 Bytes

Contents

class ShipmentFactory
  include ActiveMerchant::Shipping

  def self.build(carrier = :fedex)
    shipment = ReturnShipment.new
    if carrier == :fedex
      shipment.ship_at = Time.now
      shipment.service = 'FEDEX_GROUND'
      shipment.payment_type = 'RECIPIENT'
      shipment.packaging_type = FedEx::PackageTypes['your_packaging']
      shipment.recipient = PartyFactory.build(:fedex)
      jillians_boston = Location.new(
        :address1 => '145 Ipswitch Street',
        :city => 'Boston',
        :state => 'MA',
        :zip => '02215',
        :country => 'US'
      )
      shipment.shipper = PartyFactory.build(:fedex, :location => jillians_boston)
      shipment.total_weight_value = 10
      shipment.payment_type = 'SENDER'
      shipment.total_weight_units = 'LB'
    end
    
    shipment
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_shipping-0.1.4 test/shipment_factory.rb
active_shipping-0.1.3 test/shipment_factory.rb
active_shipping-0.1.2 test/shipment_factory.rb
active_shipping-0.1.1 test/shipment_factory.rb
active_shipping-0.1.0 test/shipment_factory.rb