Class: Trackerific::Base
- Inherits:
-
Object
- Object
- Trackerific::Base
- Defined in:
- lib/trackerific/base.rb
Overview
Base class for Trackerific package tracking services.
Class Method Summary (collapse)
-
+ (Array, Regexp) package_id_matchers
An Array of Regexp that matches valid package identifiers for your service.
-
+ (Array) required_options
An array of options that are required to create a new instance of this class.
Instance Method Summary (collapse)
-
- (Base) initialize(options = {})
constructor
Private
Creates a new instance of Trackerific::Base with required options.
-
- (Trackerific::Details) track_package(package_id)
Gets the tracking information for the package from the server.
Constructor Details
- (Base) initialize(options = {})
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new instance of Trackerific::Base with required options
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/trackerific/base.rb', line 6 def initialize( = {}) required = self.class. # make sure all the required options exist required.each do |k| raise ArgumentError.new("Missing required parameter: #{k}") unless .has_key?(k) end # make sure no invalid options exist .each do |k, v| raise ArgumentError.new("Invalid parameter: #{k}") unless required.include?(k) end @options = end |
Class Method Details
+ (Array, Regexp) package_id_matchers
An Array of Regexp that matches valid package identifiers for your service
50 51 52 |
# File 'lib/trackerific/base.rb', line 50 def self.package_id_matchers nil end |
+ (Array) required_options
An array of options that are required to create a new instance of this class
65 66 67 |
# File 'lib/trackerific/base.rb', line 65 def self. [] end |
Instance Method Details
- (Trackerific::Details) track_package(package_id)
Gets the tracking information for the package from the server
35 36 37 |
# File 'lib/trackerific/base.rb', line 35 def track_package(package_id) @package_id = package_id end |