Method: McFedex::Base#initialize
- Defined in:
- lib/mc-fedex.rb
#initialize(options = {}) ⇒ Base
Initializes the Fedex::Base class, setting defaults where necessary.
fedex = Fedex::Base.new( = {})
Example:
fedex = Fedex::Base.new(:auth_key => AUTH_KEY,
:security_code => SECURITY_CODE
:account_number => ACCOUNT_NUMBER,
:meter_number => METER_NUMBER)
Required options for new
:auth_key - Your Fedex Authorization Key
:security_code - Your Fedex Security Code
:account_number - Your Fedex Account Number
:meter_number - Your Fedex Meter Number
Additional options
:dropoff_type - One of Fedex::DropoffTypes. Defaults to DropoffTypes::REGULAR_PICKUP
:packaging_type - One of Fedex::PackagingTypes. Defaults to PackagingTypes::YOUR_PACKAGING
:label_type - One of Fedex::LabelFormatTypes. Defaults to LabelFormatTypes::COMMON2D. You'll only need to change this
if you're generating completely custom labels with a format of your own design. If printing to Fedex stock
leave this alone.
:label_image_type - One of Fedex::LabelSpecificationImageTypes. Defaults to LabelSpecificationImageTypes::PDF.
:rate_request_type - One of Fedex::RateRequestTypes. Defaults to RateRequestTypes::ACCOUNT
:payment - One of Fedex::PaymentTypes. Defaults to PaymentTypes::SENDER
:units - One of Fedex::WeightUnits. Defaults to WeightUnits::LB
:currency - One of Fedex::CurrencyTypes. Defaults to CurrencyTypes::USD
:debug - Enable or disable debug (wiredump) output. Defaults to false.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/mc-fedex.rb', line 60 def initialize( = {}) (:base, ) @auth_key = [:auth_key] @security_code = [:security_code] @account_number = [:account_number] @meter_number = [:meter_number] @wsdl_path = [:wsdl_path] @use_smart_post = [:use_smart_post] @smart_post_hub = [:smart_post_hub] @dropoff_type = [:dropoff_type] || DropoffTypes::REGULAR_PICKUP @packaging_type = [:packaging_type] || PackagingTypes::YOUR_PACKAGING @label_type = [:label_type] || LabelFormatTypes::COMMON2D @label_image_type = [:label_image_type] || LabelSpecificationImageTypes::PDF @rate_request_type = [:rate_request_type] || RateRequestTypes::LIST @payment_type = [:payment] || PaymentTypes::SENDER @units = [:units] || WeightUnits::LB @currency = [:currency] || 'USD' @debug = [:debug] || false end |