beway 1.0.2 → 1.0.3
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 +7 -16
- data/README.rdoc +8 -20
- data/doc/Beway.html +136 -183
- data/doc/Beway/Auction.html +630 -816
- data/doc/Beway/AuctionParseError.html +139 -158
- data/doc/Beway/Bidder.html +384 -529
- data/doc/Beway/BidderError.html +139 -158
- data/doc/Beway/CliRunner.html +742 -818
- data/doc/Beway/EbayData.html +398 -451
- data/doc/Beway/EbayDataParseError.html +139 -158
- data/doc/Beway/InvalidUrlError.html +139 -158
- data/doc/README.html +129 -167
- data/doc/created.rid +6 -6
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +134 -223
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/lib/beway/auction_rb.html +1 -1
- data/doc/lib/beway/bidder_rb.html +1 -1
- data/doc/lib/beway/cli_runner_rb.html +1 -1
- data/doc/lib/beway/ebay_data_rb.html +1 -1
- data/doc/rdoc.css +310 -473
- data/doc/table_of_contents.html +154 -0
- data/lib/beway.rb +4 -0
- data/lib/beway/auction.rb +5 -7
- data/lib/beway/cli_runner.rb +2 -3
- data/lib/beway/ebay_data.rb +1 -1
- data/spec/auction_spec.rb +12 -1
- data/spec/bidder_spec.rb +19 -3
- data/spec/config.rb +2 -2
- data/spec/html/kodak-film-old.html +59 -0
- metadata +82 -97
data/Gemfile
CHANGED
data/README
CHANGED
|
@@ -9,35 +9,26 @@ Beway is a small Ruby library that:
|
|
|
9
9
|
|
|
10
10
|
== Requirements
|
|
11
11
|
|
|
12
|
-
Perhaps not requirements, but developed and tested with the
|
|
13
|
-
following:
|
|
14
|
-
|
|
15
12
|
- Ruby 1.9.2
|
|
16
13
|
|
|
17
|
-
And these gems:
|
|
18
|
-
|
|
19
|
-
- mechanize (1.0.0)
|
|
20
|
-
- nokogiri (1.4.4)
|
|
21
|
-
- rspec (2.4.0)
|
|
22
|
-
|
|
23
14
|
== Installation
|
|
24
15
|
|
|
25
|
-
|
|
16
|
+
gem install beway
|
|
26
17
|
|
|
27
|
-
|
|
18
|
+
== Running it
|
|
28
19
|
|
|
29
|
-
|
|
20
|
+
beway
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
== The source
|
|
32
23
|
|
|
33
|
-
|
|
24
|
+
Install requirements with bundler
|
|
25
|
+
|
|
26
|
+
bundle install
|
|
34
27
|
|
|
35
28
|
Make sure everything works as expected:
|
|
36
29
|
|
|
37
30
|
rake spec
|
|
38
31
|
|
|
39
|
-
== Docs
|
|
40
|
-
|
|
41
32
|
Generate rdoc html:
|
|
42
33
|
|
|
43
34
|
rake rdoc
|
data/README.rdoc
CHANGED
|
@@ -9,35 +9,23 @@ Beway is a small Ruby library that:
|
|
|
9
9
|
|
|
10
10
|
== Requirements
|
|
11
11
|
|
|
12
|
-
Perhaps not requirements, but developed and tested with the
|
|
13
|
-
following:
|
|
14
|
-
|
|
15
12
|
- Ruby 1.9.2
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- mechanize (1.0.0)
|
|
20
|
-
- nokogiri (1.4.4)
|
|
21
|
-
- rspec (2.4.0)
|
|
22
|
-
|
|
23
|
-
== Installation
|
|
14
|
+
== Install and run
|
|
24
15
|
|
|
25
|
-
|
|
16
|
+
gem install beway
|
|
17
|
+
beway
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
== The source
|
|
28
20
|
|
|
29
|
-
|
|
21
|
+
Clone the source from git hub.
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
Install requirements with bundler
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
bundle install
|
|
34
26
|
|
|
35
27
|
Make sure everything works as expected:
|
|
36
28
|
|
|
37
29
|
rake spec
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Generate rdoc html:
|
|
42
|
-
|
|
43
|
-
rake rdoc
|
|
31
|
+
Open a ticket if you find anything funky
|
data/doc/Beway.html
CHANGED
|
@@ -1,185 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
5
4
|
<head>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<li><a href="./Beway/EbayDataParseError.html">Beway::EbayDataParseError</a></li>
|
|
141
|
-
|
|
142
|
-
<li><a href="./Beway/InvalidUrlError.html">Beway::InvalidUrlError</a></li>
|
|
143
|
-
|
|
144
|
-
</ul>
|
|
145
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<div id="documentation">
|
|
153
|
-
<h1 class="module">Beway</h1>
|
|
154
|
-
|
|
155
|
-
<div id="description">
|
|
156
|
-
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
<!-- Constants -->
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<!-- Attributes -->
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<!-- Methods -->
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
172
|
-
|
|
173
|
-
<p>Disabled; run with --debug to generate this.</p>
|
|
174
|
-
|
|
175
|
-
</div>
|
|
176
|
-
|
|
177
|
-
<div id="validator-badges">
|
|
178
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
179
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
180
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
</body>
|
|
184
|
-
</html>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>module Beway - 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="module">
|
|
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/auction.rb
|
|
51
|
+
<li>lib/beway/bidder.rb
|
|
52
|
+
<li>lib/beway/cli_runner.rb
|
|
53
|
+
<li>lib/beway/ebay_data.rb
|
|
54
|
+
</ul>
|
|
55
|
+
</nav>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div id="class-metadata">
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div id="project-metadata">
|
|
68
|
+
<nav id="fileindex-section" class="section project-section">
|
|
69
|
+
<h3 class="section-header">Pages</h3>
|
|
70
|
+
|
|
71
|
+
<ul>
|
|
72
|
+
|
|
73
|
+
<li class="file"><a href="./README.html">README</a>
|
|
74
|
+
|
|
75
|
+
</ul>
|
|
76
|
+
</nav>
|
|
77
|
+
|
|
78
|
+
<nav id="classindex-section" class="section project-section">
|
|
79
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
80
|
+
|
|
81
|
+
<ul class="link-list">
|
|
82
|
+
|
|
83
|
+
<li><a href="./Beway.html">Beway</a>
|
|
84
|
+
|
|
85
|
+
<li><a href="./Beway/Auction.html">Beway::Auction</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="./Beway/AuctionParseError.html">Beway::AuctionParseError</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="./Beway/Bidder.html">Beway::Bidder</a>
|
|
90
|
+
|
|
91
|
+
<li><a href="./Beway/BidderError.html">Beway::BidderError</a>
|
|
92
|
+
|
|
93
|
+
<li><a href="./Beway/CliRunner.html">Beway::CliRunner</a>
|
|
94
|
+
|
|
95
|
+
<li><a href="./Beway/EbayData.html">Beway::EbayData</a>
|
|
96
|
+
|
|
97
|
+
<li><a href="./Beway/EbayDataParseError.html">Beway::EbayDataParseError</a>
|
|
98
|
+
|
|
99
|
+
<li><a href="./Beway/InvalidUrlError.html">Beway::InvalidUrlError</a>
|
|
100
|
+
|
|
101
|
+
</ul>
|
|
102
|
+
</nav>
|
|
103
|
+
|
|
104
|
+
</div>
|
|
105
|
+
</nav>
|
|
106
|
+
|
|
107
|
+
<div id="documentation">
|
|
108
|
+
<h1 class="module">module Beway</h1>
|
|
109
|
+
|
|
110
|
+
<div id="description" class="description">
|
|
111
|
+
|
|
112
|
+
</div><!-- description -->
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<!-- Methods -->
|
|
127
|
+
|
|
128
|
+
</section><!-- 5Buntitled-5D -->
|
|
129
|
+
|
|
130
|
+
</div><!-- documentation -->
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<footer id="validator-badges">
|
|
134
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
135
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
136
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
137
|
+
</footer>
|
|
185
138
|
|
data/doc/Beway/Auction.html
CHANGED
|
@@ -1,818 +1,632 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
5
4
|
<head>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
</
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<
|
|
339
|
-
<span class="ruby-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
</
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
<
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
</
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
<
|
|
632
|
-
|
|
633
|
-
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_left</span>
|
|
634
|
-
74: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">complete?</span>
|
|
635
|
-
75:
|
|
636
|
-
76: <span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">node_text</span>(<span class="ruby-identifier">time_node</span>)
|
|
637
|
-
77: <span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">time_str</span>[<span class="ruby-regexp re">/^[^(]*/</span>].<span class="ruby-identifier">strip</span>
|
|
638
|
-
78: <span class="ruby-identifier">time_ar</span> = <span class="ruby-identifier">time_str</span>.<span class="ruby-identifier">split</span>
|
|
639
|
-
79:
|
|
640
|
-
80: <span class="ruby-comment cmt"># time_ar comes to us looking like</span>
|
|
641
|
-
81: <span class="ruby-comment cmt"># ["2d", "05h"] or ["0", "h", "12", "m", "5", "s"]</span>
|
|
642
|
-
82: <span class="ruby-comment cmt"># decide which, and roll with it...</span>
|
|
643
|
-
83:
|
|
644
|
-
84: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">0</span>][<span class="ruby-regexp re">/^\d+d$/</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>][<span class="ruby-regexp re">/^\d+h$/</span>]
|
|
645
|
-
85: <span class="ruby-comment cmt"># ["2d", "05h"] style</span>
|
|
646
|
-
86: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">time_ar</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
|
647
|
-
87: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^days?$/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^hours?$/</span>
|
|
648
|
-
88: <span class="ruby-comment cmt"># ["1", "day", "18", "hours"]</span>
|
|
649
|
-
89: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">time_ar</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
|
650
|
-
90: <span class="ruby-keyword kw">else</span>
|
|
651
|
-
91: <span class="ruby-comment cmt"># assume ["0", "h", "12", "m", "5", "s"] style</span>
|
|
652
|
-
92: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Didn't find hour marker where expected"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'h'</span>
|
|
653
|
-
93: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Didn't find minute marker where expected"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'m'</span>
|
|
654
|
-
94: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Didn't find second marker where expected"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'s'</span>
|
|
655
|
-
95: <span class="ruby-keyword kw">return</span> [ <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>],
|
|
656
|
-
96: <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>],
|
|
657
|
-
97: <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">5</span>] ].<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
|
658
|
-
98: <span class="ruby-keyword kw">end</span>
|
|
659
|
-
99: <span class="ruby-keyword kw">end</span></pre>
|
|
660
|
-
</div>
|
|
661
|
-
|
|
662
|
-
</div>
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
</div>
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
<div id="valid-auction--method" class="method-detail ">
|
|
671
|
-
<a name="method-i-valid_auction%3F"></a>
|
|
672
|
-
|
|
673
|
-
<div class="method-heading">
|
|
674
|
-
|
|
675
|
-
<span class="method-name">valid_auction?</span><span
|
|
676
|
-
class="method-args">()</span>
|
|
677
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
678
|
-
|
|
679
|
-
</div>
|
|
680
|
-
|
|
681
|
-
<div class="method-description">
|
|
682
|
-
|
|
683
|
-
<p>
|
|
684
|
-
can we represent this auction?
|
|
685
|
-
</p>
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
<div class="method-source-code"
|
|
690
|
-
id="valid-auction--source">
|
|
691
|
-
<pre>
|
|
692
|
-
<span class="ruby-comment cmt"># File lib/beway/auction.rb, line 23</span>
|
|
693
|
-
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_auction?</span>
|
|
694
|
-
24: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">complete?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">has_bid_button?</span>
|
|
695
|
-
25: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
|
696
|
-
26: <span class="ruby-keyword kw">end</span></pre>
|
|
697
|
-
</div>
|
|
698
|
-
|
|
699
|
-
</div>
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
</div>
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
</div>
|
|
708
|
-
|
|
709
|
-
<div id="private-instance-method-details" class="method-section section">
|
|
710
|
-
<h3 class="section-header">Private Instance Methods</h3>
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
<div id="node-text-method" class="method-detail ">
|
|
714
|
-
<a name="method-i-node_text"></a>
|
|
715
|
-
|
|
716
|
-
<div class="method-heading">
|
|
717
|
-
|
|
718
|
-
<span class="method-name">node_text</span><span
|
|
719
|
-
class="method-args">(n)</span>
|
|
720
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
721
|
-
|
|
722
|
-
</div>
|
|
723
|
-
|
|
724
|
-
<div class="method-description">
|
|
725
|
-
|
|
726
|
-
<p>
|
|
727
|
-
a string of all text nodes below n, concatenated
|
|
728
|
-
</p>
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
<div class="method-source-code"
|
|
733
|
-
id="node-text-source">
|
|
734
|
-
<pre>
|
|
735
|
-
<span class="ruby-comment cmt"># File lib/beway/auction.rb, line 159</span>
|
|
736
|
-
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">node_text</span>(<span class="ruby-identifier">n</span>)
|
|
737
|
-
160: <span class="ruby-identifier">t</span> = <span class="ruby-value str">''</span>
|
|
738
|
-
161: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">traverse</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">text?</span> }
|
|
739
|
-
162: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ +/</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">strip</span>
|
|
740
|
-
163: <span class="ruby-keyword kw">end</span></pre>
|
|
741
|
-
</div>
|
|
742
|
-
|
|
743
|
-
</div>
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
</div>
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
<div id="time-node-method" class="method-detail ">
|
|
752
|
-
<a name="method-i-time_node"></a>
|
|
753
|
-
|
|
754
|
-
<div class="method-heading">
|
|
755
|
-
|
|
756
|
-
<span class="method-name">time_node</span><span
|
|
757
|
-
class="method-args">()</span>
|
|
758
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
759
|
-
|
|
760
|
-
</div>
|
|
761
|
-
|
|
762
|
-
<div class="method-description">
|
|
763
|
-
|
|
764
|
-
<p>
|
|
765
|
-
fetch the node containing the end time
|
|
766
|
-
</p>
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
<div class="method-source-code"
|
|
771
|
-
id="time-node-source">
|
|
772
|
-
<pre>
|
|
773
|
-
<span class="ruby-comment cmt"># File lib/beway/auction.rb, line 143</span>
|
|
774
|
-
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_node</span>
|
|
775
|
-
144: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">complete?</span>
|
|
776
|
-
145: <span class="ruby-identifier">td</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">"//td[contains(text(),'Ended:')]"</span>)
|
|
777
|
-
146: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Couldn't find ended header"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">td</span>
|
|
778
|
-
147: <span class="ruby-identifier">node</span> = <span class="ruby-identifier">td</span>.<span class="ruby-identifier">next_sibling</span>
|
|
779
|
-
148: <span class="ruby-keyword kw">else</span>
|
|
780
|
-
149: <span class="ruby-identifier">th</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">"//th[contains(text(),'Time left:')]"</span>)
|
|
781
|
-
150: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Couldn't find Time Left header"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">th</span>
|
|
782
|
-
151: <span class="ruby-identifier">node</span> = <span class="ruby-identifier">th</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">at_css</span>(<span class="ruby-value str">'td'</span>)
|
|
783
|
-
152: <span class="ruby-keyword kw">end</span>
|
|
784
|
-
153:
|
|
785
|
-
154: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-value str">"Couldn't find Time node"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">node</span>
|
|
786
|
-
155: <span class="ruby-identifier">node</span>
|
|
787
|
-
156: <span class="ruby-keyword kw">end</span></pre>
|
|
788
|
-
</div>
|
|
789
|
-
|
|
790
|
-
</div>
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
</div>
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
</div>
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
</div>
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
805
|
-
|
|
806
|
-
<p>Disabled; run with --debug to generate this.</p>
|
|
807
|
-
|
|
808
|
-
</div>
|
|
809
|
-
|
|
810
|
-
<div id="validator-badges">
|
|
811
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
812
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
813
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
814
|
-
</div>
|
|
815
|
-
|
|
816
|
-
</body>
|
|
817
|
-
</html>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>class Beway::Auction - 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/auction.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
|
+
|
|
67
|
+
<!-- Method Quickref -->
|
|
68
|
+
<nav id="method-list-section" class="section">
|
|
69
|
+
<h3 class="section-header">Methods</h3>
|
|
70
|
+
|
|
71
|
+
<ul class="link-list">
|
|
72
|
+
|
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
|
74
|
+
|
|
75
|
+
<li><a href="#method-i-auction_number">#auction_number</a>
|
|
76
|
+
|
|
77
|
+
<li><a href="#method-i-complete-3F">#complete?</a>
|
|
78
|
+
|
|
79
|
+
<li><a href="#method-i-current_bid">#current_bid</a>
|
|
80
|
+
|
|
81
|
+
<li><a href="#method-i-description">#description</a>
|
|
82
|
+
|
|
83
|
+
<li><a href="#method-i-end_time">#end_time</a>
|
|
84
|
+
|
|
85
|
+
<li><a href="#method-i-has_bid_button-3F">#has_bid_button?</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="#method-i-min_bid">#min_bid</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="#method-i-refresh_doc">#refresh_doc</a>
|
|
90
|
+
|
|
91
|
+
<li><a href="#method-i-time_left">#time_left</a>
|
|
92
|
+
|
|
93
|
+
<li><a href="#method-i-valid_auction-3F">#valid_auction?</a>
|
|
94
|
+
|
|
95
|
+
</ul>
|
|
96
|
+
</nav>
|
|
97
|
+
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div id="project-metadata">
|
|
101
|
+
<nav id="fileindex-section" class="section project-section">
|
|
102
|
+
<h3 class="section-header">Pages</h3>
|
|
103
|
+
|
|
104
|
+
<ul>
|
|
105
|
+
|
|
106
|
+
<li class="file"><a href="../README.html">README</a>
|
|
107
|
+
|
|
108
|
+
</ul>
|
|
109
|
+
</nav>
|
|
110
|
+
|
|
111
|
+
<nav id="classindex-section" class="section project-section">
|
|
112
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
113
|
+
|
|
114
|
+
<ul class="link-list">
|
|
115
|
+
|
|
116
|
+
<li><a href="../Beway.html">Beway</a>
|
|
117
|
+
|
|
118
|
+
<li><a href="../Beway/Auction.html">Beway::Auction</a>
|
|
119
|
+
|
|
120
|
+
<li><a href="../Beway/AuctionParseError.html">Beway::AuctionParseError</a>
|
|
121
|
+
|
|
122
|
+
<li><a href="../Beway/Bidder.html">Beway::Bidder</a>
|
|
123
|
+
|
|
124
|
+
<li><a href="../Beway/BidderError.html">Beway::BidderError</a>
|
|
125
|
+
|
|
126
|
+
<li><a href="../Beway/CliRunner.html">Beway::CliRunner</a>
|
|
127
|
+
|
|
128
|
+
<li><a href="../Beway/EbayData.html">Beway::EbayData</a>
|
|
129
|
+
|
|
130
|
+
<li><a href="../Beway/EbayDataParseError.html">Beway::EbayDataParseError</a>
|
|
131
|
+
|
|
132
|
+
<li><a href="../Beway/InvalidUrlError.html">Beway::InvalidUrlError</a>
|
|
133
|
+
|
|
134
|
+
</ul>
|
|
135
|
+
</nav>
|
|
136
|
+
|
|
137
|
+
</div>
|
|
138
|
+
</nav>
|
|
139
|
+
|
|
140
|
+
<div id="documentation">
|
|
141
|
+
<h1 class="class">class Beway::Auction</h1>
|
|
142
|
+
|
|
143
|
+
<div id="description" class="description">
|
|
144
|
+
|
|
145
|
+
<p><a href="Auction.html">Auction</a></p>
|
|
146
|
+
|
|
147
|
+
<p>Represents an ebay auction. Can only be instantiated for true auctions (no
|
|
148
|
+
buy-it-now-only sales) and completed auctions.</p>
|
|
149
|
+
|
|
150
|
+
</div><!-- description -->
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<!-- Attributes -->
|
|
164
|
+
<section id="attribute-method-details" class="method-section section">
|
|
165
|
+
<h3 class="section-header">Attributes</h3>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<div id="attribute-i-doc" class="method-detail">
|
|
169
|
+
<div class="method-heading attribute-method-heading">
|
|
170
|
+
<span class="method-name">doc</span><span
|
|
171
|
+
class="attribute-access-type">[R]</span>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<div class="method-description">
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div id="attribute-i-last_updated" class="method-detail">
|
|
182
|
+
<div class="method-heading attribute-method-heading">
|
|
183
|
+
<span class="method-name">last_updated</span><span
|
|
184
|
+
class="attribute-access-type">[R]</span>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<div class="method-description">
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<div id="attribute-i-url" class="method-detail">
|
|
195
|
+
<div class="method-heading attribute-method-heading">
|
|
196
|
+
<span class="method-name">url</span><span
|
|
197
|
+
class="attribute-access-type">[R]</span>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="method-description">
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
</section><!-- attribute-method-details -->
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<!-- Methods -->
|
|
211
|
+
|
|
212
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
|
213
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<div id="method-c-new" class="method-detail ">
|
|
217
|
+
|
|
218
|
+
<div class="method-heading">
|
|
219
|
+
<span class="method-name">new</span><span
|
|
220
|
+
class="method-args">(url)</span>
|
|
221
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<div class="method-description">
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<div class="method-source-code" id="new-source">
|
|
232
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 16</span>
|
|
233
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">url</span>
|
|
234
|
+
<span class="ruby-ivar">@url</span> = <span class="ruby-identifier">url</span>
|
|
235
|
+
<span class="ruby-identifier">refresh_doc</span>
|
|
236
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidUrlError</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">valid_auction?</span>
|
|
237
|
+
<span class="ruby-keyword">end</span></pre>
|
|
238
|
+
</div><!-- new-source -->
|
|
239
|
+
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
</div><!-- new-method -->
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
</section><!-- public-class-method-details -->
|
|
249
|
+
|
|
250
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
|
251
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
<div id="method-i-auction_number" class="method-detail ">
|
|
255
|
+
|
|
256
|
+
<div class="method-heading">
|
|
257
|
+
<span class="method-name">auction_number</span><span
|
|
258
|
+
class="method-args">()</span>
|
|
259
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<div class="method-description">
|
|
264
|
+
|
|
265
|
+
<p>parsing method, returns a string</p>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<div class="method-source-code" id="auction_number-source">
|
|
270
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 126</span>
|
|
271
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">auction_number</span>
|
|
272
|
+
<span class="ruby-identifier">canonical_url_node</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_css</span>(<span class="ruby-string">'link[@rel = "canonical"]'</span>)
|
|
273
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Couldn't find canonical URL"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">canonical_url_node</span>
|
|
274
|
+
<span class="ruby-identifier">canonical_url_node</span>.<span class="ruby-identifier">attr</span>(<span class="ruby-string">'href'</span>)[<span class="ruby-regexp">%r\d+$/</span>]
|
|
275
|
+
<span class="ruby-keyword">end</span></pre>
|
|
276
|
+
</div><!-- auction_number-source -->
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
</div><!-- auction_number-method -->
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
<div id="method-i-complete-3F" class="method-detail ">
|
|
287
|
+
|
|
288
|
+
<div class="method-heading">
|
|
289
|
+
<span class="method-name">complete?</span><span
|
|
290
|
+
class="method-args">()</span>
|
|
291
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<div class="method-description">
|
|
296
|
+
|
|
297
|
+
<p>has bidding ended yet?</p>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
<div class="method-source-code" id="complete-3F-source">
|
|
302
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 29</span>
|
|
303
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">complete?</span>
|
|
304
|
+
<span class="ruby-identifier">complete_span</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-string">'//span[contains(text(), "Bidding has ended on this item")]'</span>)
|
|
305
|
+
<span class="ruby-keyword">return</span> (<span class="ruby-identifier">complete_span</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
|
|
306
|
+
<span class="ruby-keyword">end</span></pre>
|
|
307
|
+
</div><!-- complete-3F-source -->
|
|
308
|
+
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
</div><!-- complete-3F-method -->
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
<div id="method-i-current_bid" class="method-detail ">
|
|
318
|
+
|
|
319
|
+
<div class="method-heading">
|
|
320
|
+
<span class="method-name">current_bid</span><span
|
|
321
|
+
class="method-args">()</span>
|
|
322
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
<div class="method-description">
|
|
327
|
+
|
|
328
|
+
<p>parsing method, returns a string</p>
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
<div class="method-source-code" id="current_bid-source">
|
|
333
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 41</span>
|
|
334
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">current_bid</span>
|
|
335
|
+
<span class="ruby-comment"># list of ways to get the bid.</span>
|
|
336
|
+
<span class="ruby-identifier">xpaths</span> = [
|
|
337
|
+
<span class="ruby-string">"//th[contains(text(),'Current bid:')]"</span>,
|
|
338
|
+
<span class="ruby-string">"//th[contains(text(),'Starting bid:')]"</span>,
|
|
339
|
+
<span class="ruby-string">"//th[contains(text(),'Price:')]"</span>,
|
|
340
|
+
<span class="ruby-string">"//td[contains(text(),'Starting bid:')]"</span>,
|
|
341
|
+
<span class="ruby-string">"//td[contains(text(),'Winning bid:')]"</span>,
|
|
342
|
+
]
|
|
343
|
+
|
|
344
|
+
<span class="ruby-identifier">bid_node</span> = <span class="ruby-identifier">xpaths</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-keyword">nil</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span>, <span class="ruby-identifier">xpath</span><span class="ruby-operator">|</span>
|
|
345
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">nil?</span>
|
|
346
|
+
<span class="ruby-identifier">node</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-identifier">xpath</span>)
|
|
347
|
+
<span class="ruby-identifier">node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">next_sibling</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">nil?</span>
|
|
348
|
+
<span class="ruby-keyword">end</span>
|
|
349
|
+
<span class="ruby-identifier">node</span>
|
|
350
|
+
<span class="ruby-keyword">end</span>
|
|
351
|
+
|
|
352
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Couldn't find current/starting bid header in document"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">bid_node</span>.<span class="ruby-identifier">nil?</span>
|
|
353
|
+
<span class="ruby-identifier">bid_text</span> = <span class="ruby-identifier">node_text</span>(<span class="ruby-identifier">bid_node</span>)
|
|
354
|
+
<span class="ruby-identifier">bid_text</span> = <span class="ruby-identifier">bid_text</span>[<span class="ruby-regexp">%r^[^\[]+/</span>].<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">complete?</span>
|
|
355
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">bid_text</span>
|
|
356
|
+
<span class="ruby-keyword">end</span></pre>
|
|
357
|
+
</div><!-- current_bid-source -->
|
|
358
|
+
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
</div><!-- current_bid-method -->
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
<div id="method-i-description" class="method-detail ">
|
|
368
|
+
|
|
369
|
+
<div class="method-heading">
|
|
370
|
+
<span class="method-name">description</span><span
|
|
371
|
+
class="method-args">()</span>
|
|
372
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
<div class="method-description">
|
|
377
|
+
|
|
378
|
+
<p>parsing method, returns a string</p>
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
<div class="method-source-code" id="description-source">
|
|
383
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 66</span>
|
|
384
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">description</span>
|
|
385
|
+
<span class="ruby-identifier">desc</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_css</span>(<span class="ruby-string">'h1.vi-is1-titleH1'</span>)
|
|
386
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Couldn't find description in document"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">desc</span>.<span class="ruby-identifier">nil?</span>
|
|
387
|
+
<span class="ruby-identifier">desc</span>.<span class="ruby-identifier">inner_text</span>.<span class="ruby-identifier">strip</span>
|
|
388
|
+
<span class="ruby-keyword">end</span></pre>
|
|
389
|
+
</div><!-- description-source -->
|
|
390
|
+
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
</div><!-- description-method -->
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
<div id="method-i-end_time" class="method-detail ">
|
|
400
|
+
|
|
401
|
+
<div class="method-heading">
|
|
402
|
+
<span class="method-name">end_time</span><span
|
|
403
|
+
class="method-args">()</span>
|
|
404
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<div class="method-description">
|
|
409
|
+
|
|
410
|
+
<p>parsing method, returns a Time object</p>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
<div class="method-source-code" id="end_time-source">
|
|
415
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 113</span>
|
|
416
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">end_time</span>
|
|
417
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">node_text</span>(<span class="ruby-identifier">time_node</span>)
|
|
418
|
+
<span class="ruby-identifier">md</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r\(([^)]*)\)/</span>)
|
|
419
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">md</span>
|
|
420
|
+
<span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">md</span>[<span class="ruby-value">1</span>]
|
|
421
|
+
<span class="ruby-keyword">else</span>
|
|
422
|
+
<span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">text</span>
|
|
423
|
+
<span class="ruby-keyword">end</span>
|
|
424
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_str</span>
|
|
425
|
+
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">time_str</span>)
|
|
426
|
+
<span class="ruby-keyword">end</span></pre>
|
|
427
|
+
</div><!-- end_time-source -->
|
|
428
|
+
|
|
429
|
+
</div>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
</div><!-- end_time-method -->
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
<div id="method-i-has_bid_button-3F" class="method-detail ">
|
|
438
|
+
|
|
439
|
+
<div class="method-heading">
|
|
440
|
+
<span class="method-name">has_bid_button?</span><span
|
|
441
|
+
class="method-args">()</span>
|
|
442
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
443
|
+
</div>
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
<div class="method-description">
|
|
447
|
+
|
|
448
|
+
<p>parsming method, returns boolean</p>
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
<div class="method-source-code" id="has_bid_button-3F-source">
|
|
453
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 133</span>
|
|
454
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">has_bid_button?</span>
|
|
455
|
+
<span class="ruby-identifier">place_bid_button</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-string">'//form//input[@value="Place bid"]'</span>)
|
|
456
|
+
<span class="ruby-keyword">return</span> (<span class="ruby-identifier">place_bid_button</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
|
|
457
|
+
<span class="ruby-keyword">end</span></pre>
|
|
458
|
+
</div><!-- has_bid_button-3F-source -->
|
|
459
|
+
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
</div><!-- has_bid_button-3F-method -->
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
<div id="method-i-min_bid" class="method-detail ">
|
|
469
|
+
|
|
470
|
+
<div class="method-heading">
|
|
471
|
+
<span class="method-name">min_bid</span><span
|
|
472
|
+
class="method-args">()</span>
|
|
473
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
474
|
+
</div>
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
<div class="method-description">
|
|
478
|
+
|
|
479
|
+
<p>parsing method, returns a float</p>
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
<div class="method-source-code" id="min_bid-source">
|
|
484
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 102</span>
|
|
485
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">min_bid</span>
|
|
486
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">complete?</span>
|
|
487
|
+
|
|
488
|
+
<span class="ruby-identifier">min_bid_node</span> = <span class="ruby-ivar">@doc</span>.<span class="ruby-identifier">at_css</span>(<span class="ruby-string">'form.vi-is1-s4-eu span.vi-c-fsmt'</span>)
|
|
489
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Couldn't find minimum bid in document"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">min_bid_node</span>
|
|
490
|
+
<span class="ruby-identifier">match_data</span> = <span class="ruby-identifier">min_bid_node</span>.<span class="ruby-identifier">inner_text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%rEnter ([^)]*) or more/</span>)
|
|
491
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-node">"Min Bid data not in expected format. Got: #{min_bid_node.inner_text}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">match_data</span>.<span class="ruby-identifier">nil?</span>
|
|
492
|
+
<span class="ruby-identifier">match_data</span>[<span class="ruby-value">1</span>]
|
|
493
|
+
<span class="ruby-keyword">end</span></pre>
|
|
494
|
+
</div><!-- min_bid-source -->
|
|
495
|
+
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
</div><!-- min_bid-method -->
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
<div id="method-i-refresh_doc" class="method-detail ">
|
|
505
|
+
|
|
506
|
+
<div class="method-heading">
|
|
507
|
+
<span class="method-name">refresh_doc</span><span
|
|
508
|
+
class="method-args">()</span>
|
|
509
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
510
|
+
</div>
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
<div class="method-description">
|
|
514
|
+
|
|
515
|
+
<p>fetch the url again</p>
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
<div class="method-source-code" id="refresh_doc-source">
|
|
520
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 35</span>
|
|
521
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">refresh_doc</span>
|
|
522
|
+
<span class="ruby-ivar">@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-ivar">@url</span>))
|
|
523
|
+
<span class="ruby-ivar">@last_updated</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
|
524
|
+
<span class="ruby-keyword">end</span></pre>
|
|
525
|
+
</div><!-- refresh_doc-source -->
|
|
526
|
+
|
|
527
|
+
</div>
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
</div><!-- refresh_doc-method -->
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
<div id="method-i-time_left" class="method-detail ">
|
|
536
|
+
|
|
537
|
+
<div class="method-heading">
|
|
538
|
+
<span class="method-name">time_left</span><span
|
|
539
|
+
class="method-args">()</span>
|
|
540
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
541
|
+
</div>
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
<div class="method-description">
|
|
545
|
+
|
|
546
|
+
<p>parsing method, returns a string</p>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
<div class="method-source-code" id="time_left-source">
|
|
551
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 73</span>
|
|
552
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">time_left</span>
|
|
553
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">complete?</span>
|
|
554
|
+
|
|
555
|
+
<span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">node_text</span>(<span class="ruby-identifier">time_node</span>)
|
|
556
|
+
<span class="ruby-identifier">time_str</span> = <span class="ruby-identifier">time_str</span>[<span class="ruby-regexp">%r^[^(]*/</span>].<span class="ruby-identifier">strip</span>
|
|
557
|
+
<span class="ruby-identifier">time_ar</span> = <span class="ruby-identifier">time_str</span>.<span class="ruby-identifier">split</span>
|
|
558
|
+
|
|
559
|
+
<span class="ruby-comment"># time_ar comes to us looking like</span>
|
|
560
|
+
<span class="ruby-comment"># ["2d", "05h"] or ["0", "h", "12", "m", "5", "s"]</span>
|
|
561
|
+
<span class="ruby-comment"># decide which, and roll with it...</span>
|
|
562
|
+
|
|
563
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">0</span>][<span class="ruby-regexp">%r^\d+d$/</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>][<span class="ruby-regexp">%r^\d+h$/</span>]
|
|
564
|
+
<span class="ruby-comment"># ["2d", "05h"] style</span>
|
|
565
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">time_ar</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
|
566
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r^days?$/</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r^hours?$/</span>
|
|
567
|
+
<span class="ruby-comment"># ["1", "day", "18", "hours"]</span>
|
|
568
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">time_ar</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
|
569
|
+
<span class="ruby-keyword">else</span>
|
|
570
|
+
<span class="ruby-comment"># assume ["0", "h", "12", "m", "5", "s"] style</span>
|
|
571
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Didn't find hour marker where expected"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'h'</span>
|
|
572
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Didn't find minute marker where expected"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'m'</span>
|
|
573
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuctionParseError</span>, <span class="ruby-string">"Didn't find second marker where expected"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'s'</span>
|
|
574
|
+
<span class="ruby-keyword">return</span> [ <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">1</span>],
|
|
575
|
+
<span class="ruby-identifier">time_ar</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">3</span>],
|
|
576
|
+
<span class="ruby-identifier">time_ar</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">time_ar</span>[<span class="ruby-value">5</span>] ].<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
|
577
|
+
<span class="ruby-keyword">end</span>
|
|
578
|
+
<span class="ruby-keyword">end</span></pre>
|
|
579
|
+
</div><!-- time_left-source -->
|
|
580
|
+
|
|
581
|
+
</div>
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
</div><!-- time_left-method -->
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
<div id="method-i-valid_auction-3F" class="method-detail ">
|
|
590
|
+
|
|
591
|
+
<div class="method-heading">
|
|
592
|
+
<span class="method-name">valid_auction?</span><span
|
|
593
|
+
class="method-args">()</span>
|
|
594
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
595
|
+
</div>
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
<div class="method-description">
|
|
599
|
+
|
|
600
|
+
<p>can we represent this auction?</p>
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
<div class="method-source-code" id="valid_auction-3F-source">
|
|
605
|
+
<pre><span class="ruby-comment"># File lib/beway/auction.rb, line 23</span>
|
|
606
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valid_auction?</span>
|
|
607
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">complete?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">has_bid_button?</span>
|
|
608
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
|
|
609
|
+
<span class="ruby-keyword">end</span></pre>
|
|
610
|
+
</div><!-- valid_auction-3F-source -->
|
|
611
|
+
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
</div><!-- valid_auction-3F-method -->
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
</section><!-- public-instance-method-details -->
|
|
621
|
+
|
|
622
|
+
</section><!-- 5Buntitled-5D -->
|
|
623
|
+
|
|
624
|
+
</div><!-- documentation -->
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
<footer id="validator-badges">
|
|
628
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
629
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
630
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
631
|
+
</footer>
|
|
818
632
|
|