lib/active_shipping/carriers/ups.rb in active_shipping-1.1.2 vs lib/active_shipping/carriers/ups.rb in active_shipping-1.1.3
- old
+ new
@@ -63,10 +63,11 @@
"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",
@@ -131,10 +132,19 @@
rate_request = build_rate_request(origin, destination, packages, options)
response = commit(:rates, save_request(access_request + rate_request), options[:test])
parse_rate_response(origin, destination, packages, response, options)
end
+ # Retrieves tracking information for a previous shipment
+ #
+ # @note Override with whatever you need to get a shipping label
+ #
+ # @param tracking_number [String] The unique identifier of the shipment to track.
+ # @param options [Hash] Carrier-specific parameters.
+ # @option options [Boolean] :mail_innovations Set this to true to track a Mail Innovations Package
+ # @return [ActiveShipping::TrackingResponse] The response from the carrier. This
+ # response should a list of shipment tracking events if successful.
def find_tracking_info(tracking_number, options = {})
options = @options.update(options)
access_request = build_access_request
tracking_request = build_tracking_request(tracking_number, options)
response = commit(:track, save_request(access_request + tracking_request), options[:test])
@@ -512,14 +522,16 @@
end
def build_tracking_request(tracking_number, options = {})
xml_builder = Nokogiri::XML::Builder.new do |xml|
xml.TrackRequest do
+ xml.TrackingOption(options[:tracking_option]) if options[:tracking_option]
xml.Request do
xml.RequestAction('Track')
xml.RequestOption('1')
end
xml.TrackingNumber(tracking_number.to_s)
+ xml.TrackingOption('03') if options[:mail_innovations]
end
end
xml_builder.to_xml
end