Module: PackageTracker::Carriers::FedEx

Extended by:
PackageTracker::Carrier, FedEx
Included in:
FedEx
Defined in:
lib/package_tracker/carriers/fedex.rb

Constant Summary collapse

TEST_URL =
'gatewaybeta.fedex.com'
LIVE_URL =
'gateway.fedex.com'
PATH =
"/xml"
PORT =
"443"

Instance Method Summary collapse

Methods included from PackageTracker::Carrier

validate_credentials!

Instance Method Details

#delivered_statusObject



29
30
31
# File 'lib/package_tracker/carriers/fedex.rb', line 29

def delivered_status
  "Delivered"
end

#match(tracking_number) ⇒ Object



25
26
27
# File 'lib/package_tracker/carriers/fedex.rb', line 25

def match(tracking_number)
  tracking_number =~ /^\w{9}$/ || tracking_number =~ /^\d{12,15}$/ || tracking_number =~ /^96\d{20}$/
end

#track(tracking_number, options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/package_tracker/carriers/fedex.rb', line 13

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