Class: Shippinglogic::FedEx::Rate

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

Overview

An interface to the rate services provided by FedEx. Allows you to get an array of rates from fedex for a shipment, or a single rate for a specific service.

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)

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)

  • delivery_deadline - whether or not to include estimated transit times. (default: true)

  • 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)

Misc options

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

  • include_transit_times - whether or not to include estimated transit times. (default: true)

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)
rates = fedex.rate(
  :shipper_postal_code => "10007",
  :shipper_country => "US",
  :recipient_postal_code => "75201",
  :recipient_country => "US",
  :package_weight => 24,
  :package_length => 12,
  :package_width => 12,
  :package_height => 12
)

rates.first
#<Shippinglogic::FedEx::Rates::Rate @currency="USD", @name="First Overnight", @cost=#<BigDecimal:19ea290,'0.7001E2',8(8)>,
  @deadline=Fri Aug 07 08:00:00 -0400 2009, @type="FIRST_OVERNIGHT", @saturday=false>

# to show accessor methods
rates.first.name
# => "First Overnight"

Defined Under Namespace

Classes: Service

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