Class: Goodwill::Auction
- Inherits:
-
Object
- Object
- Goodwill::Auction
- Defined in:
- lib/goodwill/auction.rb
Direct Known Subclasses
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
-
#bids ⇒ Object
readonly
Returns the value of attribute bids.
-
#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.
-
#seller ⇒ Object
readonly
Returns the value of attribute seller.
Instance Method Summary collapse
- #==(another_auction) ⇒ Object
-
#initialize(itemid = nil) ⇒ Auction
constructor
A new instance of Auction.
Methods included from Mechanize
logged_in?, login, #mechanize, mechanize
Constructor Details
permalink #initialize(itemid = nil) ⇒ Auction
Returns a new instance of Auction.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/goodwill/auction.rb', line 21 def initialize(itemid = nil) @href = ITEM_SEARCH_URL + itemid.to_s @itemid = itemid item_page = mechanize.get(@href) @bids = item_page.search(BIDS_PATH).text[/\d+/] @current = item_page.search(CURRENT_PRICE_PATH).text @end = item_page.search(END_TIME_PATH).text @item = item_page.search(ITEM_TITLE_PATH).text @seller = item_page.search(SELLER_PATH).text @bidding = false end |
Instance Attribute Details
permalink #bids ⇒ Object (readonly)
Returns the value of attribute bids.
13 14 15 |
# File 'lib/goodwill/auction.rb', line 13 def bids @bids end |
permalink #current ⇒ Object (readonly)
Returns the value of attribute current.
14 15 16 |
# File 'lib/goodwill/auction.rb', line 14 def current @current end |
permalink #end ⇒ Object (readonly)
Returns the value of attribute end.
15 16 17 |
# File 'lib/goodwill/auction.rb', line 15 def end @end end |
permalink #href ⇒ Object (readonly)
Returns the value of attribute href.
16 17 18 |
# File 'lib/goodwill/auction.rb', line 16 def href @href end |
permalink #item ⇒ Object (readonly)
Returns the value of attribute item.
17 18 19 |
# File 'lib/goodwill/auction.rb', line 17 def item @item end |
permalink #itemid ⇒ Object (readonly)
Returns the value of attribute itemid.
18 19 20 |
# File 'lib/goodwill/auction.rb', line 18 def itemid @itemid end |
permalink #seller ⇒ Object (readonly)
Returns the value of attribute seller.
19 20 21 |
# File 'lib/goodwill/auction.rb', line 19 def seller @seller end |
Instance Method Details
permalink #==(another_auction) ⇒ Object
[View source]
33 34 35 |
# File 'lib/goodwill/auction.rb', line 33 def ==(another_auction) self.itemid == another_auction.itemid end |