Permalink
Browse files

Hack around an API change (bug?) in Typhoeus 0.5.0pre

  • Loading branch information...
1 parent f79765d commit 6338317d665c41cd161838ca763c3b69aef15d54 @chadrem committed Jul 8, 2012
Showing with 6 additions and 0 deletions.
  1. +3 −0 lib/market_bot/android/app.rb
  2. +3 −0 lib/market_bot/android/leaderboard.rb
@@ -145,6 +145,9 @@ def enqueue_update(&block)
request = Typhoeus::Request.new(market_url)
request.on_complete do |response|
+ # HACK: Typhoeus <= 0.4.2 returns a response, 0.5.0pre returns the request.
+ response = response.response if response.is_a?(Typhoeus::Request)
+
result = nil
begin
@@ -131,6 +131,9 @@ def results
def process_page(url, page_num)
request = Typhoeus::Request.new(url)
request.on_complete do |response|
+ # HACK: Typhoeus <= 0.4.2 returns a response, 0.5.0pre returns the request.
+ response = response.response if response.is_a?(Typhoeus::Request)
+
result = Leaderboard.parse(response.body)
update_callback(result, page_num)
end

0 comments on commit 6338317

Please sign in to comment.