Sha256: 9e13ec85508563aff646c25695cb2b86d0b8bbc3450a26ebc8e6ce1f7170b766

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

module Trebbianno
  class Tracking

    attr_accessor :carrier

    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"

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

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

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

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trebbianno-ruby-api-0.0.7 lib/trebbianno/tracking.rb
trebbianno-ruby-api-0.0.6 lib/trebbianno/tracking.rb
trebbianno-ruby-api-0.0.5 lib/trebbianno/tracking.rb
trebbianno-ruby-api-0.0.4 lib/trebbianno/tracking.rb
trebbianno-ruby-api-0.0.3 lib/trebbianno/tracking.rb
trebbianno-ruby-api-0.0.2 lib/trebbianno/tracking.rb