beway 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +1 -1
  2. data/README +7 -16
  3. data/README.rdoc +8 -20
  4. data/doc/Beway.html +136 -183
  5. data/doc/Beway/Auction.html +630 -816
  6. data/doc/Beway/AuctionParseError.html +139 -158
  7. data/doc/Beway/Bidder.html +384 -529
  8. data/doc/Beway/BidderError.html +139 -158
  9. data/doc/Beway/CliRunner.html +742 -818
  10. data/doc/Beway/EbayData.html +398 -451
  11. data/doc/Beway/EbayDataParseError.html +139 -158
  12. data/doc/Beway/InvalidUrlError.html +139 -158
  13. data/doc/README.html +129 -167
  14. data/doc/created.rid +6 -6
  15. data/doc/images/add.png +0 -0
  16. data/doc/images/brick.png +0 -0
  17. data/doc/images/brick_link.png +0 -0
  18. data/doc/images/bug.png +0 -0
  19. data/doc/images/bullet_black.png +0 -0
  20. data/doc/images/bullet_toggle_minus.png +0 -0
  21. data/doc/images/bullet_toggle_plus.png +0 -0
  22. data/doc/images/date.png +0 -0
  23. data/doc/images/delete.png +0 -0
  24. data/doc/images/find.png +0 -0
  25. data/doc/images/loadingAnimation.gif +0 -0
  26. data/doc/images/macFFBgHack.png +0 -0
  27. data/doc/images/package.png +0 -0
  28. data/doc/images/page_green.png +0 -0
  29. data/doc/images/page_white_text.png +0 -0
  30. data/doc/images/page_white_width.png +0 -0
  31. data/doc/images/plugin.png +0 -0
  32. data/doc/images/ruby.png +0 -0
  33. data/doc/images/tag_blue.png +0 -0
  34. data/doc/images/tag_green.png +0 -0
  35. data/doc/images/transparent.png +0 -0
  36. data/doc/images/wrench.png +0 -0
  37. data/doc/images/wrench_orange.png +0 -0
  38. data/doc/images/zoom.png +0 -0
  39. data/doc/index.html +134 -223
  40. data/doc/js/darkfish.js +153 -0
  41. data/doc/js/jquery.js +18 -0
  42. data/doc/js/navigation.js +142 -0
  43. data/doc/js/search.js +94 -0
  44. data/doc/js/search_index.js +1 -0
  45. data/doc/js/searcher.js +228 -0
  46. data/doc/lib/beway/auction_rb.html +1 -1
  47. data/doc/lib/beway/bidder_rb.html +1 -1
  48. data/doc/lib/beway/cli_runner_rb.html +1 -1
  49. data/doc/lib/beway/ebay_data_rb.html +1 -1
  50. data/doc/rdoc.css +310 -473
  51. data/doc/table_of_contents.html +154 -0
  52. data/lib/beway.rb +4 -0
  53. data/lib/beway/auction.rb +5 -7
  54. data/lib/beway/cli_runner.rb +2 -3
  55. data/lib/beway/ebay_data.rb +1 -1
  56. data/spec/auction_spec.rb +12 -1
  57. data/spec/bidder_spec.rb +19 -3
  58. data/spec/config.rb +2 -2
  59. data/spec/html/kodak-film-old.html +59 -0
  60. metadata +82 -97
@@ -1,453 +1,400 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
1
+ <!DOCTYPE html>
2
+
3
+ <html>
5
4
  <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: Beway::EbayData</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/beway/ebay_data_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/beway/ebay_data.rb">lib/beway/ebay_data.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link">Object</p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-new">::new</a></li>
