Class: ActiveMerchant::Shipping::UPS
- Defined in:
- lib/active_shipping/shipping/carriers/ups.rb
Constant Summary collapse
- TEST_URL =
'https://wwwcie.ups.com'
- LIVE_URL =
'https://onlinetools.ups.com'
- RESOURCES =
{ :rates => 'ups.app/xml/Rate', :track => 'ups.app/xml/Track' }
- PICKUP_CODES =
HashWithIndifferentAccess.new({ :daily_pickup => "01", :customer_counter => "03", :one_time_pickup => "06", :on_call_air => "07", :suggested_retail_rates => "11", :letter_center => "19", :air_service_center => "20" })
- CUSTOMER_CLASSIFICATIONS =
HashWithIndifferentAccess.new({ :wholesale => "01", :occasional => "03", :retail => "04" })
- DEFAULT_CUSTOMER_CLASSIFICATIONS =
these are the defaults described in the UPS API docs, but they don’t seem to apply them under all circumstances, so we need to take matters into our own hands
Hash.new do |hash,key| hash[key] = case key.to_sym when :daily_pickup then :wholesale when :customer_counter then :retail else :occasional end end
- DEFAULT_SERVICES =
{ "01" => "UPS Next Day Air", "02" => "UPS Second Day Air", "03" => "UPS Ground", "07" => "UPS Worldwide Express", "08" => "UPS Worldwide Expedited", "11" => "UPS Standard", "12" => "UPS Three-Day Select", "13" => "UPS Next Day Air Saver", "14" => "UPS Next Day Air Early A.M.", "54" => "UPS Worldwide Express Plus", "59" => "UPS Second Day Air A.M.", "65" => "UPS Saver", "82" => "UPS Today Standard", "83" => "UPS Today Dedicated Courier", "84" => "UPS Today Intercity", "85" => "UPS Today Express", "86" => "UPS Today Express Saver" }
- CANADA_ORIGIN_SERVICES =
{ "01" => "UPS Express", "02" => "UPS Expedited", "14" => "UPS Express Early A.M." }
- MEXICO_ORIGIN_SERVICES =
{ "07" => "UPS Express", "08" => "UPS Expedited", "54" => "UPS Express Plus" }
- EU_ORIGIN_SERVICES =
{ "07" => "UPS Express", "08" => "UPS Expedited" }
- OTHER_NON_US_ORIGIN_SERVICES =
{ "07" => "UPS Express" }
- TRACKING_STATUS_CODES =
HashWithIndifferentAccess.new({ 'I' => :in_transit, 'D' => :delivered, 'X' => :exception, 'P' => :pickup, 'M' => :manifest_pickup })
- EU_COUNTRY_CODES =
From en.wikipedia.org/w/index.php?title=European_Union&oldid=174718707 (Current as of November 30, 2007)
["GB", "AT", "BE", "BG", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE"]
- US_TERRITORIES_TREATED_AS_COUNTRIES =
["AS", "FM", "GU", "MH", "MP", "PW", "PR", "VI"]
- @@name =
"UPS"
Instance Attribute Summary
Attributes inherited from Carrier
Instance Method Summary collapse
- #find_rates(origin, destination, packages, options = {}) ⇒ Object
- #find_tracking_info(tracking_number, options = {}) ⇒ Object
- #requirements ⇒ Object
Methods inherited from Carrier
#initialize, #maximum_weight, #valid_credentials?
Constructor Details
This class inherits a constructor from ActiveMerchant::Shipping::Carrier
Instance Method Details
#find_rates(origin, destination, packages, options = {}) ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/active_shipping/shipping/carriers/ups.rb', line 106 def find_rates(origin, destination, packages, ={}) origin, destination = upsified_location(origin), upsified_location(destination) = @options.merge() packages = Array(packages) access_request = build_access_request rate_request = build_rate_request(origin, destination, packages, ) response = commit(:rates, save_request(access_request + rate_request), ([:test] || false)) parse_rate_response(origin, destination, packages, response, ) end |
#find_tracking_info(tracking_number, options = {}) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/active_shipping/shipping/carriers/ups.rb', line 116 def find_tracking_info(tracking_number, ={}) = @options.update() access_request = build_access_request tracking_request = build_tracking_request(tracking_number, ) response = commit(:track, save_request(access_request + tracking_request), ([:test] || false)) parse_tracking_response(response, ) end |
#requirements ⇒ Object
102 103 104 |
# File 'lib/active_shipping/shipping/carriers/ups.rb', line 102 def requirements [:key, :login, :password] end |