beway 0.0.1

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.
Files changed (42) hide show
  1. data/Gemfile +7 -0
  2. data/Gemfile.lock +34 -0
  3. data/README +43 -0
  4. data/README.rdoc +43 -0
  5. data/Rakefile +19 -0
  6. data/bin/beway +5 -0
  7. data/doc/Beway.html +185 -0
  8. data/doc/Beway/Auction.html +802 -0
  9. data/doc/Beway/AuctionParseError.html +160 -0
  10. data/doc/Beway/Bidder.html +531 -0
  11. data/doc/Beway/BidderError.html +160 -0
  12. data/doc/Beway/CliRunner.html +817 -0
  13. data/doc/Beway/EbayData.html +453 -0
  14. data/doc/Beway/EbayDataParseError.html +160 -0
  15. data/doc/Beway/InvalidUrlError.html +160 -0
  16. data/doc/README.html +175 -0
  17. data/doc/created.rid +6 -0
  18. data/doc/index.html +225 -0
  19. data/doc/lib/beway/auction_rb.html +56 -0
  20. data/doc/lib/beway/bidder_rb.html +54 -0
  21. data/doc/lib/beway/cli_runner_rb.html +52 -0
  22. data/doc/lib/beway/ebay_data_rb.html +58 -0
  23. data/doc/rdoc.css +706 -0
  24. data/lib/beway.rb +4 -0
  25. data/lib/beway/auction.rb +150 -0
  26. data/lib/beway/bidder.rb +100 -0
  27. data/lib/beway/cli_runner.rb +184 -0
  28. data/lib/beway/ebay_data.rb +66 -0
  29. data/spec/auction_spec.rb +163 -0
  30. data/spec/bidder_spec.rb +30 -0
  31. data/spec/config.rb +4 -0
  32. data/spec/config.rb-dist +4 -0
  33. data/spec/ebay_data_spec.rb +23 -0
  34. data/spec/html/alfani-sweater-complete.html +39 -0
  35. data/spec/html/cashmere-sweater-complete.html +39 -0
  36. data/spec/html/cashmere-sweater.html +84 -0
  37. data/spec/html/mens-cardigans-dutch-bin.html +192 -0
  38. data/spec/html/pink-sweater-bid-bin.html +68 -0
  39. data/spec/html/polo-lambs-wool.html +150 -0
  40. data/spec/html/spring-mercer-bin-mo.html +533 -0
  41. data/spec/html/xmas-sweater.html +260 -0
  42. metadata +192 -0
@@ -0,0 +1,453 @@
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">
5
+ <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 PST/</span>
307
+ 55: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EbayDataParseError</span>, <span class="ruby-value str">&quot;Time in unexpected format&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>
453
+