lib/sauce_overage/account.rb in sauce_overage-0.0.2 vs lib/sauce_overage/account.rb in sauce_overage-1.0.0
- old
+ new
@@ -1,11 +1,7 @@
-require_relative 'sauce_utils'
-
module SauceOverage
class Account
- include SauceOverage::SauceUtils
-
attr_reader :user, :key
def initialize(opts = {})
@user = opts.fetch(:user, sauce_user)
fail 'Must provide user' unless user
@@ -19,10 +15,14 @@
def get_user
get = Curl::Easy.new("https://saucelabs.com/rest/v1/users/#{user}")
get.http_auth_types = :basic
get.username = user
get.password = key
- get.perform
+ get.verbose = true # display more info on errors
+ # Work around
+ # /.rvm/gems/ruby-2.2.2/gems/curb-0.8.8/lib/curl/easy.rb:72:in `perform': SSL connect error (Curl::Err::SSLConnectError)
+ # by retrying for two minutes
+ wait(120) { get.perform }
result = JSON.parse(get.body_str || '{}')
fail result['error'] if result['error']
result
end