Module: PackageTracker::Carriers::UPS

Extended by:
PackageTracker::Carrier, UPS
Included in:
UPS
Defined in:
lib/package_tracker/carriers/ups.rb

Constant Summary collapse

TEST_URL =
"wwwcie.ups.com"
LIVE_URL =
"www.ups.com"
PATH =
"/ups.app/xml/Track"

Instance Method Summary collapse

Methods included from PackageTracker::Carrier

validate_credentials!

Instance Method Details

#delivered_statusObject



21
22
23
# File 'lib/package_tracker/carriers/ups.rb', line 21

def delivered_status
  "DELIVERED"
end

#match(tracking_number) ⇒ Object



17
18
19
# File 'lib/package_tracker/carriers/ups.rb', line 17

def match(tracking_number)
  tracking_number =~ /^1Z\d*/
end

#track(tracking_number, options) ⇒ Object



11
12
13
14
15
# File 'lib/package_tracker/carriers/ups.rb', line 11

def track(tracking_number, options)
  validate_credentials!(options[:credentials])
  repsonse = Request.post(request_url(options[:testing]), PATH, request_data(tracking_number, options[:credentials]))
  parse_response(tracking_number, repsonse)
end