lib/goodwill/auction.rb in goodwill-0.4.0 vs lib/goodwill/auction.rb in goodwill-0.4.1

- old
+ new

@@ -13,22 +13,12 @@ class Auction include Goodwill::Mechanize include CSSPaths include URLPaths - attr_reader :item_page + attr_reader :item_page, :bids, :current, :end, :href, :item, :itemid, :seller, :shipping, :type - attr_reader :bids - attr_reader :current - attr_reader :end - attr_reader :href - attr_reader :item - attr_reader :itemid - attr_reader :seller - attr_reader :shipping - attr_reader :type - def initialize(itemid, zipcode = '97222', state = 'OR', country = 'US') @itemid = itemid @zipcode = zipcode @state = state @country = country @@ -68,9 +58,12 @@ def calculate_shipping(itemid, zipcode, country) params = "?ZipCode=#{zipcode}&Country=#{country}&ItemId=#{itemid}&Quantity=1&_=#{DateTime.now.strftime('%s')}" page = mechanize.get(SHIPPING_URL + params) page.search(SHIPPING_PATH).text.split(': ').last.tr('$', '').to_f + rescue StandardError + puts "Timeout (#{e}), retrying in 1 second..." + retry end def parse_end_time search_path = type == :auction ? END_TIME_PATH : BIN_END_TIME_PATH time = item_page.search(search_path).text.split(': ')[1]