Class: ShippingCalc::FreightQuote
- Inherits:
-
Object
- Object
- ShippingCalc::FreightQuote
- Defined in:
- lib/shipping_calc/freight_quote.rb
Overview
This API is based on version 03 of the Freight Quote's (FQ) connection test, release on 2007 (and still used on 2008). When you first create the account you'll receive a test account that works with your username and password.
After having a stable system you should e-mail FQ asking for a production key to the servers. If you want to test with a generic username and password you can the user "[email protected]" with password "XML", but this won't give you access to all the debugging info. associated with your account (or so they say).
Instance Method Summary collapse
-
#quote(params) ⇒ Object
Obtains some shipping quotes using freight carriers from FQ's site.
Instance Method Details
#quote(params) ⇒ Object
Obtains some shipping quotes using freight carriers from FQ's site. The return value is a hash like => rate so you can see all the available prices. params is a hash with all the settings for the shipment. They are:
:api_email:: API access email, provided by FQ. :api_password:: API access password, provided by FQ. :from_zip:: Sender's zip code. :to_zip:: Recipient's zip code. :weight:: Total weight of the order in lbs. :dimensions:: Optional - Length, width and height of the shipment, described as a string: "[Length]xx" (e.g. "23x32x15"). :description:: Optional - Description of the stuff that's being shipped. Defaults to "NODESC". :class:: Optional - Freightquote's shipping class. Defaults to nil. :from_conditions:: Optional - String that indicates if the sending location is a residence ("RES"), a business with a forklift or dock ("BIZ_WITH") or a business without a forklift or dock ("BIZ_WITHOUT"). Defaults to "RES". :to_conditions:: Optional - String that indicates if the receiving location is a residence ("RES"), a business with a forklift or dock ("BIZ_WITH") or a business without a forklift or dock ("BIZ_WITHOUT"). Defaults to "RES". :liftgate:: Optional - A boolean indicating if a liftgate's required at the receiving location (API page 10). Defaults to false. :inside_delivery:: Optional - A boolean indicating if inside delivery's required at the receiving location (API page 10). Defaults to false. Note Both dimensions or class are optional but one of them has to be there. If both parameters are filled then priority will be given to class.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/shipping_calc/freight_quote.rb', line 60 def quote(params) validate params params[:description] ||= "NODESC" params[:from_conditions] ||= "RES" params[:to_conditions] ||= "RES" @xml = Document.new ## @xml << XMLDecl.new("1.0' encoding='UTF-8") rate_estimate(params) request end |