acquia-cloud 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/acquia/cloud.rb +1 -0
- data/lib/acquia/cloud/api.rb +4 -13
- data/lib/acquia/cloud/credentials.rb +50 -0
- data/lib/acquia/cloud/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c11648299dbc0bacb54b7fb14027dbe3bea2bd
|
4
|
+
data.tar.gz: f8c6f5136af56b64e12ad58f1ad3400a4696f76e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4596ede846c0813bba17132abce2ff2de0464fa7e59a7c901fe1451d053aeca5172b71cdf2e1a1a86f1d8396682bca777ffa57b581e7659be877fdce6afea590
|
7
|
+
data.tar.gz: 7409c49b5efce6da5655d27dcbff331f697d8898a06f2c86369fd1a9f4f3c3e71fcc90a2bca7649c34debdbb2a4d66d3102b8ab5f9a35d7876132fd22c09be06
|
data/LICENSE
CHANGED
data/lib/acquia/cloud.rb
CHANGED
data/lib/acquia/cloud/api.rb
CHANGED
@@ -19,19 +19,10 @@ module Acquia
|
|
19
19
|
client.use Faraday::Response::RaiseError
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
args[:credentials] = ENV['ACQUIA_CLOUD_CREDENTIALS']
|
28
|
-
end
|
29
|
-
|
30
|
-
@credentials = args[:credentials].split(':', 2)
|
31
|
-
if @credentials.length < 2
|
32
|
-
raise 'You must specify both username and API key in credentials.'
|
33
|
-
end
|
34
|
-
@acquia.basic_auth *@credentials
|
22
|
+
credentials = Credentials.new(args[:credentials])
|
23
|
+
raise 'Unable to determine your Acquia Cloud credentials.' \
|
24
|
+
unless credentials.defined?
|
25
|
+
@acquia.basic_auth credentials.email, credentials.key
|
35
26
|
end
|
36
27
|
|
37
28
|
def get(url = nil, params = nil, headers = nil, &block)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Acquia
|
4
|
+
class Cloud
|
5
|
+
# This class controls access to Acquia Cloud API credentials.
|
6
|
+
#
|
7
|
+
# This class can load data from a few different places. Firstly, you can
|
8
|
+
# pass a string of the form "$email:$key". You can also load a similar
|
9
|
+
# string from the environment variable ACQUIA_CLOUD_CREDENTIALS.
|
10
|
+
#
|
11
|
+
# As a fallback if none of the above is provided then this class will check
|
12
|
+
# the ~/.acquia/cloudapi.conf file. This is the recommended approach for
|
13
|
+
# using credentials with this API as this file is shared between many
|
14
|
+
# different libraries.
|
15
|
+
class Credentials
|
16
|
+
CREDENTIALS_FILE = "#{ENV['HOME']}/.acquia/cloudapi.conf"
|
17
|
+
|
18
|
+
attr_reader :email
|
19
|
+
attr_reader :key
|
20
|
+
|
21
|
+
def initialize(value = nil)
|
22
|
+
value = ENV['ACQUIA_CLOUD_CREDENTIALS'] if value.nil?
|
23
|
+
|
24
|
+
if value.nil?
|
25
|
+
if File.exist? CREDENTIALS_FILE
|
26
|
+
creds = YAML.load_file CREDENTIALS_FILE
|
27
|
+
|
28
|
+
@email = creds['email']
|
29
|
+
@key = creds['key']
|
30
|
+
end
|
31
|
+
else
|
32
|
+
vals = value.split(':', 2)
|
33
|
+
|
34
|
+
@email = vals[0]
|
35
|
+
@key = vals[1]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def defined?
|
40
|
+
!@email.nil? && !@password.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
alias_method :old_inspect, :inspect
|
44
|
+
private :old_inspect
|
45
|
+
def inspect
|
46
|
+
old_inspect.gsub(/, @key=".*?"/, '')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/acquia/cloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acquia-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Equiem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- acquia-cloud.gemspec
|
84
84
|
- lib/acquia/cloud.rb
|
85
85
|
- lib/acquia/cloud/api.rb
|
86
|
+
- lib/acquia/cloud/credentials.rb
|
86
87
|
- lib/acquia/cloud/database.rb
|
87
88
|
- lib/acquia/cloud/database_backup.rb
|
88
89
|
- lib/acquia/cloud/database_environment.rb
|
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
120
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.8
|
121
122
|
signing_key:
|
122
123
|
specification_version: 4
|
123
124
|
summary: Bindings to the Acquia Cloud API.
|