Class: Goodwill::BiddingAuction
- Includes:
- URLPaths
- Defined in:
- lib/goodwill/biddingauction.rb
Constant Summary
Constants included from URLPaths
URLPaths::BID_URL, URLPaths::ITEM_SEARCH_URL, URLPaths::LOGIN_URL, URLPaths::OPEN_ORDERS_URL, URLPaths::SEARCH_URL, URLPaths::SHIPPING_URL
Constants included from CSSPaths
CSSPaths::BIDS_PATH, CSSPaths::BIN_END_TIME_PATH, CSSPaths::BUY_IT_NOW_PATH, CSSPaths::CURRENT_PRICE_PATH, CSSPaths::END_TIME_PATH, CSSPaths::IN_PROGRESS_ROWS, CSSPaths::ITEMID_PATH, CSSPaths::ITEMS_COUNT_PATH, CSSPaths::ITEM_TITLE_PATH, CSSPaths::NO_ITEMS_FOUND_PATH, CSSPaths::SEARCH_ROWS, CSSPaths::SELLER_ID_LINK, CSSPaths::SELLER_PATH, CSSPaths::SHIPPING_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.
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
-
#winning ⇒ Object
readonly
Returns the value of attribute winning.
Attributes inherited from Auction
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
#initialize(itemid, mechanize) ⇒ BiddingAuction
Returns a new instance of BiddingAuction.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/goodwill/biddingauction.rb', line 14 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 = !row.search('td:nth-child(5) > i').empty? @max = row.search('td:nth-child(5)').text.tr("\r\n", '').tr(' ', '').tr('$', '') else @bidding = false @winning = false @max = '$0.00' end end |
Instance Attribute Details
#bidding ⇒ Object (readonly)
Returns the value of attribute bidding.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def bidding @bidding end |
#bids ⇒ Object (readonly)
TODO: why do i need this?
12 13 14 |
# File 'lib/goodwill/biddingauction.rb', line 12 def bids @bids end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def current @current end |
#end ⇒ Object (readonly)
Returns the value of attribute end.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def end @end end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def href @href end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def item @item end |
#itemid ⇒ Object (readonly)
Returns the value of attribute itemid.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def itemid @itemid end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def max @max end |
#seller ⇒ Object (readonly)
Returns the value of attribute seller.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def seller @seller end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def shipping @shipping end |
#winning ⇒ Object (readonly)
Returns the value of attribute winning.
9 10 11 |
# File 'lib/goodwill/biddingauction.rb', line 9 def winning @winning end |