Class: Goodwill::BiddingAuction

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

Attributes inherited from Auction

#item_page, #type

Instance Method Summary collapse

Methods inherited from Auction

#==, #to_hash

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

#biddingObject (readonly)

Returns the value of attribute bidding.



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

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.



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

def current
  @current
end

#endObject (readonly)

Returns the value of attribute end.



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

def end
  @end
end

#hrefObject (readonly)

Returns the value of attribute href.



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

def href
  @href
end

#itemObject (readonly)

Returns the value of attribute item.



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

def item
  @item
end

#itemidObject (readonly)

Returns the value of attribute itemid.



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

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.



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

def seller
  @seller
end

#shippingObject (readonly)

Returns the value of attribute shipping.



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

def shipping
  @shipping
end

#winningObject (readonly)

Returns the value of attribute winning.



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

def winning
  @winning
end