Class: Goodwill::BiddingAuction

Inherits:
Auction
  • Object
show all
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

Instance Method Summary collapse

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.

[View source]

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

#biddingObject (readonly)

Returns the value of attribute bidding.


7
8
9
# File 'lib/goodwill/biddingauction.rb', line 7

def bidding
  @bidding
end

#bidsObject (readonly)

TODO: why do i need this?


12
13
14
# File 'lib/goodwill/biddingauction.rb', line 12

def bids
  @bids
end

#currentObject (readonly)

Returns the value of attribute current.


13
14
15
# File 'lib/goodwill/biddingauction.rb', line 13

def current
  @current
end

#endObject (readonly)

Returns the value of attribute end.


14
15
16
# File 'lib/goodwill/biddingauction.rb', line 14

def end
  @end
end

#hrefObject (readonly)

Returns the value of attribute href.


15
16
17
# File 'lib/goodwill/biddingauction.rb', line 15

def href
  @href
end

#itemObject (readonly)

Returns the value of attribute item.


16
17
18
# File 'lib/goodwill/biddingauction.rb', line 16

def item
  @item
end

#itemidObject (readonly)

Returns the value of attribute itemid.


17
18
19
# File 'lib/goodwill/biddingauction.rb', line 17

def itemid
  @itemid
end

#maxObject (readonly)

Returns the value of attribute max.


9
10
11
# File 'lib/goodwill/biddingauction.rb', line 9

def max
  @max
end

#sellerObject (readonly)

Returns the value of attribute seller.


18
19
20
# File 'lib/goodwill/biddingauction.rb', line 18

def seller
  @seller
end

#winningObject (readonly)

Returns the value of attribute winning.


8
9
10
# File 'lib/goodwill/biddingauction.rb', line 8

def winning
  @winning
end