Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
got working with quibids again
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Schultheis committed Jan 27, 2013
1 parent affe522 commit 4f9cd1e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
csv

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source :rubygems
gem 'watir-webdriver'
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
GEM
remote: http://rubygems.org/
specs:
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
ffi (1.3.1)
multi_json (1.5.0)
rubyzip (0.9.9)
selenium-webdriver (2.29.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
watir-webdriver (0.6.2)
selenium-webdriver (>= 2.18.0)
websocket (1.0.6)

PLATFORMS
ruby

DEPENDENCIES
watir-webdriver
3 changes: 3 additions & 0 deletions bots/csv_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

### HELPERS
def init_csv filename
unless File.directory? 'csv'
Dir.mkdir 'csv'
end
filename = 'csv/' + filename + '.' + Time.now.strftime("%m%d%Y_%H%M") + '.csv'
@csv_writer = File.open(filename, 'w')
puts "Opened csv '#{filename}'"
Expand Down
29 changes: 15 additions & 14 deletions site_bindings/quibids.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def goto_auction
end

def auction_name
name = @browser.title
name = @browser.title.split(' -')[0]
puts "auction name is '#{name}'"
name
end
Expand All @@ -29,10 +29,10 @@ def initialize_auction
#init some data
@last_amt = -1.0
@auction_els = {
:timer => @browser.div(:class => /timer2/ ),
:history => @browser.div(:id => 'bidding-history' ).table,
:timer => @browser.p(:class => 'large-timer2'),
:history => @browser.table(:id => 'bid-history'),
#:bid_btn => @browser.link(:class => /^bid/ ),
:bid_btn => @browser.link(:id => "button_#{@auction_id}" ),
:bid_btn => @browser.link(:text => "Bid Now"),
}

#confirm all the elements are accessible
Expand Down Expand Up @@ -102,15 +102,16 @@ def seconds_left
def get_new_bids
cur_amt = @last_amt
bids = []
@auction_els[:history].hashes.reverse.each do |bid_row|
new_bid = {
:bidder => bid_row['BIDDER'],
:amt => bid_row['BID'].pa_calc_amt,
:type => bid_row['TYPE'] =~ /BidOMatic/ ? :automatic : :manual,
}
if new_bid[:amt] > @last_amt
bids << new_bid
@last_amt = new_bid[:amt]
@auction_els[:history].rows.to_a.reverse.each do |bid_row|
x, bidder, amt, type = bid_row.cells.to_a.map {|c| c.text}
amt = amt.pa_calc_amt
if amt > @last_amt
bids << {
:bidder => bidder,
:amt => amt,
:type => type,
}
@last_amt = amt
end
end
bids
Expand All @@ -124,4 +125,4 @@ def login username, password
@logged_in = true
end

end
end

0 comments on commit 4f9cd1e

Please sign in to comment.