sauce_overage 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/lib/sauce_overage.rb +2 -2
- data/lib/sauce_overage/account.rb +31 -13
- data/lib/sauce_overage/version.rb +2 -2
- data/release_notes.md +6 -0
- data/sauce_overage.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73ee30fe101effb3c25c8a509db9a41b0a0bfdc1
|
4
|
+
data.tar.gz: 4e53ae919a64d2db9c693d035f45d4b4d7e1cae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dac69c99e7959be26a97035f4e3fe80239727617d6c061c48bd9326e646c9ddf18fc9a04f5dae7e318501a8db992d1cdb3268ceba81a1b38340c46b0df942646
|
7
|
+
data.tar.gz: 71a6cfbe78074c7ba00c43a8ef91470a75c100f7f8bc12d369e4fe570a72cf1133a32bb2abe3786ef901c8d2e733ab481056aed16a63af8f6f6816c11e2c7d19
|
data/.rubocop.yml
CHANGED
data/lib/sauce_overage.rb
CHANGED
@@ -12,20 +12,38 @@ module SauceOverage
|
|
12
12
|
@key = key.strip
|
13
13
|
end
|
14
14
|
|
15
|
+
MUTEX = Mutex.new
|
16
|
+
|
17
|
+
def hurley_client
|
18
|
+
MUTEX.synchronize do
|
19
|
+
return @hurley_client if @hurley_client
|
20
|
+
client = @hurley_client = Hurley::Client.new 'https://saucelabs.com/rest/v1/'
|
21
|
+
client.header[:content_type] = 'application/json'
|
22
|
+
client.request_options.timeout = 2 * 60
|
23
|
+
client.request_options.open_timeout = 2 * 60
|
24
|
+
client.url.user = user
|
25
|
+
client.url.password = key
|
26
|
+
|
27
|
+
# Ensure body JSON string is parsed into a hash
|
28
|
+
# Detect errors and fail so wait_true will retry the request
|
29
|
+
client.after_call do |response|
|
30
|
+
response.body = MultiJson.load(response.body) rescue {}
|
31
|
+
|
32
|
+
client_server_error = %i(client_error server_error).include? response.status_type
|
33
|
+
body_error = response.body['error']
|
34
|
+
|
35
|
+
if client_server_error || body_error
|
36
|
+
response_error = body_error || ''
|
37
|
+
fail(::Errno::ECONNREFUSED, response_error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
@hurley_client
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
15
45
|
def get_user
|
16
|
-
|
17
|
-
get.http_auth_types = :basic
|
18
|
-
get.username = user
|
19
|
-
get.password = key
|
20
|
-
get.verbose = true # display more info on errors
|
21
|
-
# Work around
|
22
|
-
# /.rvm/gems/ruby-2.2.2/gems/curb-0.8.8/lib/curl/easy.rb:72:in `perform': SSL connect error (Curl::Err::SSLConnectError)
|
23
|
-
# by retrying for two minutes
|
24
|
-
wait(120) { get.perform }
|
25
|
-
|
26
|
-
result = JSON.parse(get.body_str || '{}')
|
27
|
-
fail result['error'] if result['error']
|
28
|
-
result
|
46
|
+
wait(2 * 60) { hurley_client.get("users/#{user}").body }
|
29
47
|
end
|
30
48
|
|
31
49
|
def minutes
|
data/release_notes.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#### v1.0.1 2015-10-13
|
2
|
+
|
3
|
+
- [9bd0d57](https://github.com/bootstraponline/sauce_overage/commit/9bd0d5792b483a9d3b61b4242d0f72c31f359f04) Release 1.0.1
|
4
|
+
- [b3a5e74](https://github.com/bootstraponline/sauce_overage/commit/b3a5e7434984dca5bd8b4447fa52d8f9c7bb0f53) Use hurley and multi_json. Remove curb and json
|
5
|
+
|
6
|
+
|
1
7
|
#### v1.0.0 2015-09-28
|
2
8
|
|
3
9
|
- [4df608e](https://github.com/bootstraponline/sauce_overage/commit/4df608e280a36d5dcc0774a8817daba445d2fcf8) Release 1.0.0
|
data/sauce_overage.gemspec
CHANGED
@@ -22,8 +22,8 @@ SUMMARY
|
|
22
22
|
f.match(%r{^(test|spec|features)/})
|
23
23
|
end
|
24
24
|
|
25
|
-
spec.add_runtime_dependency '
|
26
|
-
spec.add_runtime_dependency '
|
25
|
+
spec.add_runtime_dependency 'hurley', '~> 0.2'
|
26
|
+
spec.add_runtime_dependency 'multi_json', '~> 1.11.2'
|
27
27
|
spec.add_runtime_dependency 'webdriver_utils', '~> 1.0.2'
|
28
28
|
|
29
29
|
spec.add_development_dependency 'webmock', '~> 1.21.0'
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce_overage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: hurley
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.11.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.11.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webdriver_utils
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|