Sha256: 25d12a294dcd5c82a66cc19bedd648be524afd50b763757fa3bd51d28332d117
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
module Trackerific module Services class Base class << self attr_accessor :name # Registers the service with Trackerific # @api semipublic def register(name) self.name = name.to_sym Trackerific::Services[self.name] = self end def track(id) options = Trackerific.configuration[self.name] || {} new(options).track(id) end # Checks if the given package ID can be tracked by this service # @param [String] id The package ID # @return [Boolean] true when this service can track the given ID def can_track?(id) package_id_matchers.each {|m| return true if id =~ m } false end # An Array of Regexp that matches valid package ids for the service # @api semipublic def package_id_matchers raise NotImplementedError, "You must implement this method in your service", caller end end end # Gets the tracking information for the package from the server # @param [String] id The package identifier # @return [Trackerific::Details] The tracking details # @api semipublic def track(id) raise NotImplementedError, "You must implement this method in your service", caller end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trackerific-0.7.1 | lib/trackerific/services/base.rb |
trackerific-0.7.0 | lib/trackerific/services/base.rb |