Permalink
Browse files

Force HTTParty to take my options, take them all you filthy library

  • Loading branch information...
1 parent 8f8e4a3 commit ed2e1e77934e315ec1905de7f478899b0d07d04d @rtyler committed Aug 5, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/saucetv/api.rb
View
@@ -9,19 +9,19 @@ class API
attr_reader :username
TIMEOUT = 5
- default_timeout TIMEOUT
def initialize(username, api_key)
@username = username
@auth = {:username => username, :password => api_key}
end
- def default_options
- {:header => {'User-Agent' => 'SauceLabs.tv',
+ def get(url)
+ options = {:header => {'User-Agent' => 'SauceLabs.tv',
'Content-Type' => 'application/json'},
:basic_auth => @auth,
:timeout => TIMEOUT
}
+ self.class.get(url, options)
end
def format
@@ -30,7 +30,7 @@ def format
def recent_jobs
begin
- response = self.class.get("/v1/#{username}/jobs")
+ response = get("/v1/#{username}/jobs")
rescue Timeout::Error => e
puts "A call to SauceTV::API#recent_jobs timed out (#{e.inspect})"
return []

0 comments on commit ed2e1e7

Please sign in to comment.