trackerific 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README.rdoc +62 -44
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/changelog +9 -0
  5. data/lib/trackerific/configuration.rb +2 -2
  6. data/lib/trackerific/details.rb +36 -10
  7. data/lib/trackerific/event.rb +9 -7
  8. data/lib/trackerific/service.rb +22 -6
  9. data/lib/trackerific/services/fedex.rb +11 -7
  10. data/lib/trackerific/services/mock_service.rb +23 -14
  11. data/lib/trackerific/services/ups.rb +12 -8
  12. data/lib/trackerific/services/usps.rb +114 -21
  13. data/spec/fixtures/usps_city_state_lookup_response.xml +8 -0
  14. data/spec/lib/helpers/options_helper_spec.rb +3 -3
  15. data/spec/lib/trackerific/configuration_spec.rb +35 -0
  16. data/spec/lib/trackerific/details_spec.rb +71 -11
  17. data/spec/lib/trackerific/event_spec.rb +34 -19
  18. data/spec/lib/trackerific/service_spec.rb +3 -3
  19. data/spec/lib/trackerific/services/fedex_spec.rb +16 -3
  20. data/spec/lib/trackerific/services/mock_service_spec.rb +19 -4
  21. data/spec/lib/trackerific/services/ups_spec.rb +17 -2
  22. data/spec/lib/trackerific/services/usps_spec.rb +60 -11
  23. data/spec/lib/trackerific_spec.rb +7 -5
  24. data/trackerific.gemspec +5 -27
  25. metadata +8 -30
  26. data/doc/OptionsHelper.html +0 -287
  27. data/doc/Trackerific/Configuration.html +0 -354
  28. data/doc/Trackerific/Details.html +0 -565
  29. data/doc/Trackerific/Error.html +0 -127
  30. data/doc/Trackerific/Event.html +0 -639
  31. data/doc/Trackerific/FedEx.html +0 -558
  32. data/doc/Trackerific/Service.html +0 -579
  33. data/doc/Trackerific/UPS.html +0 -532
  34. data/doc/Trackerific/USPS.html +0 -568
  35. data/doc/Trackerific.html +0 -833
  36. data/doc/_index.html +0 -226
  37. data/doc/class_list.html +0 -47
  38. data/doc/css/common.css +0 -1
  39. data/doc/css/full_list.css +0 -53
  40. data/doc/css/style.css +0 -320
  41. data/doc/file.README.html +0 -288
  42. data/doc/file_list.html +0 -49
  43. data/doc/frames.html +0 -13
  44. data/doc/index.html +0 -288
  45. data/doc/js/app.js +0 -205
  46. data/doc/js/full_list.js +0 -150
  47. data/doc/js/jquery.js +0 -16
  48. data/doc/method_list.html +0 -294
  49. data/doc/top-level-namespace.html +0 -103
