class SimpleShipping::Demo::Fedex
Helper object to send demo requests to FedEx in order to test credentials and the library.
@example
demo = SimpleShipping::Demo::Fedex.new(credentials) response = demo.shipment_request
Attributes
credentials[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/simple_shipping/demo/fedex.rb, line 10 def initialize(options = {}) @options = options.reverse_merge(:log => false) end
Public Instance Methods
fedex_client()
click to toggle source
Initialize the FedEx client.
@return [SimpleShipping::Fedex::Client]
# File lib/simple_shipping/demo/fedex.rb, line 32 def fedex_client @fedex_client ||= SimpleShipping::Fedex::Client.new( :credentials => options.slice(:key, :password, :account_number, :meter_number), :log => options[:log], :live => options[:live] ) end
package()
click to toggle source
Build the package object.
@return [SimpleShipping::Package]
# File lib/simple_shipping/demo/fedex.rb, line 17 def package @package ||= SimpleShipping::Package.new( :weight => 1, :length => 2, :height => 3, :dimension_units => :in, # you can use :kg as well :weight_units => :lb, # you can use :cm as well :width => 4, :packaging_type => :your ) end
shipment_request()
click to toggle source
Send the shipment request to FedEx.
@return [SimpleShipping::Fedex::Response]
# File lib/simple_shipping/demo/fedex.rb, line 43 def shipment_request fedex_client.shipment_request(shipper, recipient, package) end