Class: Goodwill::BiddingAuction
- Includes:
- URLPaths
- Defined in:
- lib/goodwill/biddingauction.rb
Constant Summary
Constants included from URLPaths
URLPaths::ITEM_SEARCH_URL, URLPaths::LOGIN_URL, URLPaths::OPEN_ORDERS_URL, URLPaths::SEARCH_URL
Constants included from CSSPaths
CSSPaths::BIDS_PATH, CSSPaths::CURRENT_PRICE_PATH, CSSPaths::END_TIME_PATH, CSSPaths::ITEMID_PATH, CSSPaths::ITEM_TITLE_PATH, CSSPaths::SELLER_PATH
Instance Attribute Summary collapse
-
#bidding ⇒ Object
readonly
Returns the value of attribute bidding.
-
#bids ⇒ Object
readonly
TODO: why do i need this?.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#itemid ⇒ Object
readonly
Returns the value of attribute itemid.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#seller ⇒ Object
readonly
Returns the value of attribute seller.
-
#winning ⇒ Object
readonly
Returns the value of attribute winning.
Instance Method Summary collapse
-
#initialize(itemid, mechanize) ⇒ BiddingAuction
constructor
A new instance of BiddingAuction.
Methods inherited from Auction
Methods included from Mechanize
logged_in?, login, #mechanize, mechanize
Constructor Details
permalink #initialize(itemid, mechanize) ⇒ BiddingAuction
Returns a new instance of BiddingAuction.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/goodwill/biddingauction.rb', line 20 def initialize(itemid, mechanize) super(itemid) order_page = mechanize.get(OPEN_ORDERS_URL) if order_page.link_with(text: regqt(itemid.to_s)) @bidding = true row = order_page.link_with(text: regqt(itemid.to_s)).node.parent.parent @winning = happy?(row.search('img').attr('src').value) @max = row.search('td:nth-child(5)').text else @bidding = false @winning = false @max = '$0.00' end end |
Instance Attribute Details
permalink #bidding ⇒ Object (readonly)
Returns the value of attribute bidding.
7 8 9 |
# File 'lib/goodwill/biddingauction.rb', line 7 def bidding @bidding end |
permalink #bids ⇒ Object (readonly)
TODO: why do i need this?
12 13 14 |
# File 'lib/goodwill/biddingauction.rb', line 12 def bids @bids end |
permalink #current ⇒ Object (readonly)
Returns the value of attribute current.
13 14 15 |
# File 'lib/goodwill/biddingauction.rb', line 13 def current @current end |
permalink #end ⇒ Object (readonly)
Returns the value of attribute end.
14 15 16 |
# File 'lib/goodwill/biddingauction.rb', line 14 def end @end end |
permalink #href ⇒ Object (readonly)
Returns the value of attribute href.
15 16 17 |
# File 'lib/goodwill/biddingauction.rb', line 15 def href @href end |
permalink #item ⇒ Object (readonly)
Returns the value of attribute item.
16 17 18 |
# File 'lib/goodwill/biddingauction.rb', line 16 def item @item end |
permalink #itemid ⇒ Object (readonly)
Returns the value of attribute itemid.
17 18 19 |
# File 'lib/goodwill/biddingauction.rb', line 17 def itemid @itemid end |
permalink #max ⇒ Object (readonly)
Returns the value of attribute max.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def max @max end |
permalink #seller ⇒ Object (readonly)
Returns the value of attribute seller.
18 19 20 |
# File 'lib/goodwill/biddingauction.rb', line 18 def seller @seller end |
permalink #winning ⇒ Object (readonly)
Returns the value of attribute winning.
8 9 10 |
# File 'lib/goodwill/biddingauction.rb', line 8 def winning @winning end |