@@ -1,287 +0,0 @@
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
- &mdash; 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> &raquo;
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
- &mdash;
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
- &mdash;
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
- &mdash;
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'>&quot;</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'>&quot;</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'>&quot;</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'>&quot;</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>
@@ -1,354 +0,0 @@
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
- Class: Trackerific::Configuration
8
-
9
- &mdash; 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 (C)</a> &raquo;
37
- <span class='title'><span class='object_link'><a href="../Trackerific.html" title="Trackerific (module)">Trackerific</a></span></span>
38
- &raquo;
39
- <span class="title">Configuration</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>Class: Trackerific::Configuration
60
-
61
-
62
-
63
- </h1>
64
-
65
- <dl class="box">
66
-
67
- <dt class="r1">Inherits:</dt>
68
- <dd class="r1">
69
- <span class="inheritName">Object</span>
70
-
71
- <ul class="fullTree">
72
- <li>Object</li>
73
-
74
- <li class="next">Trackerific::Configuration</li>
75
-
76
- </ul>
77
- <a href="#" class="inheritanceTree">show all</a>
78
-
79
- </dd>
80
-
81
-
82
-
83
-
84
-
85
-
86
- <dt class="r2">Includes:</dt>
87
- <dd class="r2"><span class='object_link'><a href="../OptionsHelper.html" title="OptionsHelper (module)">OptionsHelper</a></span></dd>
88
-
89
-
90
-
91
-
92
-
93
- <dt class="r1 last">Defined in:</dt>
94
- <dd class="r1 last">lib/trackerific/configuration.rb</dd>
95
-
96
- </dl>
97
- <div class="clear"></div>
98
-
99
- <h2>Overview</h2><div class="docstring">
100
- <div class="discussion">
101
- <p>
102
- Provides a dynamic configuration
103
- </p>
104
-
105
-
106
- </div>
107
- </div>
108
- <div class="tags">
109
-
110
- </div>
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <h2>
124
- Instance Method Summary
125
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
126
- </h2>
127
-
128
- <ul class="summary">
129
-
130
- <li class="public ">
131
- <span class="summary_signature">
132
-
133
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Configuration) <strong>initialize</strong> </a>
134
-
135
-
136
-
137
- </span>
138
-
139
- <span class="note title constructor">constructor</span>
140
-
141
-
142
-
143
-
144
-
145
- <span class="private note title">Private</span>
146
-
147
-
148
- <span class="summary_desc"><div class='inline'><p>
149
- Creates a new instance of Trackerific::Configuration.
150
- </p>
151
- </div></span>
152
-
153
- </li>
154
-
155
-
156
- <li class="public ">
157
- <span class="summary_signature">
158
-
159
- <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Hash) <strong>method_missing</strong>(sym, *args, &amp;block) </a>
160
-
161
-
162
-
163
- </span>
164
-
165
-
166
-
167
-
168
-
169
- <span class="private note title">Private</span>
170
-
171
-
172
- <span class="summary_desc"><div class='inline'><p>
173
- Overriding the method_missing method allows dynamic methods.
174
- </p>
175
- </div></span>
176
-
177
- </li>
178
-
179
-
180
- </ul>
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
- <h3 class="inherited">Methods included from <span class='object_link'><a href="../OptionsHelper.html" title="OptionsHelper (module)">OptionsHelper</a></span></h3>
192
- <p class="inherited"><span class='object_link'><a href="../OptionsHelper.html#validate_options-instance_method" title="OptionsHelper#validate_options (method)">#validate_options</a></span></p>
193
- <div id="constructor_details" class="method_details_list">
194
- <h2>Constructor Details</h2>
195
-
196
- <div class="method_details first">
197
- <p class="signature first" id="initialize-instance_method">
198
-
199
- - (<tt><span class='object_link'><a href="" title="Trackerific::Configuration (class)">Configuration</a></span></tt>) <strong>initialize</strong>
200
-
201
-
202
-
203
- </p><div class="docstring">
204
- <div class="discussion">
205
- <p class="note private">
206
- <strong>This method is part of a private API.</strong>
207
- You should avoid using this method if possible, as it may be removed or be changed in the future.
208
- </p>
209
- <p>
210
- Creates a new instance of Trackerific::Configuration
211
- </p>
212
-
213
-
214
- </div>
215
- </div>
216
- <div class="tags">
217
-
218
- </div><table class="source_code">
219
- <tr>
220
- <td>
221
- <pre class="lines">
222
-
223
-
224
- 7
225
- 8
226
- 9</pre>
227
- </td>
228
- <td>
229
- <pre class="code"><span class="info file"># File 'lib/trackerific/configuration.rb', line 7</span>
230
-
231
- <span class='kw'>def</span> <span class='id initialize'>initialize</span>
232
- <span class='ivar'>@options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
233
- <span class='kw'>end</span></pre>
234
- </td>
235
- </tr>
236
- </table>
237
- </div>
238
-
239
- </div>
240
- <div id="method_missing_details" class="method_details_list">
241
- <h2>Dynamic Method Handling</h2>
242
- <p class="notice this">
243
- This class handles dynamic methods through the <tt>method_missing</tt> method
244
-
245
- </p>
246
-
247
- <div class="method_details first">
248
- <p class="signature first" id="method_missing-instance_method">
249
-
250
- - (<tt>Hash</tt>) <strong>method_missing</strong>(sym, *args, &amp;block)
251
-
252
-
253
-
254
- </p><div class="docstring">
255
- <div class="discussion">
256
- <p class="note private">
257
- <strong>This method is part of a private API.</strong>
258
- You should avoid using this method if possible, as it may be removed or be changed in the future.
259
- </p>
260
- <p>
261
- Overriding the method_missing method allows dynamic methods
262
- </p>
263
-
264
-
265
- </div>
266
- </div>
267
- <div class="tags">
268
- <h3>Returns:</h3>
269
- <ul class="return">
270
-
271
- <li>
272
-
273
-
274
- <span class='type'>(<tt>Hash</tt>)</span>
275
-
276
-
277
-
278
- </li>
279
-
280
- </ul>
281
- <h3>Raises:</h3>
282
- <ul class="raise">
283
-
284
- <li>
285
-
286
-
287
- <span class='type'>(<tt>NoMethodError</tt>)</span>
288
-
289
-
290
-
291
- </li>
292
-
293
- </ul>
294
-
295
- </div><table class="source_code">
296
- <tr>
297
- <td>
298
- <pre class="lines">
299
-
300
-
301
- 13
302
- 14
303
- 15
304
- 16
305
- 17
306
- 18
307
- 19
308
- 20
309
- 21
310
- 22
311
- 23
312
- 24
313
- 25
314
- 26
315
- 27
316
- 28</pre>
317
- </td>
318
- <td>
319
- <pre class="code"><span class="info file"># File 'lib/trackerific/configuration.rb', line 13</span>
320
-
321
- <span class='kw'>def</span> <span class='id method_missing'>method_missing</span><span class='lparen'>(</span><span class='id sym'>sym</span><span class='comma'>,</span> <span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id block'>block</span><span class='rparen'>)</span>
322
- <span class='comment'># Get a list of all the services (convert symbols to lower case)
323
- </span> <span class='id services'>services</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id services'>services</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id service'>service</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> <span class='rbrace'>}</span>
324
- <span class='comment'># Do not accept any configuration values for anything except services
325
- </span> <span class='id raise'>raise</span> <span class='const'>NoMethodError</span> <span class='kw'>unless</span> <span class='id services'>services</span><span class='period'>.</span><span class='id include?'>include?</span> <span class='id sym'>sym</span>
326
- <span class='comment'># Only accept Hashes
327
- </span> <span class='kw'>unless</span> <span class='id args'>args</span><span class='period'>.</span><span class='id empty?'>empty?</span>
328
- <span class='id raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>unless</span> <span class='id args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id class'>class</span> <span class='op'>==</span> <span class='const'>Hash</span>
329
- <span class='comment'># Validate configuration values against the required options for that service
330
- </span> <span class='id validate_options'>validate_options</span> <span class='id args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id service_get'>service_get</span><span class='lparen'>(</span><span class='id sym'>sym</span><span class='rparen'>)</span><span class='period'>.</span><span class='id required_options'>required_options</span>
331
- <span class='comment'># Store the configuration options
332
- </span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='id sym'>sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
333
- <span class='kw'>end</span>
334
- <span class='comment'># return the configuration options
335
- </span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='id sym'>sym</span><span class='rbracket'>]</span>
336
- <span class='kw'>end</span></pre>
337
- </td>
338
- </tr>
339
- </table>
340
- </div>
341
-
342
- </div>
343
-
344
-
345
- </div>
346
-
347
- <div id="footer">
348
- Generated on Wed Jun 15 15:30:27 2011 by
349
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
350
- 0.7.1 (ruby-1.9.2).
351
- </div>
352
-
353
- </body>
354
- </html>