trackerific 0.3.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/README.rdoc +37 -13
- data/VERSION +1 -1
- data/doc/OptionsHelper.html +287 -0
- data/doc/Trackerific.html +588 -35
- data/doc/Trackerific/Configuration.html +354 -0
- data/doc/Trackerific/Details.html +1 -1
- data/doc/Trackerific/Error.html +1 -1
- data/doc/Trackerific/Event.html +1 -1
- data/doc/Trackerific/FedEx.html +52 -35
- data/doc/Trackerific/{Base.html → Service.html} +54 -49
- data/doc/Trackerific/UPS.html +48 -31
- data/doc/Trackerific/USPS.html +51 -34
- data/doc/_index.html +35 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +42 -15
- data/doc/index.html +42 -15
- data/doc/method_list.html +83 -19
- data/doc/top-level-namespace.html +2 -2
- data/lib/helpers/options_helper.rb +20 -0
- data/lib/trackerific.rb +52 -18
- data/lib/trackerific/configuration.rb +49 -0
- data/lib/trackerific/service.rb +68 -0
- data/lib/trackerific/services/fedex.rb +18 -16
- data/lib/trackerific/services/ups.rb +16 -14
- data/lib/trackerific/services/usps.rb +17 -15
- data/spec/lib/trackerific/configuration_spec.rb +9 -0
- data/spec/lib/trackerific/details_spec.rb +12 -9
- data/spec/lib/trackerific/error_spec.rb +6 -2
- data/spec/lib/trackerific/event_spec.rb +21 -8
- data/spec/lib/trackerific/service_spec.rb +34 -0
- data/spec/lib/trackerific/services/fedex_spec.rb +23 -9
- data/spec/lib/trackerific/services/ups_spec.rb +23 -8
- data/spec/lib/trackerific/services/usps_spec.rb +22 -8
- data/spec/lib/trackerific_spec.rb +29 -7
- data/spec/spec_helper.rb +1 -0
- data/spec/support/fixtures.rb +16 -10
- data/spec/support/trackerific.rb +2 -2
- data/trackerific.gemspec +13 -8
- metadata +30 -25
- data/lib/trackerific/base.rb +0 -70
- data/spec/lib/trackerific/base_spec.rb +0 -34
data/Gemfile
CHANGED
@@ -8,13 +8,13 @@ gem "builder", ">= 2.1.2"
|
|
8
8
|
group :development do
|
9
9
|
gem "bundler", ">= 1.0.13"
|
10
10
|
gem "jeweler", ">= 1.5.2"
|
11
|
+
gem 'yardstick', ">= 0.4.0"
|
11
12
|
end
|
12
13
|
|
13
14
|
group :development, :test do
|
14
15
|
gem "rspec-rails", ">= 2.6.1"
|
15
16
|
gem "rspec_multi_matchers", ">= 1.1.0"
|
16
17
|
gem "ruby-debug19", ">= 0.11.6", :require => "ruby-debug"
|
17
|
-
gem 'yardstick', ">= 0.4.0"
|
18
18
|
end
|
19
19
|
|
20
20
|
group :test do
|
data/README.rdoc
CHANGED
@@ -5,7 +5,43 @@ To use this gem, add this line to your Gemfile
|
|
5
5
|
and then run
|
6
6
|
bundle install
|
7
7
|
|
8
|
-
== Usage
|
8
|
+
== Usage
|
9
|
+
|
10
|
+
=== Configuration
|
11
|
+
|
12
|
+
To take advantage of Trackerific's automatic service discovery, you will need to
|
13
|
+
configure your credentials for each service.
|
14
|
+
|
15
|
+
# config/initializers/trackerific.rb
|
16
|
+
require 'trackerific'
|
17
|
+
Trackerific.configure do |config|
|
18
|
+
config.fedex :account => 'account', :meter => '123456789'
|
19
|
+
config.ups :key => 'key', :user_id => 'userid', :password => 'secret'
|
20
|
+
config.usps :user_id => 'userid'
|
21
|
+
end
|
22
|
+
|
23
|
+
=== Tracking with Automatic Service Discovery
|
24
|
+
|
25
|
+
Once you configured the services, tracking a package is as easy as
|
26
|
+
|
27
|
+
include Trackerific
|
28
|
+
details = track_package "package id"
|
29
|
+
|
30
|
+
=== Finding a Tracking Service Provider
|
31
|
+
|
32
|
+
If you do not know the tracking service provider of a package id, or you used
|
33
|
+
track_package, and you need to know which service was used to track it, you can
|
34
|
+
use the tracking_service helper method.
|
35
|
+
|
36
|
+
include Trackerific
|
37
|
+
tracking_service "183689015000001" # => Trackerific::FedEx
|
38
|
+
tracking_service "1Z12345E0291980793" # => Trackerific::UPS
|
39
|
+
tracking_service "EJ958083578US" # => Trackerific::USPS
|
40
|
+
tracking_service "unknown package id" # => nil
|
41
|
+
|
42
|
+
=== Tracking a Package with a Specific Service
|
43
|
+
|
44
|
+
Use this method if you need to specify exactly which service to track a package.
|
9
45
|
|
10
46
|
# Track a FedEx package:
|
11
47
|
fedex = Trackerific::FedEx.new :account => '123456789', :meter => '123456789'
|
@@ -46,18 +82,6 @@ Note that events.last will return the first event the tracking provider
|
|
46
82
|
supplied. This is because the events are listed in LIFO order, so the most
|
47
83
|
recent events will always be at the top of the list.
|
48
84
|
|
49
|
-
=== Finding a Tracking Service Provider
|
50
|
-
|
51
|
-
If you do not know the tracking service provider of a package id, you can use
|
52
|
-
the tracking_service helper method to get a Trackerific class that most likely
|
53
|
-
will be able to track the given package id.
|
54
|
-
|
55
|
-
include Trackerific
|
56
|
-
tracking_service "183689015000001" # => Trackerific::FedEx
|
57
|
-
tracking_service "1Z12345E0291980793" # => Trackerific::UPS
|
58
|
-
tracking_service "EJ958083578US" # => Trackerific::USPS
|
59
|
-
tracking_service "unknown package id" # => nil
|
60
|
-
|
61
85
|
=== Exception handling
|
62
86
|
|
63
87
|
Exception handling is esssential for tracking packages. If, for example,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -0,0 +1,287 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: OptionsHelper
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index (O)</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">OptionsHelper</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: OptionsHelper
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<dt class="r1">Included in:</dt>
|
74
|
+
<dd class="r1"><span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Trackerific::Configuration</a></span>, <span class='object_link'><a href="Trackerific/Service.html" title="Trackerific::Service (class)">Trackerific::Service</a></span></dd>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/helpers/options_helper.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Overview</h2><div class="docstring">
|
85
|
+
<div class="discussion">
|
86
|
+
<p>
|
87
|
+
Helper for validating required options
|
88
|
+
</p>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<div class="tags">
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<h2>
|
102
|
+
Instance Method Summary
|
103
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
104
|
+
</h2>
|
105
|
+
|
106
|
+
<ul class="summary">
|
107
|
+
|
108
|
+
<li class="public ">
|
109
|
+
<span class="summary_signature">
|
110
|
+
|
111
|
+
<a href="#validate_options-instance_method" title="#validate_options (instance method)">- (Object) <strong>validate_options</strong>(options, required) </a>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
</span>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<span class="private note title">Private</span>
|
122
|
+
|
123
|
+
|
124
|
+
<span class="summary_desc"><div class='inline'><p>
|
125
|
+
Validates a list of options against a list of required options.
|
126
|
+
</p>
|
127
|
+
</div></span>
|
128
|
+
|
129
|
+
</li>
|
130
|
+
|
131
|
+
|
132
|
+
</ul>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<div id="instance_method_details" class="method_details_list">
|
138
|
+
<h2>Instance Method Details</h2>
|
139
|
+
|
140
|
+
|
141
|
+
<div class="method_details first">
|
142
|
+
<p class="signature first" id="validate_options-instance_method">
|
143
|
+
|
144
|
+
- (<tt>Object</tt>) <strong>validate_options</strong>(options, required)
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</p><div class="docstring">
|
149
|
+
<div class="discussion">
|
150
|
+
<p class="note private">
|
151
|
+
<strong>This method is part of a private API.</strong>
|
152
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
153
|
+
</p>
|
154
|
+
<p>
|
155
|
+
Validates a list of options against a list of required options
|
156
|
+
</p>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
<div class="tags">
|
162
|
+
<h3>Parameters:</h3>
|
163
|
+
<ul class="param">
|
164
|
+
|
165
|
+
<li>
|
166
|
+
|
167
|
+
<span class='name'>options</span>
|
168
|
+
|
169
|
+
|
170
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
—
|
175
|
+
<div class='inline'><p>
|
176
|
+
list of options to validate
|
177
|
+
</p>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
<li>
|
183
|
+
|
184
|
+
<span class='name'>required</span>
|
185
|
+
|
186
|
+
|
187
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
—
|
192
|
+
<div class='inline'><p>
|
193
|
+
list of required options
|
194
|
+
</p>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
</li>
|
198
|
+
|
199
|
+
</ul>
|
200
|
+
<h3>Returns:</h3>
|
201
|
+
<ul class="return">
|
202
|
+
|
203
|
+
<li>
|
204
|
+
|
205
|
+
|
206
|
+
<span class='type'></span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<div class='inline'><p>
|
212
|
+
true
|
213
|
+
</p>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</li>
|
217
|
+
|
218
|
+
</ul>
|
219
|
+
<h3>Raises:</h3>
|
220
|
+
<ul class="raise">
|
221
|
+
|
222
|
+
<li>
|
223
|
+
|
224
|
+
|
225
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
—
|
230
|
+
<div class='inline'><p>
|
231
|
+
if the options do not pass validation
|
232
|
+
</p>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
</ul>
|
238
|
+
|
239
|
+
</div><table class="source_code">
|
240
|
+
<tr>
|
241
|
+
<td>
|
242
|
+
<pre class="lines">
|
243
|
+
|
244
|
+
|
245
|
+
9
|
246
|
+
10
|
247
|
+
11
|
248
|
+
12
|
249
|
+
13
|
250
|
+
14
|
251
|
+
15
|
252
|
+
16
|
253
|
+
17
|
254
|
+
18
|
255
|
+
19</pre>
|
256
|
+
</td>
|
257
|
+
<td>
|
258
|
+
<pre class="code"><span class="info file"># File 'lib/helpers/options_helper.rb', line 9</span>
|
259
|
+
|
260
|
+
<span class='kw'>def</span> <span class='id validate_options'>validate_options</span><span class='lparen'>(</span><span class='id options'>options</span><span class='comma'>,</span> <span class='id required'>required</span><span class='rparen'>)</span>
|
261
|
+
<span class='comment'># make sure all the required options exist
|
262
|
+
</span> <span class='id required'>required</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id k'>k</span><span class='op'>|</span>
|
263
|
+
<span class='id raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Missing required parameter: </span><span class='embexpr_beg'>#{</span><span class='id k'>k</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id options'>options</span><span class='period'>.</span><span class='id has_key?'>has_key?</span><span class='lparen'>(</span><span class='id k'>k</span><span class='rparen'>)</span>
|
264
|
+
<span class='kw'>end</span>
|
265
|
+
<span class='comment'># make sure no invalid options exist
|
266
|
+
</span> <span class='id options'>options</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id k'>k</span><span class='comma'>,</span> <span class='id v'>v</span><span class='op'>|</span>
|
267
|
+
<span class='id raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid parameter: </span><span class='embexpr_beg'>#{</span><span class='id k'>k</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id required'>required</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id k'>k</span><span class='rparen'>)</span>
|
268
|
+
<span class='kw'>end</span>
|
269
|
+
<span class='kw'>true</span>
|
270
|
+
<span class='kw'>end</span></pre>
|
271
|
+
</td>
|
272
|
+
</tr>
|
273
|
+
</table>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
<div id="footer">
|
281
|
+
Generated on Wed Jun 15 15:30:27 2011 by
|
282
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
283
|
+
0.7.1 (ruby-1.9.2).
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</body>
|
287
|
+
</html>
|
data/doc/Trackerific.html
CHANGED
@@ -73,7 +73,7 @@
|
|
73
73
|
|
74
74
|
<dt class="r1 last">Defined in:</dt>
|
75
75
|
<dd class="r1 last">lib/trackerific.rb<span class="defines">,<br />
|
76
|
-
lib/trackerific/
|
76
|
+
lib/trackerific/event.rb,<br /> lib/trackerific/error.rb,<br /> lib/trackerific/details.rb,<br /> lib/trackerific/service.rb,<br /> lib/trackerific/services/ups.rb,<br /> lib/trackerific/configuration.rb,<br /> lib/trackerific/services/usps.rb,<br /> lib/trackerific/services/fedex.rb</span>
|
77
77
|
</dd>
|
78
78
|
|
79
79
|
</dl>
|
@@ -96,7 +96,7 @@ Trackerific provides package tracking to Rails apps.
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Trackerific/
|
99
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Trackerific/Details.html" title="Trackerific::Details (class)">Details</a></span>, <span class='object_link'><a href="Trackerific/Error.html" title="Trackerific::Error (class)">Error</a></span>, <span class='object_link'><a href="Trackerific/Event.html" title="Trackerific::Event (class)">Event</a></span>, <span class='object_link'><a href="Trackerific/FedEx.html" title="Trackerific::FedEx (class)">FedEx</a></span>, <span class='object_link'><a href="Trackerific/Service.html" title="Trackerific::Service (class)">Service</a></span>, <span class='object_link'><a href="Trackerific/UPS.html" title="Trackerific::UPS (class)">UPS</a></span>, <span class='object_link'><a href="Trackerific/USPS.html" title="Trackerific::USPS (class)">USPS</a></span>
|
100
100
|
|
101
101
|
|
102
102
|
</p>
|
@@ -106,6 +106,111 @@ Trackerific provides package tracking to Rails apps.
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
+
<h2>
|
110
|
+
Class Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#configuration-class_method" title="configuration (class method)">+ (Trackerific::Configuration) <strong>configuration</strong> </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="private note title">Private</span>
|
130
|
+
|
131
|
+
|
132
|
+
<span class="summary_desc"><div class='inline'><p>
|
133
|
+
Stores the configuration options for Trackerific.
|
134
|
+
</p>
|
135
|
+
</div></span>
|
136
|
+
|
137
|
+
</li>
|
138
|
+
|
139
|
+
|
140
|
+
<li class="public ">
|
141
|
+
<span class="summary_signature">
|
142
|
+
|
143
|
+
<a href="#configure-class_method" title="configure (class method)">+ (Trackerific::Configuration) <strong>configure</strong> {|configuration| ... }</a>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
</span>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>
|
157
|
+
Configures Trackerific.
|
158
|
+
</p>
|
159
|
+
</div></span>
|
160
|
+
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
<li class="public ">
|
165
|
+
<span class="summary_signature">
|
166
|
+
|
167
|
+
<a href="#service_get-class_method" title="service_get (class method)">+ (Trackerific::Service) <strong>service_get</strong>(name) </a>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</span>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="private note title">Private</span>
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'><p>
|
181
|
+
Gets a Trackerific::Service class.
|
182
|
+
</p>
|
183
|
+
</div></span>
|
184
|
+
|
185
|
+
</li>
|
186
|
+
|
187
|
+
|
188
|
+
<li class="public ">
|
189
|
+
<span class="summary_signature">
|
190
|
+
|
191
|
+
<a href="#services-class_method" title="services (class method)">+ (Array, Symbol) <strong>services</strong> </a>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
<span class="private note title">Private</span>
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'><p>
|
205
|
+
Gets a list of all Trackerific services.
|
206
|
+
</p>
|
207
|
+
</div></span>
|
208
|
+
|
209
|
+
</li>
|
210
|
+
|
211
|
+
|
212
|
+
</ul>
|
213
|
+
|
109
214
|
<h2>
|
110
215
|
Instance Method Summary
|
111
216
|
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
@@ -116,6 +221,30 @@ Trackerific provides package tracking to Rails apps.
|
|
116
221
|
<li class="public ">
|
117
222
|
<span class="summary_signature">
|
118
223
|
|
224
|
+
<a href="#track_package-instance_method" title="#track_package (instance method)">- (Trackerific::Details) <strong>track_package</strong>(package_id) </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<span class="summary_desc"><div class='inline'><p>
|
238
|
+
Tracks a package by determining its service from the package id.
|
239
|
+
</p>
|
240
|
+
</div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li class="public ">
|
246
|
+
<span class="summary_signature">
|
247
|
+
|
119
248
|
<a href="#tracking_service-instance_method" title="#tracking_service (instance method)">- (Trackerific::Base) <strong>tracking_service</strong>(package_id) </a>
|
120
249
|
|
121
250
|
|
@@ -142,14 +271,444 @@ Checks a string for a valid package tracking service.
|
|
142
271
|
|
143
272
|
|
144
273
|
|
274
|
+
<div id="class_method_details" class="method_details_list">
|
275
|
+
<h2>Class Method Details</h2>
|
276
|
+
|
277
|
+
|
278
|
+
<div class="method_details first">
|
279
|
+
<p class="signature first" id="configuration-class_method">
|
280
|
+
|
281
|
+
+ (<tt><span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Trackerific::Configuration</a></span></tt>) <strong>configuration</strong>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
</p><div class="docstring">
|
286
|
+
<div class="discussion">
|
287
|
+
<p class="note private">
|
288
|
+
<strong>This method is part of a private API.</strong>
|
289
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
290
|
+
</p>
|
291
|
+
<p>
|
292
|
+
Stores the configuration options for Trackerific
|
293
|
+
</p>
|
294
|
+
|
295
|
+
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
<div class="tags">
|
299
|
+
<h3>Returns:</h3>
|
300
|
+
<ul class="return">
|
301
|
+
|
302
|
+
<li>
|
303
|
+
|
304
|
+
|
305
|
+
<span class='type'>(<tt><span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Trackerific::Configuration</a></span></tt>)</span>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
</ul>
|
312
|
+
|
313
|
+
</div><table class="source_code">
|
314
|
+
<tr>
|
315
|
+
<td>
|
316
|
+
<pre class="lines">
|
317
|
+
|
318
|
+
|
319
|
+
34
|
320
|
+
35
|
321
|
+
36</pre>
|
322
|
+
</td>
|
323
|
+
<td>
|
324
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific/configuration.rb', line 34</span>
|
325
|
+
|
326
|
+
<span class='kw'>def</span> <span class='id configuration'>configuration</span>
|
327
|
+
<span class='ivar'>@configuration</span> <span class='op'>||=</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id new'>new</span>
|
328
|
+
<span class='kw'>end</span></pre>
|
329
|
+
</td>
|
330
|
+
</tr>
|
331
|
+
</table>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div class="method_details ">
|
335
|
+
<p class="signature " id="configure-class_method">
|
336
|
+
|
337
|
+
+ (<tt><span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Trackerific::Configuration</a></span></tt>) <strong>configure</strong> {|configuration| ... }
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</p><div class="docstring">
|
342
|
+
<div class="discussion">
|
343
|
+
<p>
|
344
|
+
Configures Trackerific
|
345
|
+
</p>
|
346
|
+
|
347
|
+
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
<div class="tags">
|
351
|
+
|
352
|
+
<div class="examples">
|
353
|
+
<h3>Examples:</h3>
|
354
|
+
|
355
|
+
<h4><div class='inline'><p>
|
356
|
+
Defining credentials
|
357
|
+
</p>
|
358
|
+
</div></h4>
|
359
|
+
<pre class="example code"><span class='const'>Trackerific</span><span class='period'>.</span><span class='id configure'>configure</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id config'>config</span><span class='op'>|</span>
|
360
|
+
<span class='id config'>config</span><span class='period'>.</span><span class='id fedex'>fedex</span> <span class='symbol'>:meter</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:account</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span>
|
361
|
+
<span class='kw'>end</span></pre>
|
362
|
+
|
363
|
+
</div>
|
364
|
+
<h3>Yields:</h3>
|
365
|
+
<ul class="yield">
|
366
|
+
|
367
|
+
<li>
|
368
|
+
|
369
|
+
|
370
|
+
<span class='type'>(<tt><span class='object_link'><a href="#configuration-class_method" title="Trackerific.configuration (method)">configuration</a></span></tt>)</span>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
</li>
|
375
|
+
|
376
|
+
</ul>
|
377
|
+
<h3>Returns:</h3>
|
378
|
+
<ul class="return">
|
379
|
+
|
380
|
+
<li>
|
381
|
+
|
382
|
+
|
383
|
+
<span class='type'>(<tt><span class='object_link'><a href="Trackerific/Configuration.html" title="Trackerific::Configuration (class)">Trackerific::Configuration</a></span></tt>)</span>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
</li>
|
388
|
+
|
389
|
+
</ul>
|
390
|
+
|
391
|
+
</div><table class="source_code">
|
392
|
+
<tr>
|
393
|
+
<td>
|
394
|
+
<pre class="lines">
|
395
|
+
|
396
|
+
|
397
|
+
44
|
398
|
+
45
|
399
|
+
46
|
400
|
+
47</pre>
|
401
|
+
</td>
|
402
|
+
<td>
|
403
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific/configuration.rb', line 44</span>
|
404
|
+
|
405
|
+
<span class='kw'>def</span> <span class='id configure'>configure</span>
|
406
|
+
<span class='kw'>yield</span> <span class='id configuration'>configuration</span>
|
407
|
+
<span class='id configuration'>configuration</span>
|
408
|
+
<span class='kw'>end</span></pre>
|
409
|
+
</td>
|
410
|
+
</tr>
|
411
|
+
</table>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
<div class="method_details ">
|
415
|
+
<p class="signature " id="service_get-class_method">
|
416
|
+
|
417
|
+
+ (<tt><span class='object_link'><a href="Trackerific/Service.html" title="Trackerific::Service (class)">Trackerific::Service</a></span></tt>) <strong>service_get</strong>(name)
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</p><div class="docstring">
|
422
|
+
<div class="discussion">
|
423
|
+
<p class="note private">
|
424
|
+
<strong>This method is part of a private API.</strong>
|
425
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
426
|
+
</p>
|
427
|
+
<p>
|
428
|
+
Gets a Trackerific::Service class
|
429
|
+
</p>
|
430
|
+
|
431
|
+
|
432
|
+
</div>
|
433
|
+
</div>
|
434
|
+
<div class="tags">
|
435
|
+
<h3>Parameters:</h3>
|
436
|
+
<ul class="param">
|
437
|
+
|
438
|
+
<li>
|
439
|
+
|
440
|
+
<span class='name'>name</span>
|
441
|
+
|
442
|
+
|
443
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
—
|
448
|
+
<div class='inline'><p>
|
449
|
+
the name of the service
|
450
|
+
</p>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
</li>
|
454
|
+
|
455
|
+
</ul>
|
456
|
+
<h3>Returns:</h3>
|
457
|
+
<ul class="return">
|
458
|
+
|
459
|
+
<li>
|
460
|
+
|
461
|
+
|
462
|
+
<span class='type'>(<tt><span class='object_link'><a href="Trackerific/Service.html" title="Trackerific::Service (class)">Trackerific::Service</a></span></tt>)</span>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
—
|
467
|
+
<div class='inline'><p>
|
468
|
+
the service, or nil
|
469
|
+
</p>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
</li>
|
473
|
+
|
474
|
+
</ul>
|
475
|
+
|
476
|
+
</div><table class="source_code">
|
477
|
+
<tr>
|
478
|
+
<td>
|
479
|
+
<pre class="lines">
|
480
|
+
|
481
|
+
|
482
|
+
31
|
483
|
+
32
|
484
|
+
33
|
485
|
+
34
|
486
|
+
35
|
487
|
+
36</pre>
|
488
|
+
</td>
|
489
|
+
<td>
|
490
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 31</span>
|
491
|
+
|
492
|
+
<span class='kw'>def</span> <span class='id service_get'>service_get</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span>
|
493
|
+
<span class='id services'>services</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id service'>service</span><span class='op'>|</span>
|
494
|
+
<span class='kw'>return</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id service'>service</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id name'>name</span> <span class='op'>==</span> <span class='id service'>service</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id downcase'>downcase</span><span class='period'>.</span><span class='id to_sym'>to_sym</span>
|
495
|
+
<span class='kw'>end</span>
|
496
|
+
<span class='kw'>return</span> <span class='kw'>nil</span>
|
497
|
+
<span class='kw'>end</span></pre>
|
498
|
+
</td>
|
499
|
+
</tr>
|
500
|
+
</table>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
<div class="method_details ">
|
504
|
+
<p class="signature " id="services-class_method">
|
505
|
+
|
506
|
+
+ (<tt>Array</tt>, <tt>Symbol</tt>) <strong>services</strong>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</p><div class="docstring">
|
511
|
+
<div class="discussion">
|
512
|
+
<p class="note private">
|
513
|
+
<strong>This method is part of a private API.</strong>
|
514
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
515
|
+
</p>
|
516
|
+
<p>
|
517
|
+
Gets a list of all Trackerific services
|
518
|
+
</p>
|
519
|
+
|
520
|
+
|
521
|
+
</div>
|
522
|
+
</div>
|
523
|
+
<div class="tags">
|
524
|
+
<h3>Returns:</h3>
|
525
|
+
<ul class="return">
|
526
|
+
|
527
|
+
<li>
|
528
|
+
|
529
|
+
|
530
|
+
<span class='type'>(<tt>Array</tt>, <tt>Symbol</tt>)</span>
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
—
|
535
|
+
<div class='inline'><p>
|
536
|
+
the services
|
537
|
+
</p>
|
538
|
+
</div>
|
539
|
+
|
540
|
+
</li>
|
541
|
+
|
542
|
+
</ul>
|
543
|
+
|
544
|
+
</div><table class="source_code">
|
545
|
+
<tr>
|
546
|
+
<td>
|
547
|
+
<pre class="lines">
|
548
|
+
|
549
|
+
|
550
|
+
20
|
551
|
+
21
|
552
|
+
22
|
553
|
+
23
|
554
|
+
24
|
555
|
+
25</pre>
|
556
|
+
</td>
|
557
|
+
<td>
|
558
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 20</span>
|
559
|
+
|
560
|
+
<span class='kw'>def</span> <span class='id services'>services</span>
|
561
|
+
<span class='comment'># a service is any Trackerific class that descends from Trackerific::Service
|
562
|
+
</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id constants'>constants</span><span class='period'>.</span><span class='id reject'>reject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id const'>const</span><span class='op'>|</span>
|
563
|
+
<span class='id const'>const</span> <span class='kw'>unless</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id const'>const</span><span class='rparen'>)</span><span class='period'>.</span><span class='id superclass'>superclass</span> <span class='op'>==</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Service</span>
|
564
|
+
<span class='rbrace'>}</span>
|
565
|
+
<span class='kw'>end</span></pre>
|
566
|
+
</td>
|
567
|
+
</tr>
|
568
|
+
</table>
|
569
|
+
</div>
|
570
|
+
|
571
|
+
</div>
|
572
|
+
|
145
573
|
<div id="instance_method_details" class="method_details_list">
|
146
574
|
<h2>Instance Method Details</h2>
|
147
575
|
|
148
576
|
|
149
577
|
<div class="method_details first">
|
150
|
-
<p class="signature first" id="
|
578
|
+
<p class="signature first" id="track_package-instance_method">
|
579
|
+
|
580
|
+
- (<tt><span class='object_link'><a href="Trackerific/Details.html" title="Trackerific::Details (class)">Trackerific::Details</a></span></tt>) <strong>track_package</strong>(package_id)
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
</p><div class="docstring">
|
585
|
+
<div class="discussion">
|
586
|
+
<p>
|
587
|
+
Tracks a package by determining its service from the package id
|
588
|
+
</p>
|
589
|
+
|
590
|
+
|
591
|
+
</div>
|
592
|
+
</div>
|
593
|
+
<div class="tags">
|
594
|
+
|
595
|
+
<div class="examples">
|
596
|
+
<h3>Examples:</h3>
|
597
|
+
|
598
|
+
<h4><div class='inline'><p>
|
599
|
+
Track a package
|
600
|
+
</p>
|
601
|
+
</div></h4>
|
602
|
+
<pre class="example code"><span class='id include'>include</span> <span class='const'>Trackerific</span>
|
603
|
+
<span class='comment'># make sure to configure Trackerific before hand with the different services credentials
|
604
|
+
</span><span class='const'>Trackerific</span><span class='period'>.</span><span class='id config'>config</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id config'>config</span><span class='op'>|</span>
|
605
|
+
<span class='id config'>config</span><span class='period'>.</span><span class='id fedex'>fedex</span> <span class='symbol'>:meter</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:account</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>123456789</span><span class='tstring_end'>'</span></span>
|
606
|
+
<span class='kw'>end</span>
|
607
|
+
<span class='id details'>details</span> <span class='op'>=</span> <span class='id track_package'>track_package</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>183689015000001</span><span class='tstring_end'>"</span></span></pre>
|
608
|
+
|
609
|
+
</div>
|
610
|
+
<h3>Parameters:</h3>
|
611
|
+
<ul class="param">
|
612
|
+
|
613
|
+
<li>
|
614
|
+
|
615
|
+
<span class='name'>package_id</span>
|
616
|
+
|
617
|
+
|
618
|
+
<span class='type'>(<tt>String</tt>)</span>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
—
|
623
|
+
<div class='inline'><p>
|
624
|
+
the package identifier
|
625
|
+
</p>
|
626
|
+
</div>
|
627
|
+
|
628
|
+
</li>
|
629
|
+
|
630
|
+
</ul>
|
631
|
+
<h3>Returns:</h3>
|
632
|
+
<ul class="return">
|
633
|
+
|
634
|
+
<li>
|
635
|
+
|
636
|
+
|
637
|
+
<span class='type'>(<tt><span class='object_link'><a href="Trackerific/Details.html" title="Trackerific::Details (class)">Trackerific::Details</a></span></tt>)</span>
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
—
|
642
|
+
<div class='inline'><p>
|
643
|
+
the tracking results
|
644
|
+
</p>
|
645
|
+
</div>
|
646
|
+
|
647
|
+
</li>
|
151
648
|
|
152
|
-
|
649
|
+
</ul>
|
650
|
+
<h3>Raises:</h3>
|
651
|
+
<ul class="raise">
|
652
|
+
|
653
|
+
<li>
|
654
|
+
|
655
|
+
|
656
|
+
<span class='type'>(<tt><span class='object_link'><a href="Trackerific/Error.html" title="Trackerific::Error (class)">Trackerific::Error</a></span></tt>)</span>
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
—
|
661
|
+
<div class='inline'><p>
|
662
|
+
raised when the server returns an error (invalid credentials, tracking
|
663
|
+
package, etc.)
|
664
|
+
</p>
|
665
|
+
</div>
|
666
|
+
|
667
|
+
</li>
|
668
|
+
|
669
|
+
</ul>
|
670
|
+
|
671
|
+
</div><table class="source_code">
|
672
|
+
<tr>
|
673
|
+
<td>
|
674
|
+
<pre class="lines">
|
675
|
+
|
676
|
+
|
677
|
+
74
|
678
|
+
75
|
679
|
+
76
|
680
|
+
77
|
681
|
+
78
|
682
|
+
79
|
683
|
+
80
|
684
|
+
81
|
685
|
+
82
|
686
|
+
83
|
687
|
+
84</pre>
|
688
|
+
</td>
|
689
|
+
<td>
|
690
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 74</span>
|
691
|
+
|
692
|
+
<span class='kw'>def</span> <span class='id track_package'>track_package</span><span class='lparen'>(</span><span class='id package_id'>package_id</span><span class='rparen'>)</span>
|
693
|
+
<span class='comment'># find the service that will be able to track this package
|
694
|
+
</span> <span class='id service'>service</span> <span class='op'>=</span> <span class='id tracking_service'>tracking_service</span> <span class='id package_id'>package_id</span>
|
695
|
+
<span class='id raise'>raise</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Error</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot find a service to track package id </span><span class='embexpr_beg'>#{</span><span class='id package_id'>package_id</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id service'>service</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
696
|
+
<span class='comment'># get the name of the service
|
697
|
+
</span> <span class='id service_name'>service_name</span> <span class='op'>=</span> <span class='id service'>service</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>::</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id downcase'>downcase</span>
|
698
|
+
<span class='comment'># get the default configuration for the service
|
699
|
+
</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id configuration'>configuration</span><span class='period'>.</span><span class='id send'>send</span> <span class='id service_name'>service_name</span>
|
700
|
+
<span class='comment'># track the package
|
701
|
+
</span> <span class='id service'>service</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id options'>options</span><span class='rparen'>)</span><span class='period'>.</span><span class='id track_package'>track_package</span> <span class='id package_id'>package_id</span>
|
702
|
+
<span class='kw'>end</span></pre>
|
703
|
+
</td>
|
704
|
+
</tr>
|
705
|
+
</table>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
<div class="method_details ">
|
709
|
+
<p class="signature " id="tracking_service-instance_method">
|
710
|
+
|
711
|
+
- (<tt>Trackerific::Base</tt>) <strong>tracking_service</strong>(package_id)
|
153
712
|
|
154
713
|
|
155
714
|
|
@@ -202,7 +761,7 @@ the package identifier
|
|
202
761
|
<li>
|
203
762
|
|
204
763
|
|
205
|
-
<span class='type'>(<tt
|
764
|
+
<span class='type'>(<tt>Trackerific::Base</tt>)</span>
|
206
765
|
|
207
766
|
|
208
767
|
|
@@ -223,39 +782,33 @@ found.
|
|
223
782
|
<pre class="lines">
|
224
783
|
|
225
784
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
35
|
241
|
-
36
|
242
|
-
37</pre>
|
785
|
+
47
|
786
|
+
48
|
787
|
+
49
|
788
|
+
50
|
789
|
+
51
|
790
|
+
52
|
791
|
+
53
|
792
|
+
54
|
793
|
+
55
|
794
|
+
56
|
795
|
+
57
|
796
|
+
58
|
797
|
+
59
|
798
|
+
60</pre>
|
243
799
|
</td>
|
244
800
|
<td>
|
245
|
-
<pre class="code"><span class="info file"># File 'lib/trackerific.rb', line
|
801
|
+
<pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 47</span>
|
246
802
|
|
247
803
|
<span class='kw'>def</span> <span class='id tracking_service'>tracking_service</span><span class='lparen'>(</span><span class='id package_id'>package_id</span><span class='rparen'>)</span>
|
248
|
-
<span class='comment'># loop through
|
249
|
-
</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id
|
250
|
-
<span class='comment'># get the
|
251
|
-
</span> <span class='id cls'>cls</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id
|
252
|
-
<span class='comment'>#
|
253
|
-
</span> <span class='
|
254
|
-
<span class='comment'>#
|
255
|
-
</span> <span class='
|
256
|
-
<span class='comment'># return the class if it matches
|
257
|
-
</span> <span class='kw'>return</span> <span class='id cls'>cls</span> <span class='kw'>if</span> <span class='id package_id'>package_id</span> <span class='op'>=~</span> <span class='id matcher'>matcher</span>
|
258
|
-
<span class='kw'>end</span>
|
804
|
+
<span class='comment'># loop through all the services
|
805
|
+
</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id services'>services</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id service'>service</span><span class='op'>|</span>
|
806
|
+
<span class='comment'># get the class associated with this service
|
807
|
+
</span> <span class='id cls'>cls</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id service'>service</span><span class='rparen'>)</span>
|
808
|
+
<span class='comment'># loop through all the packge id regular expressions
|
809
|
+
</span> <span class='id cls'>cls</span><span class='period'>.</span><span class='id package_id_matchers'>package_id_matchers</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id matcher'>matcher</span><span class='op'>|</span>
|
810
|
+
<span class='comment'># return this class if the regular expression matches
|
811
|
+
</span> <span class='kw'>return</span> <span class='id cls'>cls</span> <span class='kw'>if</span> <span class='id package_id'>package_id</span> <span class='op'>=~</span> <span class='id matcher'>matcher</span>
|
259
812
|
<span class='kw'>end</span>
|
260
813
|
<span class='kw'>end</span>
|
261
814
|
<span class='comment'># if we've made it this far, nothing matched
|
@@ -271,7 +824,7 @@ found.
|
|
271
824
|
</div>
|
272
825
|
|
273
826
|
<div id="footer">
|
274
|
-
Generated on
|
827
|
+
Generated on Wed Jun 15 15:30:26 2011 by
|
275
828
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
276
829
|
0.7.1 (ruby-1.9.2).
|
277
830
|
</div>
|