Class: Shippinglogic::FedEx
- Inherits:
-
Object
- Object
- Shippinglogic::FedEx
- Defined in:
- lib/shippinglogic/fedex.rb,
lib/shippinglogic/fedex/rate.rb,
lib/shippinglogic/fedex/ship.rb,
lib/shippinglogic/fedex/error.rb,
lib/shippinglogic/fedex/proxy.rb,
lib/shippinglogic/fedex/track.rb,
lib/shippinglogic/fedex/cancel.rb,
lib/shippinglogic/fedex/request.rb,
lib/shippinglogic/fedex/service.rb,
lib/shippinglogic/fedex/response.rb,
lib/shippinglogic/fedex/signature.rb,
lib/shippinglogic/fedex/attributes.rb,
lib/shippinglogic/fedex/validation.rb,
lib/shippinglogic/fedex/enumerations.rb
Defined Under Namespace
Modules: Attributes, Enumerations, Request, Response, Validation Classes: Cancel, Error, Proxy, Rate, Service, Ship, Signature, Track
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#key ⇒ Object
Returns the value of attribute key.
-
#meter ⇒ Object
Returns the value of attribute meter.
-
#options ⇒ Object
Returns the value of attribute options.
-
#password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
-
.options ⇒ Object
A hash representing default the options.
Instance Method Summary collapse
- #cancel(attributes = {}) ⇒ Object
-
#initialize(key, password, account, meter, options = {}) ⇒ FedEx
constructor
Before you can use the FedEx web services you need to provide 4 credentials:.
- #rate(attributes = {}) ⇒ Object
- #ship(attributes = {}) ⇒ Object
- #signature(attributes = {}) ⇒ Object
- #track(attributes = {}) ⇒ Object
Constructor Details
#initialize(key, password, account, meter, options = {}) ⇒ FedEx
Before you can use the FedEx web services you need to provide 4 credentials:
-
Your fedex web service key
-
Your fedex password
-
Your fedex account number
-
Your fedex meter number
You can easily get these things by logging into your fedex account and going to:
www.fedex.com/wpor/wpor/editConsult.do
If for some reason this link no longer works because FedEx changed it, just go to the developer resources area and then navigate to the FedEx web services for shipping area. Once there you should see a link to apply for a develop test key.
The last parameter allows you to modify the class options on an instance level. It accepts the same options that the class level method #options accepts. If you don’t want to change any of them, don’t supply this parameter.
53 54 55 56 57 58 59 |
# File 'lib/shippinglogic/fedex.rb', line 53 def initialize(key, password, account, meter, = {}) self.key = key self.password = password self.account = account self.meter = meter self. = self.class..merge() end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
33 34 35 |
# File 'lib/shippinglogic/fedex.rb', line 33 def account @account end |
#key ⇒ Object
Returns the value of attribute key.
33 34 35 |
# File 'lib/shippinglogic/fedex.rb', line 33 def key @key end |
#meter ⇒ Object
Returns the value of attribute meter.
33 34 35 |
# File 'lib/shippinglogic/fedex.rb', line 33 def meter @meter end |
#options ⇒ Object
Returns the value of attribute options.
33 34 35 |
# File 'lib/shippinglogic/fedex.rb', line 33 def @options end |
#password ⇒ Object
Returns the value of attribute password.
33 34 35 |
# File 'lib/shippinglogic/fedex.rb', line 33 def password @password end |
Class Method Details
.options ⇒ Object
A hash representing default the options. If you are using this in a Rails app the best place to modify or change these options is either in an initializer or your specific environment file. Keep in mind that these options can be modified on the instance level when creating an object. See #initialize for more details.
Options
-
:test
- this basically tells us which url to use. If set to true we will use the FedEx test URL, if false we will use the production URL. If you are using this in a rails app, unless you are in your production environment, this will default to true automatically. -
:test_url
- the test URL for FedEx’s webservices. (default: gatewaybeta.fedex.com:443/xml) -
:production_url
- the production URL for FedEx’s webservices. (default: gateway.fedex.com:443/xml)
25 26 27 28 29 30 31 |
# File 'lib/shippinglogic/fedex.rb', line 25 def self. @options ||= { :test => defined?(Rails) && !Rails.env.production?, :production_url => "https://gateway.fedex.com:443/xml", :test_url => "https://gatewaybeta.fedex.com:443/xml" } end |
Instance Method Details
#cancel(attributes = {}) ⇒ Object
61 62 63 |
# File 'lib/shippinglogic/fedex.rb', line 61 def cancel(attributes = {}) @cancel ||= Cancel.new(self, attributes) end |
#rate(attributes = {}) ⇒ Object
65 66 67 |
# File 'lib/shippinglogic/fedex.rb', line 65 def rate(attributes = {}) @rate ||= Rate.new(self, attributes) end |
#ship(attributes = {}) ⇒ Object
69 70 71 |
# File 'lib/shippinglogic/fedex.rb', line 69 def ship(attributes = {}) @ship ||= Ship.new(self, attributes) end |