beway 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +34 -0
- data/README +43 -0
- data/README.rdoc +43 -0
- data/Rakefile +19 -0
- data/bin/beway +5 -0
- data/doc/Beway.html +185 -0
- data/doc/Beway/Auction.html +802 -0
- data/doc/Beway/AuctionParseError.html +160 -0
- data/doc/Beway/Bidder.html +531 -0
- data/doc/Beway/BidderError.html +160 -0
- data/doc/Beway/CliRunner.html +817 -0
- data/doc/Beway/EbayData.html +453 -0
- data/doc/Beway/EbayDataParseError.html +160 -0
- data/doc/Beway/InvalidUrlError.html +160 -0
- data/doc/README.html +175 -0
- data/doc/created.rid +6 -0
- data/doc/index.html +225 -0
- data/doc/lib/beway/auction_rb.html +56 -0
- data/doc/lib/beway/bidder_rb.html +54 -0
- data/doc/lib/beway/cli_runner_rb.html +52 -0
- data/doc/lib/beway/ebay_data_rb.html +58 -0
- data/doc/rdoc.css +706 -0
- data/lib/beway.rb +4 -0
- data/lib/beway/auction.rb +150 -0
- data/lib/beway/bidder.rb +100 -0
- data/lib/beway/cli_runner.rb +184 -0
- data/lib/beway/ebay_data.rb +66 -0
- data/spec/auction_spec.rb +163 -0
- data/spec/bidder_spec.rb +30 -0
- data/spec/config.rb +4 -0
- data/spec/config.rb-dist +4 -0
- data/spec/ebay_data_spec.rb +23 -0
- data/spec/html/alfani-sweater-complete.html +39 -0
- data/spec/html/cashmere-sweater-complete.html +39 -0
- data/spec/html/cashmere-sweater.html +84 -0
- data/spec/html/mens-cardigans-dutch-bin.html +192 -0
- data/spec/html/pink-sweater-bid-bin.html +68 -0
- data/spec/html/polo-lambs-wool.html +150 -0
- data/spec/html/spring-mercer-bin-mo.html +533 -0
- data/spec/html/xmas-sweater.html +260 -0
- metadata +192 -0
@@ -0,0 +1,160 @@
|
|
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::AuctionParseError</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/auction_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/beway/auction.rb">lib/beway/auction.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">StandardError</p>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace Contents -->
|
64
|
+
|
65
|
+
|
66
|
+
<!-- Method Quickref -->
|
67
|
+
|
68
|
+
|
69
|
+
<!-- Included Modules -->
|
70
|
+
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div id="project-metadata">
|
74
|
+
|
75
|
+
|
76
|
+
<div id="fileindex-section" class="section project-section">
|
77
|
+
<h3 class="section-header">Files</h3>
|
78
|
+
<ul>
|
79
|
+
|
80
|
+
<li class="file"><a href="../README.html">README</a></li>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
<div id="classindex-section" class="section project-section">
|
87
|
+
<h3 class="section-header">Class Index
|
88
|
+
<span class="search-toggle"><img src="../images/find.png"
|
89
|
+
height="16" width="16" alt="[+]"
|
90
|
+
title="show/hide quicksearch" /></span></h3>
|
91
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
92
|
+
<fieldset>
|
93
|
+
<legend>Quicksearch</legend>
|
94
|
+
<input type="text" name="quicksearch" value=""
|
95
|
+
class="quicksearch-field" />
|
96
|
+
</fieldset>
|
97
|
+
</form>
|
98
|
+
|
99
|
+
<ul class="link-list">
|
100
|
+
|
101
|
+
<li><a href="../Beway.html">Beway</a></li>
|
102
|
+
|
103
|
+
<li><a href="../Beway/Auction.html">Beway::Auction</a></li>
|
104
|
+
|
105
|
+
<li><a href="../Beway/AuctionParseError.html">Beway::AuctionParseError</a></li>
|
106
|
+
|
107
|
+
<li><a href="../Beway/Bidder.html">Beway::Bidder</a></li>
|
108
|
+
|
109
|
+
<li><a href="../Beway/BidderError.html">Beway::BidderError</a></li>
|
110
|
+
|
111
|
+
<li><a href="../Beway/CliRunner.html">Beway::CliRunner</a></li>
|
112
|
+
|
113
|
+
<li><a href="../Beway/EbayData.html">Beway::EbayData</a></li>
|
114
|
+
|
115
|
+
<li><a href="../Beway/EbayDataParseError.html">Beway::EbayDataParseError</a></li>
|
116
|
+
|
117
|
+
<li><a href="../Beway/InvalidUrlError.html">Beway::InvalidUrlError</a></li>
|
118
|
+
|
119
|
+
</ul>
|
120
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="documentation">
|
128
|
+
<h1 class="class">Beway::AuctionParseError</h1>
|
129
|
+
|
130
|
+
<div id="description">
|
131
|
+
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<!-- Constants -->
|
135
|
+
|
136
|
+
|
137
|
+
<!-- Attributes -->
|
138
|
+
|
139
|
+
|
140
|
+
<!-- Methods -->
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
147
|
+
|
148
|
+
<p>Disabled; run with --debug to generate this.</p>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div id="validator-badges">
|
153
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
154
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
155
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</body>
|
159
|
+
</html>
|
160
|
+
|
@@ -0,0 +1,531 @@
|
|
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::Bidder</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/bidder_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/beway/bidder.rb">lib/beway/bidder.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-bid">#bid</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-handle_login_page">#handle_login_page</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-is_login_page%3F">#is_login_page?</a></li>
|
79
|
+
|
80
|
+
<li><a href="#method-i-login">#login</a></li>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
<!-- Included Modules -->
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<div id="project-metadata">
|
91
|
+
|
92
|
+
|
93
|
+
<div id="fileindex-section" class="section project-section">
|
94
|
+
<h3 class="section-header">Files</h3>
|
95
|
+
<ul>
|
96
|
+
|
97
|
+
<li class="file"><a href="../README.html">README</a></li>
|
98
|
+
|
99
|
+
</ul>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<div id="classindex-section" class="section project-section">
|
104
|
+
<h3 class="section-header">Class Index
|
105
|
+
<span class="search-toggle"><img src="../images/find.png"
|
106
|
+
height="16" width="16" alt="[+]"
|
107
|
+
title="show/hide quicksearch" /></span></h3>
|
108
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
109
|
+
<fieldset>
|
110
|
+
<legend>Quicksearch</legend>
|
111
|
+
<input type="text" name="quicksearch" value=""
|
112
|
+
class="quicksearch-field" />
|
113
|
+
</fieldset>
|
114
|
+
</form>
|
115
|
+
|
116
|
+
<ul class="link-list">
|
117
|
+
|
118
|
+
<li><a href="../Beway.html">Beway</a></li>
|
119
|
+
|
120
|
+
<li><a href="../Beway/Auction.html">Beway::Auction</a></li>
|
121
|
+
|
122
|
+
<li><a href="../Beway/AuctionParseError.html">Beway::AuctionParseError</a></li>
|
123
|
+
|
124
|
+
<li><a href="../Beway/Bidder.html">Beway::Bidder</a></li>
|
125
|
+
|
126
|
+
<li><a href="../Beway/BidderError.html">Beway::BidderError</a></li>
|
127
|
+
|
128
|
+
<li><a href="../Beway/CliRunner.html">Beway::CliRunner</a></li>
|
129
|
+
|
130
|
+
<li><a href="../Beway/EbayData.html">Beway::EbayData</a></li>
|
131
|
+
|
132
|
+
<li><a href="../Beway/EbayDataParseError.html">Beway::EbayDataParseError</a></li>
|
133
|
+
|
134
|
+
<li><a href="../Beway/InvalidUrlError.html">Beway::InvalidUrlError</a></li>
|
135
|
+
|
136
|
+
</ul>
|
137
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="documentation">
|
145
|
+
<h1 class="class">Beway::Bidder</h1>
|
146
|
+
|
147
|
+
<div id="description">
|
148
|
+
<p>
|
149
|
+
<a href="Bidder.html">Bidder</a>
|
150
|
+
</p>
|
151
|
+
<p>
|
152
|
+
Wrapper for Mechanize to perform actions on ebay
|
153
|
+
</p>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<!-- Constants -->
|
158
|
+
|
159
|
+
<div id="constants-list" class="section">
|
160
|
+
<h3 class="section-header">Constants</h3>
|
161
|
+
<dl>
|
162
|
+
|
163
|
+
<dt><a name="EBAY_HOME">EBAY_HOME</a></dt>
|
164
|
+
|
165
|
+
<dd class="description"></dd>
|
166
|
+
|
167
|
+
|
168
|
+
</dl>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<!-- Attributes -->
|
173
|
+
|
174
|
+
<div id="attribute-method-details" class="method-section section">
|
175
|
+
<h3 class="section-header">Attributes</h3>
|
176
|
+
|
177
|
+
|
178
|
+
<div id="username-attribute-method" class="method-detail">
|
179
|
+
<a name="username"></a>
|
180
|
+
|
181
|
+
<a name="username="></a>
|
182
|
+
|
183
|
+
<div class="method-heading attribute-method-heading">
|
184
|
+
<span class="method-name">username</span><span
|
185
|
+
class="attribute-access-type">[RW]</span>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="method-description">
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div id="password-attribute-method" class="method-detail">
|
196
|
+
<a name="password"></a>
|
197
|
+
|
198
|
+
<a name="password="></a>
|
199
|
+
|
200
|
+
<div class="method-heading attribute-method-heading">
|
201
|
+
<span class="method-name">password</span><span
|
202
|
+
class="attribute-access-type">[W]</span>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div class="method-description">
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div id="agent-attribute-method" class="method-detail">
|
213
|
+
<a name="agent"></a>
|
214
|
+
|
215
|
+
<div class="method-heading attribute-method-heading">
|
216
|
+
<span class="method-name">agent</span><span
|
217
|
+
class="attribute-access-type">[R]</span>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div class="method-description">
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div id="logged-in-attribute-method" class="method-detail">
|
228
|
+
<a name="logged_in"></a>
|
229
|
+
|
230
|
+
<div class="method-heading attribute-method-heading">
|
231
|
+
<span class="method-name">logged_in</span><span
|
232
|
+
class="attribute-access-type">[R]</span>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div id="last-login-time-attribute-method" class="method-detail">
|
243
|
+
<a name="last_login_time"></a>
|
244
|
+
|
245
|
+
<div class="method-heading attribute-method-heading">
|
246
|
+
<span class="method-name">last_login_time</span><span
|
247
|
+
class="attribute-access-type">[R]</span>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method-description">
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
<!-- Methods -->
|
261
|
+
|
262
|
+
<div id="public-class-method-details" class="method-section section">
|
263
|
+
<h3 class="section-header">Public Class Methods</h3>
|
264
|
+
|
265
|
+
|
266
|
+
<div id="new-method" class="method-detail ">
|
267
|
+
<a name="method-c-new"></a>
|
268
|
+
|
269
|
+
<div class="method-heading">
|
270
|
+
|
271
|
+
<span class="method-name">new</span><span
|
272
|
+
class="method-args">(username, password)</span>
|
273
|
+
<span class="method-click-advice">click to toggle source</span>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method-description">
|
278
|
+
|
279
|
+
<p>
|
280
|
+
create a bidder with login credentials
|
281
|
+
</p>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="method-source-code"
|
286
|
+
id="new-source">
|
287
|
+
<pre>
|
288
|
+
<span class="ruby-comment cmt"># File lib/beway/bidder.rb, line 19</span>
|
289
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>)
|
290
|
+
20: <span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
|
291
|
+
21: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
|
292
|
+
22: <span class="ruby-ivar">@agent</span> = <span class="ruby-constant">Mechanize</span>.<span class="ruby-identifier">new</span>
|
293
|
+
23: <span class="ruby-ivar">@logged_in</span> = <span class="ruby-keyword kw">false</span>
|
294
|
+
24: <span class="ruby-ivar">@last_login_time</span> = <span class="ruby-keyword kw">nil</span>
|
295
|
+
25: <span class="ruby-keyword kw">end</span></pre>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
<div id="public-instance-method-details" class="method-section section">
|
309
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
310
|
+
|
311
|
+
|
312
|
+
<div id="bid-method" class="method-detail ">
|
313
|
+
<a name="method-i-bid"></a>
|
314
|
+
|
315
|
+
<div class="method-heading">
|
316
|
+
|
317
|
+
<span class="method-name">bid</span><span
|
318
|
+
class="method-args">(auction_url, amount)</span>
|
319
|
+
<span class="method-click-advice">click to toggle source</span>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div class="method-description">
|
324
|
+
|
325
|
+
<p>
|
326
|
+
bid amount on given auction
|
327
|
+
</p>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<div class="method-source-code"
|
332
|
+
id="bid-source">
|
333
|
+
<pre>
|
334
|
+
<span class="ruby-comment cmt"># File lib/beway/bidder.rb, line 42</span>
|
335
|
+
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bid</span>(<span class="ruby-identifier">auction_url</span>, <span class="ruby-identifier">amount</span>)
|
336
|
+
43:
|
337
|
+
44: <span class="ruby-comment cmt"># get auction</span>
|
338
|
+
45: <span class="ruby-identifier">auction_page</span> = <span class="ruby-ivar">@agent</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">auction_url</span>)
|
339
|
+
46:
|
340
|
+
47: <span class="ruby-comment cmt"># get the bid form</span>
|
341
|
+
48: <span class="ruby-identifier">forms</span> = <span class="ruby-identifier">auction_page</span>.<span class="ruby-identifier">forms_with</span>( <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-regexp re">/http:\/\/offer\.ebay\.com\//</span> )
|
342
|
+
49: <span class="ruby-identifier">raise</span> <span class="ruby-constant">BidderError</span>, <span class="ruby-value str">"Couldn't find auction bid form"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">forms</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
|
343
|
+
50: <span class="ruby-identifier">bid_form</span> = <span class="ruby-identifier">forms</span>[<span class="ruby-value">0</span>]
|
344
|
+
51:
|
345
|
+
52: <span class="ruby-comment cmt"># fill in, submit bid form</span>
|
346
|
+
53: <span class="ruby-identifier">bid_form</span>.<span class="ruby-identifier">maxbid</span> = <span class="ruby-identifier">amount</span>
|
347
|
+
54: <span class="ruby-identifier">bid_response</span> = <span class="ruby-identifier">bid_form</span>.<span class="ruby-identifier">submit</span>
|
348
|
+
55:
|
349
|
+
56: <span class="ruby-comment cmt"># if given a login page, do it and get redirected to confirm bid</span>
|
350
|
+
57: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_login_page?</span>(<span class="ruby-identifier">bid_response</span>)
|
351
|
+
58: <span class="ruby-identifier">bid_response</span> = <span class="ruby-identifier">handle_login_page</span>(<span class="ruby-identifier">bid_response</span>)
|
352
|
+
59: <span class="ruby-keyword kw">end</span>
|
353
|
+
60:
|
354
|
+
61: <span class="ruby-comment cmt"># get confirm bid form</span>
|
355
|
+
62: <span class="ruby-identifier">forms</span> = <span class="ruby-identifier">bid_response</span>.<span class="ruby-identifier">forms_with</span>( <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http://offer.ebay.com/ws/eBayISAPI.dll'</span> )
|
356
|
+
63: <span class="ruby-identifier">raise</span> <span class="ruby-constant">BidderError</span>, <span class="ruby-value str">"Couldn't find confirm bid form"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">forms</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
|
357
|
+
64: <span class="ruby-identifier">confirm_form</span> = <span class="ruby-identifier">forms</span>[<span class="ruby-value">0</span>]
|
358
|
+
65:
|
359
|
+
66: <span class="ruby-comment cmt"># click confirm button</span>
|
360
|
+
67: <span class="ruby-identifier">confirm_button</span> = <span class="ruby-identifier">confirm_form</span>.<span class="ruby-identifier">button_with</span>( <span class="ruby-value">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'Confirm Bid'</span> )
|
361
|
+
68: <span class="ruby-identifier">raise</span> <span class="ruby-constant">BidderError</span>, <span class="ruby-value str">"Couldn't find confirm bid button"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">confirm_button</span>
|
362
|
+
69: <span class="ruby-identifier">confirm_response</span> = <span class="ruby-identifier">confirm_form</span>.<span class="ruby-identifier">submit</span>( <span class="ruby-identifier">confirm_button</span> )
|
363
|
+
70:
|
364
|
+
71: <span class="ruby-identifier">confirm_response</span>
|
365
|
+
72: <span class="ruby-keyword kw">end</span></pre>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
</div>
|
374
|
+
|
375
|
+
|
376
|
+
<div id="login-method" class="method-detail ">
|
377
|
+
<a name="method-i-login"></a>
|
378
|
+
|
379
|
+
<div class="method-heading">
|
380
|
+
|
381
|
+
<span class="method-name">login</span><span
|
382
|
+
class="method-args">()</span>
|
383
|
+
<span class="method-click-advice">click to toggle source</span>
|
384
|
+
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div class="method-description">
|
388
|
+
|
389
|
+
<p>
|
390
|
+
log user in with credentials. returns boolean representing success
|
391
|
+
</p>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<div class="method-source-code"
|
396
|
+
id="login-source">
|
397
|
+
<pre>
|
398
|
+
<span class="ruby-comment cmt"># File lib/beway/bidder.rb, line 29</span>
|
399
|
+
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login</span>
|
400
|
+
30: <span class="ruby-identifier">ebay_home_page</span> = <span class="ruby-ivar">@agent</span>.<span class="ruby-identifier">get</span>(<span class="ruby-constant">EBAY_HOME</span>)
|
401
|
+
31:
|
402
|
+
32: <span class="ruby-identifier">sign_in_link</span> = <span class="ruby-identifier">ebay_home_page</span>.<span class="ruby-identifier">link_with</span>( <span class="ruby-value">:text</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'Sign in'</span> )
|
403
|
+
33: <span class="ruby-identifier">raise</span> <span class="ruby-constant">BidderError</span>, <span class="ruby-value str">"Couldn't find sign in link"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sign_in_link</span>
|
404
|
+
34: <span class="ruby-identifier">login_page</span> = <span class="ruby-identifier">sign_in_link</span>.<span class="ruby-identifier">click</span>
|
405
|
+
35:
|
406
|
+
36: <span class="ruby-identifier">handle_login_page</span>(<span class="ruby-identifier">login_page</span>)
|
407
|
+
37:
|
408
|
+
38: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@logged_in</span>
|
409
|
+
39: <span class="ruby-keyword kw">end</span></pre>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
</div>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
</div>
|
418
|
+
|
419
|
+
|
420
|
+
</div>
|
421
|
+
|
422
|
+
<div id="private-instance-method-details" class="method-section section">
|
423
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
424
|
+
|
425
|
+
|
426
|
+
<div id="handle-login-page-method" class="method-detail ">
|
427
|
+
<a name="method-i-handle_login_page"></a>
|
428
|
+
|
429
|
+
<div class="method-heading">
|
430
|
+
|
431
|
+
<span class="method-name">handle_login_page</span><span
|
432
|
+
class="method-args">(login_page)</span>
|
433
|
+
<span class="method-click-advice">click to toggle source</span>
|
434
|
+
|
435
|
+
</div>
|
436
|
+
|
437
|
+
<div class="method-description">
|
438
|
+
|
439
|
+
<p>
|
440
|
+
log into ebay as prompted by login_page
|
441
|
+
</p>
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<div class="method-source-code"
|
446
|
+
id="handle-login-page-source">
|
447
|
+
<pre>
|
448
|
+
<span class="ruby-comment cmt"># File lib/beway/bidder.rb, line 86</span>
|
449
|
+
86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_login_page</span>(<span class="ruby-identifier">login_page</span>)
|
450
|
+
87: <span class="ruby-identifier">login_form</span> = <span class="ruby-identifier">login_page</span>.<span class="ruby-identifier">form_with</span>( <span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'SignInForm'</span>)
|
451
|
+
88: <span class="ruby-identifier">raise</span> <span class="ruby-constant">BidderError</span>, <span class="ruby-value str">"Couldn't find login form"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">login_form</span>
|
452
|
+
89: <span class="ruby-identifier">login_form</span>.<span class="ruby-identifier">userid</span> = <span class="ruby-ivar">@username</span>
|
453
|
+
90: <span class="ruby-identifier">login_form</span>.<span class="ruby-identifier">pass</span> = <span class="ruby-ivar">@password</span>
|
454
|
+
91: <span class="ruby-identifier">login_response</span> = <span class="ruby-identifier">login_form</span>.<span class="ruby-identifier">submit</span>
|
455
|
+
92:
|
456
|
+
93: <span class="ruby-ivar">@logged_in</span> = <span class="ruby-identifier">login_response</span>.<span class="ruby-identifier">search</span>(<span class="ruby-value str">'form#SignInForm'</span>).<span class="ruby-identifier">empty?</span>
|
457
|
+
94: <span class="ruby-ivar">@last_login_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@logged_in</span>
|
458
|
+
95:
|
459
|
+
96: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">login_response</span>
|
460
|
+
97: <span class="ruby-keyword kw">end</span></pre>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
</div>
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
</div>
|
469
|
+
|
470
|
+
|
471
|
+
<div id="is-login-page--method" class="method-detail ">
|
472
|
+
<a name="method-i-is_login_page%3F"></a>
|
473
|
+
|
474
|
+
<div class="method-heading">
|
475
|
+
|
476
|
+
<span class="method-name">is_login_page?</span><span
|
477
|
+
class="method-args">(page)</span>
|
478
|
+
<span class="method-click-advice">click to toggle source</span>
|
479
|
+
|
480
|
+
</div>
|
481
|
+
|
482
|
+
<div class="method-description">
|
483
|
+
|
484
|
+
<p>
|
485
|
+
is page a login page?
|
486
|
+
</p>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
<div class="method-source-code"
|
491
|
+
id="is-login-page--source">
|
492
|
+
<pre>
|
493
|
+
<span class="ruby-comment cmt"># File lib/beway/bidder.rb, line 77</span>
|
494
|
+
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_login_page?</span>(<span class="ruby-identifier">page</span>)
|
495
|
+
78: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">form_with</span>( <span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'SignInForm'</span>)
|
496
|
+
79: <span class="ruby-keyword kw">true</span>
|
497
|
+
80: <span class="ruby-keyword kw">else</span>
|
498
|
+
81: <span class="ruby-keyword kw">false</span>
|
499
|
+
82: <span class="ruby-keyword kw">end</span>
|
500
|
+
83: <span class="ruby-keyword kw">end</span></pre>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
</div>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
</div>
|
509
|
+
|
510
|
+
|
511
|
+
</div>
|
512
|
+
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
518
|
+
|
519
|
+
<p>Disabled; run with --debug to generate this.</p>
|
520
|
+
|
521
|
+
</div>
|
522
|
+
|
523
|
+
<div id="validator-badges">
|
524
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
525
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
526
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
</body>
|
530
|
+
</html>
|
531
|
+
|