Class: Trebbianno::Tracking

Inherits:
Object
  • Object
show all
Defined in:
lib/trebbianno/tracking.rb

Constant Summary collapse

FEDEX =
"http://printtracking.fedex.com/trackOrder.do?gtns=:tracking_number"
USPS =
"https://tools.usps.com/go/TrackConfirmAction.action?tLabels=:tracking_number"
UPS =
"http://wwwapps.ups.com/WebTracking/track?trackNums=:tracking_number&track.x=Track"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(carrier, tracking_number) ⇒ Tracking

Returns a new instance of Tracking.



10
11
12
13
# File 'lib/trebbianno/tracking.rb', line 10

def initialize(carrier, tracking_number)
  @carrier         = carrier
  @tracking_number = tracking_number
end

Instance Attribute Details

#carrierObject

Returns the value of attribute carrier.



4
5
6
# File 'lib/trebbianno/tracking.rb', line 4

def carrier
  @carrier
end

Instance Method Details

#carrier_destinationObject



15
16
17
# File 'lib/trebbianno/tracking.rb', line 15

def carrier_destination
  self.class.const_get(carrier.upcase)
end

#urlObject



19
20
21
# File 'lib/trebbianno/tracking.rb', line 19

def url
  carrier_destination.gsub(':tracking_number', @tracking_number)
end