73
-
74
- <li><a href="#method-i-calc_time_offset">#calc_time_offset</a></li>
75
-
76
- <li><a href="#method-i-official_time">#official_time</a></li>
77
-
78
- <li><a href="#method-i-seconds_to">#seconds_to</a></li>
79
-
80
- <li><a href="#method-i-time">#time</a></li>
81
-
82
- <li><a href="#method-i-time_offset">#time_offset</a></li>
83
-
84
- </ul>
85
- </div>
86
-
87
-
88
- <!-- Included Modules -->
89
-
90
- <div id="includes-section" class="section">
91
- <h3 class="section-header">Included Modules</h3>
92
- <ul class="link-list">
93
-
94
-
95
- <li><span class="include">Singleton</span></li>
96
-
97
-
98
- </ul>
99
- </div>
100
-
101
- </div>
102
-
103
- <div id="project-metadata">
104
-
105
-
106
- <div id="fileindex-section" class="section project-section">
107
- <h3 class="section-header">Files</h3>
108
- <ul>
109
-
110
- <li class="file"><a href="../README.html">README</a></li>
111
-
112
- </ul>
113
- </div>
114
-
115
-
116
- <div id="classindex-section" class="section project-section">
117
- <h3 class="section-header">Class Index
118
- <span class="search-toggle"><img src="../images/find.png"
119
- height="16" width="16" alt="[+]"
120
- title="show/hide quicksearch" /></span></h3>
121
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
122
- <fieldset>
123
- <legend>Quicksearch</legend>
124
- <input type="text" name="quicksearch" value=""
125
- class="quicksearch-field" />
126
- </fieldset>
127
- </form>
128
-
129
- <ul class="link-list">
130
-
131
- <li><a href="../Beway.html">Beway</a></li>
132
-
133
- <li><a href="../Beway/Auction.html">Beway::Auction</a></li>
134
-
135
- <li><a href="../Beway/AuctionParseError.html">Beway::AuctionParseError</a></li>
136
-
137
- <li><a href="../Beway/Bidder.html">Beway::Bidder</a></li>
138
-
139
- <li><a href="../Beway/BidderError.html">Beway::BidderError</a></li>
140
-
141
- <li><a href="../Beway/CliRunner.html">Beway::CliRunner</a></li>
142
-
143
- <li><a href="../Beway/EbayData.html">Beway::EbayData</a></li>
144
-
145
- <li><a href="../Beway/EbayDataParseError.html">Beway::EbayDataParseError</a></li>
146
-
147
- <li><a href="../Beway/InvalidUrlError.html">Beway::InvalidUrlError</a></li>
148
-
149
- </ul>
150
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
151
- </div>
152
-
153
-
154
- </div>
155
- </div>
156
-
157
- <div id="documentation">
158
- <h1 class="class">Beway::EbayData</h1>
159
-
160
- <div id="description">
161
- <p>
162
- <a href="EbayData.html">EbayData</a>
163
- </p>
164
- <p>
165
- Singleton class to handle ebay queries that are not auction-related.
166
- </p>
167
-
168
- </div>
169
-
170
- <!-- Constants -->
171
-
172
- <div id="constants-list" class="section">
173
- <h3 class="section-header">Constants</h3>
174
- <dl>
175
-
176
- <dt><a name="EBAY_OFFICIAL_TIME_URL">EBAY_OFFICIAL_TIME_URL</a></dt>
177
-
178
- <dd class="description"></dd>
179
-
180
-
181
- </dl>
182
- </div>
183
-
184
-
185
- <!-- Attributes -->
186
-
187
-
188
- <!-- Methods -->
189
-
190
- <div id="public-class-method-details" class="method-section section">
191
- <h3 class="section-header">Public Class Methods</h3>
192
-
193
-
194
- <div id="new-method" class="method-detail ">
195
- <a name="method-c-new"></a>
196
-
197
- <div class="method-heading">
198
-
199
- <span class="method-name">new</span><span
200
- class="method-args">()</span>
201
- <span class="method-click-advice">click to toggle source</span>
202
-
203
- </div>
204
-
205
- <div class="method-description">
206
-
207
-
208
-
209
-
210
-
211
- <div class="method-source-code"
212
- id="new-source">
213
- <pre>
214
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 18</span>
215
- 18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
216
- 19: <span class="ruby-ivar">@time_offset</span> = <span class="ruby-keyword kw">nil</span>
217
- 20: <span class="ruby-ivar">@last_time_offset</span> = <span class="ruby-keyword kw">nil</span>
218
- 21: <span class="ruby-keyword kw">end</span></pre>
219
- </div>
220
-
221
- </div>
222
-
223
-
224
-
225
-
226
- </div>
227
-
228
-
229
- </div>
230
-
231
- <div id="public-instance-method-details" class="method-section section">
232
- <h3 class="section-header">Public Instance Methods</h3>
233
-
234
-
235
- <div id="calc-time-offset-method" class="method-detail ">
236
- <a name="method-i-calc_time_offset"></a>
237
-
238
- <div class="method-heading">
239
-
240
- <span class="method-name">calc_time_offset</span><span
241
- class="method-args">()</span>
242
- <span class="method-click-advice">click to toggle source</span>
243
-
244
- </div>
245
-
246
- <div class="method-description">
247
-
248
- <p>
249
- Calculate the ebay time offset
250
- </p>
251
-
252
-
253
-
254
- <div class="method-source-code"
255
- id="calc-time-offset-source">
256
- <pre>
257
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 37</span>
258
- 37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">calc_time_offset</span>
259
- 38: <span class="ruby-ivar">@last_time_offset</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
260
- 39: <span class="ruby-ivar">@time_offset</span> = <span class="ruby-identifier">official_time</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">localtime</span>
261
- 40: <span class="ruby-keyword kw">end</span></pre>
262
- </div>
263
-
264
- </div>
265
-
266
-
267
-
268
-
269
- </div>
270
-
271
-
272
- <div id="official-time-method" class="method-detail ">
273
- <a name="method-i-official_time"></a>
274
-
275
- <div class="method-heading">
276
-
277
- <span class="method-name">official_time</span><span
278
- class="method-args">()</span>
279
- <span class="method-click-advice">click to toggle source</span>
280
-
281
- </div>
282
-
283
- <div class="method-description">
284
-
285
- <p>
286
- Retrieve the official ebay time
287
- </p>
288
-
289
-
290
-
291
- <div class="method-source-code"
292
- id="official-time-source">
293
- <pre>
294
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 43</span>
295
- 43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">official_time</span>
296
- 44: <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">HTML</span>(<span class="ruby-identifier">open</span>(<span class="ruby-constant">EBAY_OFFICIAL_TIME_URL</span>))
297
- 45:
298
- 46: <span class="ruby-identifier">time_label</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">'//p[contains(text(), &quot;The official eBay Time is now:&quot;)]'</span>)
299
- 47:
300
- 48: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-value str">&quot;Couldn't find time label&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_label</span>
301
- 49:
302
- 50: <span class="ruby-identifier">time_node</span> = <span class="ruby-identifier">time_label</span>.<span class="ruby-identifier">next_sibling</span>.<span class="ruby-identifier">next_sibling</span>
303
- 51: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-value str">&quot;Couldn't find time node&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_node</span>
304
- 52:
305
- 53: <span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">time_node</span>.<span class="ruby-identifier">inner_text</span>
306
- 54: <span class="ruby-identifier">time_re</span> = <span class="ruby-regexp re">/(Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day, (January|February|March|April|May|June|July|August|September|October|December) \d\d, 20\d\d \d\d:\d\d:\d\d P[SD]T/</span>
307
- 55: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-node">&quot;Time in unexpected format: #{time_str}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_re</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">time_str</span>)
308
- 56:
309
- 57: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">time_str</span>).<span class="ruby-identifier">localtime</span>
310
- 58: <span class="ruby-keyword kw">end</span></pre>
311
- </div>
312
-
313
- </div>
314
-
315
-
316
-
317
-
318
- </div>
319
-
320
-
321
- <div id="seconds-to-method" class="method-detail ">
322
- <a name="method-i-seconds_to"></a>
323
-
324
- <div class="method-heading">
325
-
326
- <span class="method-name">seconds_to</span><span
327
- class="method-args">(some_ebay_time)</span>
328
- <span class="method-click-advice">click to toggle source</span>
329
-
330
- </div>
331
-
332
- <div class="method-description">
333
-
334
- <p>
335
- Returns the number of seconds to some_ebay_time
336
- </p>
337
-
338
-
339
-
340
- <div class="method-source-code"
341
- id="seconds-to-source">
342
- <pre>
343
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 61</span>
344
- 61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seconds_to</span>(<span class="ruby-identifier">some_ebay_time</span>)
345
- 62: <span class="ruby-identifier">some_ebay_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">time</span>
346
- 63: <span class="ruby-keyword kw">end</span></pre>
347
- </div>
348
-
349
- </div>
350
-
351
-
352
-
353
-
354
- </div>
355
-
356
-
357
- <div id="time-method" class="method-detail ">
358
- <a name="method-i-time"></a>
359
-
360
- <div class="method-heading">
361
-
362
- <span class="method-name">time</span><span
363
- class="method-args">()</span>
364
- <span class="method-click-advice">click to toggle source</span>
365
-
366
- </div>
367
-
368
- <div class="method-description">
369
-
370
- <p>
371
- The current ebay time as calculated by an offset from localtime.
372
- </p>
373
-
374
-
375
-
376
- <div class="method-source-code"
377
- id="time-source">
378
- <pre>
379
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 24</span>
380
- 24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time</span>
381
- 25: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">localtime</span> <span class="ruby-operator">+</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">time_offset</span>
382
- 26: <span class="ruby-keyword kw">end</span></pre>
383
- </div>
384
-
385
- </div>
386
-
387
-
388
-
389
-
390
- </div>
391
-
392
-
393
- <div id="time-offset-method" class="method-detail ">
394
- <a name="method-i-time_offset"></a>
395
-
396
- <div class="method-heading">
397
-
398
- <span class="method-name">time_offset</span><span
399
- class="method-args">()</span>
400
- <span class="method-click-advice">click to toggle source</span>
401
-
402
- </div>
403
-
404
- <div class="method-description">
405
-
406
- <p>
407
- The localtime offset from ebay time.
408
- </p>
409
- <p>
410
- add this offset to localtime to get an estimated ebay time
411
- </p>
412
-
413
-
414
-
415
- <div class="method-source-code"
416
- id="time-offset-source">
417
- <pre>
418
- <span class="ruby-comment cmt"># File lib/beway/ebay_data.rb, line 31</span>
419
- 31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_offset</span>
420
- 32: <span class="ruby-identifier">calc_time_offset</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@time_offset</span>
421
- 33: <span class="ruby-ivar">@time_offset</span>
422
- 34: <span class="ruby-keyword kw">end</span></pre>
423
- </div>
424
-
425
- </div>
426
-
427
-
428
-
429
-
430
- </div>
431
-
432
-
433
- </div>
434
-
435
-
436
- </div>
437
-
438
-
439
- <div id="rdoc-debugging-section-dump" class="debugging-section">
440
-
441
- <p>Disabled; run with --debug to generate this.</p>
442
-
443
- </div>
444
-
445
- <div id="validator-badges">
446
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
447
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
448
- Rdoc Generator</a> 1.1.6</small>.</p>
449
- </div>
450
-
451
- </body>
452
- </html>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Beway::EbayData - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/beway/ebay_data.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link">Object
63
+
64
+ </nav>
65
+
66
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><span class="include">Singleton</span>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+ <!-- Method Quickref -->
80
+ <nav id="method-list-section" class="section">
81
+ <h3 class="section-header">Methods</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="#method-c-new">::new</a>
86
+
87
+ <li><a href="#method-i-calc_time_offset">#calc_time_offset</a>
88
+
89
+ <li><a href="#method-i-official_time">#official_time</a>
90
+
91
+ <li><a href="#method-i-seconds_to">#seconds_to</a>
92
+
93
+ <li><a href="#method-i-time">#time</a>
94
+
95
+ <li><a href="#method-i-time_offset">#time_offset</a>
96
+
97
+ </ul>
98
+ </nav>
99
+
100
+ </div>
101
+
102
+ <div id="project-metadata">
103
+ <nav id="fileindex-section" class="section project-section">
104
+ <h3 class="section-header">Pages</h3>
105
+
106
+ <ul>
107
+
108
+ <li class="file"><a href="../README.html">README</a>
109
+
110
+ </ul>
111
+ </nav>
112
+
113
+ <nav id="classindex-section" class="section project-section">
114
+ <h3 class="section-header">Class and Module Index</h3>
115
+
116
+ <ul class="link-list">
117
+
118
+ <li><a href="../Beway.html">Beway</a>
119
+
120
+ <li><a href="../Beway/Auction.html">Beway::Auction</a>
121
+
122
+ <li><a href="../Beway/AuctionParseError.html">Beway::AuctionParseError</a>
123
+
124
+ <li><a href="../Beway/Bidder.html">Beway::Bidder</a>
125
+
126
+ <li><a href="../Beway/BidderError.html">Beway::BidderError</a>
127
+
128
+ <li><a href="../Beway/CliRunner.html">Beway::CliRunner</a>
129
+
130
+ <li><a href="../Beway/EbayData.html">Beway::EbayData</a>
131
+
132
+ <li><a href="../Beway/EbayDataParseError.html">Beway::EbayDataParseError</a>
133
+
134
+ <li><a href="../Beway/InvalidUrlError.html">Beway::InvalidUrlError</a>
135
+
136
+ </ul>
137
+ </nav>
138
+
139
+ </div>
140
+ </nav>
141
+
142
+ <div id="documentation">
143
+ <h1 class="class">class Beway::EbayData</h1>
144
+
145
+ <div id="description" class="description">
146
+
147
+ <p><a href="EbayData.html">EbayData</a></p>
148
+
149
+ <p>Singleton class to handle ebay queries that are not auction-related.</p>
150
+
151
+ </div><!-- description -->
152
+
153
+
154
+
155
+
156
+ <section id="5Buntitled-5D" class="documentation-section">
157
+
158
+
159
+
160
+
161
+
162
+ <!-- Constants -->
163
+ <section id="constants-list" class="section">
164
+ <h3 class="section-header">Constants</h3>
165
+ <dl>
166
+
167
+ <dt id="EBAY_OFFICIAL_TIME_URL">EBAY_OFFICIAL_TIME_URL
168
+
169
+ <dd class="description">
170
+
171
+
172
+ </dl>
173
+ </section>
174
+
175
+
176
+
177
+
178
+ <!-- Methods -->
179
+
180
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
181
+ <h3 class="section-header">Public Class Methods</h3>
182
+
183
+
184
+ <div id="method-c-new" class="method-detail ">
185
+
186
+ <div class="method-heading">
187
+ <span class="method-name">new</span><span
188
+ class="method-args">()</span>
189
+ <span class="method-click-advice">click to toggle source</span>
190
+ </div>
191
+
192
+
193
+ <div class="method-description">
194
+
195
+
196
+
197
+
198
+
199
+ <div class="method-source-code" id="new-source">
200
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 18</span>
201
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
202
+ <span class="ruby-ivar">@time_offset</span> = <span class="ruby-keyword">nil</span>
203
+ <span class="ruby-ivar">@last_time_offset</span> = <span class="ruby-keyword">nil</span>
204
+ <span class="ruby-keyword">end</span></pre>
205
+ </div><!-- new-source -->
206
+
207
+ </div>
208
+
209
+
210
+
211
+
212
+ </div><!-- new-method -->
213
+
214
+
215
+ </section><!-- public-class-method-details -->
216
+
217
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
218
+ <h3 class="section-header">Public Instance Methods</h3>
219
+
220
+
221
+ <div id="method-i-calc_time_offset" class="method-detail ">
222
+
223
+ <div class="method-heading">
224
+ <span class="method-name">calc_time_offset</span><span
225
+ class="method-args">()</span>
226
+ <span class="method-click-advice">click to toggle source</span>
227
+ </div>
228
+
229
+
230
+ <div class="method-description">
231
+
232
+ <p>Calculate the ebay time offset</p>
233
+
234
+
235
+
236
+ <div class="method-source-code" id="calc_time_offset-source">
237
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 37</span>
238
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">calc_time_offset</span>
239
+ <span class="ruby-ivar">@last_time_offset</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
240
+ <span class="ruby-ivar">@time_offset</span> = <span class="ruby-identifier">official_time</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">localtime</span>
241
+ <span class="ruby-keyword">end</span></pre>
242
+ </div><!-- calc_time_offset-source -->
243
+
244
+ </div>
245
+
246
+
247
+
248
+
249
+ </div><!-- calc_time_offset-method -->
250
+
251
+
252
+ <div id="method-i-official_time" class="method-detail ">
253
+
254
+ <div class="method-heading">
255
+ <span class="method-name">official_time</span><span
256
+ class="method-args">()</span>
257
+ <span class="method-click-advice">click to toggle source</span>
258
+ </div>
259
+
260
+
261
+ <div class="method-description">
262
+
263
+ <p>Retrieve the official ebay time</p>
264
+
265
+
266
+
267
+ <div class="method-source-code" id="official_time-source">
268
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 43</span>
269
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">official_time</span>
270
+ <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">HTML</span>(<span class="ruby-identifier">open</span>(<span class="ruby-constant">EBAY_OFFICIAL_TIME_URL</span>))
271
+
272
+ <span class="ruby-identifier">time_label</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-string">'//p[contains(text(), &quot;The official eBay Time is now:&quot;)]'</span>)
273
+
274
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-string">&quot;Couldn't find time label&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_label</span>
275
+
276
+ <span class="ruby-identifier">time_node</span> = <span class="ruby-identifier">time_label</span>.<span class="ruby-identifier">next_sibling</span>.<span class="ruby-identifier">next_sibling</span>
277
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-string">&quot;Couldn't find time node&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_node</span>
278
+
279
+ <span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">time_node</span>.<span class="ruby-identifier">inner_text</span>
280
+ <span class="ruby-identifier">time_re</span> = <span class="ruby-regexp">%r(Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day, (January|February|March|April|May|June|July|August|September|October|November|December) \d\d, 20\d\d \d\d:\d\d:\d\d P[SD]T/</span>
281
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-node">&quot;Time in unexpected format: #{time_str}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_re</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">time_str</span>)
282
+
283
+ <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">time_str</span>).<span class="ruby-identifier">localtime</span>
284
+ <span class="ruby-keyword">end</span></pre>
285
+ </div><!-- official_time-source -->
286
+
287
+ </div>
288
+
289
+
290
+
291
+
292
+ </div><!-- official_time-method -->
293
+
294
+
295
+ <div id="method-i-seconds_to" class="method-detail ">
296
+
297
+ <div class="method-heading">
298
+ <span class="method-name">seconds_to</span><span
299
+ class="method-args">(some_ebay_time)</span>
300
+ <span class="method-click-advice">click to toggle source</span>
301
+ </div>
302
+
303
+
304
+ <div class="method-description">
305
+
306
+ <p>Returns the number of seconds to some_ebay_time</p>
307
+
308
+
309
+
310
+ <div class="method-source-code" id="seconds_to-source">
311
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 61</span>
312
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">seconds_to</span>(<span class="ruby-identifier">some_ebay_time</span>)
313
+ <span class="ruby-identifier">some_ebay_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">time</span>
314
+ <span class="ruby-keyword">end</span></pre>
315
+ </div><!-- seconds_to-source -->
316
+
317
+ </div>
318
+
319
+
320
+
321
+
322
+ </div><!-- seconds_to-method -->
323
+
324
+
325
+ <div id="method-i-time" class="method-detail ">
326
+
327
+ <div class="method-heading">
328
+ <span class="method-name">time</span><span
329
+ class="method-args">()</span>
330
+ <span class="method-click-advice">click to toggle source</span>
331
+ </div>
332
+
333
+
334
+ <div class="method-description">
335
+
336
+ <p>The current ebay time as calculated by an offset from localtime.</p>
337
+
338
+
339
+
340
+ <div class="method-source-code" id="time-source">
341
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 24</span>
342
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">time</span>
343
+ <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">localtime</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">time_offset</span>
344
+ <span class="ruby-keyword">end</span></pre>
345
+ </div><!-- time-source -->
346
+
347
+ </div>
348
+
349
+
350
+
351
+
352
+ </div><!-- time-method -->
353
+
354
+
355
+ <div id="method-i-time_offset" class="method-detail ">
356
+
357
+ <div class="method-heading">
358
+ <span class="method-name">time_offset</span><span
359
+ class="method-args">()</span>
360
+ <span class="method-click-advice">click to toggle source</span>
361
+ </div>
362
+
363
+
364
+ <div class="method-description">
365
+
366
+ <p>The localtime offset from ebay time.</p>
367
+
368
+ <p>add this offset to localtime to get an estimated ebay time</p>
369
+
370
+
371
+
372
+ <div class="method-source-code" id="time_offset-source">
373
+ <pre><span class="ruby-comment"># File lib/beway/ebay_data.rb, line 31</span>
374
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">time_offset</span>
375
+ <span class="ruby-identifier">calc_time_offset</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@time_offset</span>
376
+ <span class="ruby-ivar">@time_offset</span>
377
+ <span class="ruby-keyword">end</span></pre>
378
+ </div><!-- time_offset-source -->
379
+
380
+ </div>
381
+
382
+
383
+
384
+
385
+ </div><!-- time_offset-method -->
386
+
387
+
388
+ </section><!-- public-instance-method-details -->
389
+
390
+ </section><!-- 5Buntitled-5D -->
391
+
392
+ </div><!-- documentation -->
393
+
394
+
395
+ <footer id="validator-badges">
396
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
397
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
398
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
399
+ </footer>
453
400