Class: Shippinglogic::FedEx::Ship

Inherits:
Service show all
Defined in:
lib/shippinglogic/fedex/ship.rb

Overview

An interface to the shipe services provided by FedEx. Allows you to create shipments and get various information on the shipment created. Such as the tracking number, the label image, barcode image, delivery date, etc.

Options

Shipper options

  • shipper_name - name of the shipper.

  • shipper_title - title of the shipper.

  • shipper_company_name - company name of the shipper.

  • shipper_phone_number - phone number of the shipper.

  • shipper_email - email of the shipper.

  • shipper_streets - street part of the address, separate multiple streets with a new line, dont include blank lines.

  • shipper_city - city part of the address.

  • shipper_state_ - state part of the address, use state abreviations.

  • shipper_postal_code - postal code part of the address. Ex: zip for the US.

  • shipper_country - country code part of the address. FedEx expects abbreviations, but Shippinglogic will convert full names to abbreviations for you.

  • shipper_residential - a boolean value representing if the address is redential or not (default: false)

Recipient options

  • recipient_name - name of the recipient.

  • recipient_title - title of the recipient.

  • recipient_company_name - company name of the recipient.

  • recipient_phone_number - phone number of the recipient.

  • recipient_email - email of the recipient.

  • recipient_streets - street part of the address, separate multiple streets with a new line, dont include blank lines.

  • recipient_city - city part of the address.

  • recipient_state - state part of the address, use state abreviations.

  • recipient_postal_code - postal code part of the address. Ex: zip for the US.

  • recipient_country - country code part of the address. FedEx expects abbreviations, but Shippinglogic will convert full names to abbreviations for you.

  • recipient_residential - a boolean value representing if the address is redential or not (default: false)

Label options

  • label_format - one of Enumerations::LABEL_FORMATS. (default: COMMON2D)

  • label_file_type - one of Enumerations::LABEL_FILE_TYPES. (default: PDF)

  • label_stock_type - one of Enumerations::LABEL_STOCK_TYPES. (default: PAPER_8.5X11_TOP_HALF_LABEL)

Packaging options

One thing to note is that FedEx does support multiple package shipments. The problem is that all of the packages must be identical. FedEx specifically notes in their documentation that mutiple package specifications are not allowed. So your only option for a multi package shipment is to increase the package_count option and keep the dimensions and weight the same for all packages. Then again, the documentation for the FedEx web services is terrible, so I could be wrong. Any tests I tried resulted in an error though.

  • packaging_type - one of Enumerations::PACKAGE_TYPES. (default: YOUR_PACKAGING)

  • package_count - the number of packages in your shipment. (default: 1)

  • package_weight - a single packages weight.

  • package_weight_units - either LB or KG. (default: LB)

  • package_length - a single packages length, only required if using YOUR_PACKAGING for packaging_type.

  • package_width - a single packages width, only required if using YOUR_PACKAGING for packaging_type.

  • package_height - a single packages height, only required if using YOUR_PACKAGING for packaging_type.

  • package_dimension_units - either IN or CM. (default: IN)

Monetary options

  • currency_type - the type of currency. (default: nil, because FedEx will default to your account preferences)

  • insured_value - the value you want to insure, if any. (default: nil)

  • payment_type - one of Enumerations::PAYMENT_TYPES. (default: SENDER)

  • payor_account_number - if the account paying for this ship is different than the account you specified then you can specify that here. (default: your account number)

  • payor_country - the country code for the account number. (default: US)

Delivery options

  • ship_time - a Time object representing when you want to ship the package. (default: Time.now)

  • service_type - one of Enumerations::SERVICE_TYPES, this is optional, leave this blank if you want a list of all available services. (default: nil)

  • dropoff_type - one of Enumerations::DROP_OFF_TYPES. (default: REGULAR_PICKUP)

  • special_services_requested - any exceptions or special services FedEx needs to be aware of, this should be one or more of Enumerations::SPECIAL_SERVICES. (default: nil)

  • signature - one of Enumerations::SIGNATURE_OPTION_TYPES. (default: nil, which defaults to the service default)

Misc options

  • just_validate - will tell FedEx to ONLY validate the shipment, not actually create it. (default: false)

  • rate_request_types - one or more of Enumerations::RATE_REQUEST_TYPES. (default: ACCOUNT)

Simple Example

Here is a very simple example. Mix and match the options above to get more accurate rates:

fedex = Shippinglogic::FedEx.new(key, password, account, meter)
shipment = fedex.ship(
  :shipper_postal_code => "10007",
  :shipper_country => "US",
  :recipient_postal_code => "75201",
  :recipient_country_code => "US",
  :package_weight => 24,
  :package_length => 12,
  :package_width => 12,
  :package_height => 12
)

shipment.inspect
#<Shippinglogic::FedEx::Ship::Shipment rate:decimal, currency:string, delivery_date:date, tracking_number:string,
  label:string(base64 decoded), barcode:string(base64 decoded) >

# to show accessor methods
shipment.tracking_number
# => "XXXXXXXXXXXXXX"

Defined Under Namespace

Classes: Shipment

Constant Summary collapse

VERSION =
{:major => 6, :intermediate => 0, :minor => 0}

Instance Attribute Summary

Attributes inherited from Service

#base

Method Summary

Methods inherited from Service

#initialize

Methods included from Validation

#errors, #valid?

Methods included from Attributes

included

Methods inherited from Proxy

#initialize

Constructor Details

This class inherits a constructor from Shippinglogic::Service

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Shippinglogic::Proxy