tgfi/freightquote
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
= FreightQuote A simple and straight forward interface to the FreightQuote.com API. == Helpful links * <b>Documentation:</b> http://rdoc.info/projects/tgfi/freightquote * <b>Repository:</b> http://github.com/tgfi/freightquote/tree/master * <b>Issues:</b> http://github.com/tgfi/freightquote/issues <b>Before contacting me directly, please read:</b> If you find a bug or a problem please post it in the issues section. This also benefits other people in the future with the same questions / problems. Thank you. == Install & use Install the plugin from github: script/plugin install git://github.com/tgfi/freightquote.git See below for usage examples. == Examples Only quotes are supported at this time. fq = FreightQuote::Base.new( :email => 'user@host.tld', :password => 'password', :test => true ) origin = FreightQuote::Origin.new( :loading_dock => true, :residence => false, :construction_site => false, :inside => false, :lift_gate => false, :zip_code => '46202-1234' ) destination = FreightQuote::Destination.new( :loading_dock => false, :residence => true, :construction_site => false, :inside => false, :lift_gate => true, :zip_code => '95014' ) shipment1 = FreightQuote::Shipment.new( :weight => 1000, :weight_class => 50, :length => 10, :width => 11, :height => 12, :nmfc => '', :product_description => 'hardwood flooring', :hazardous => false, :package_type => 'PALLETS', :pieces => 1, :stackable => false ) shipment2 = FreightQuote::Shipment.new( :weight => 2000, :weight_class => 50, :length => 20, :width => 21, :height => 22, :nmfc => '', :product_description => 'hardwood flooring', :hazardous => false, :package_type => 'PALLETS', :pieces => 1, :stackable => false ) # stop1 = FreightQuote::Stop.new( # :zip_code => '47933' # ) service_cod = FreightQuote::Cod.new( :amount_to_collect => 0.00, :remit_to_name => 'Don Draper', :remit_to_address => '1234 Madison Avenue', :remit_to_city => 'New York', :remit_to_state => 'NY', :remit_to_zip_code => '10027' ) # Get your quote quote = fq.quote( :bill_to => 'SHIPPER', :origin => origin, :destination => destination, :stops => [], :shipments => [shipment1, shipment2], :service_cod => service_cod, :service_blind => false, :service_packaged => 0 ) # quote.request if quote.success? puts "quote.quote_id: #{quote.quote_id}" puts "quote.carriers: #{quote.carriers.length}" quote.carriers.each do |carrier| # puts carrier.to_yaml end puts "cheapest_carrier: #{quote.cheapest_carrier.to_yaml}" else quote.errors.each do |k,v| puts "#{k} => #{v}" end end == Copyright Copyright (c) 2009 {Greg Benedict of TGFI}[http://www.tgfi.com], released under the MIT license