acquia-cloud 0.5.8 → 0.6.0.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/lib/acquia/cloud.rb +0 -1
- data/lib/acquia/cloud/api.rb +13 -4
- data/lib/acquia/cloud/database_backup.rb +1 -1
- data/lib/acquia/cloud/version.rb +1 -1
- metadata +5 -6
- data/lib/acquia/cloud/credentials.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4561c0e33f1c791e2adb973ac464880f5222c8b6
|
4
|
+
data.tar.gz: beec6a1c7d1ddcf642f524a588b222a536d810bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f67b6c765d1bba28b27ce86e8311c65253657d9b6e9aa897430e03f5850131644f7a88f8c333ba2464814722c4183fea8576dde2ef41ed7245c2bbd792f9af
|
7
|
+
data.tar.gz: 3e7bc9468622f7565504534b03e207090704f713c20a8c44a6ddffc23a092b8361647914491ae6abce73f8e629e76c25ea7b7ca132bbf4816be4184b6279d398
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -7,18 +7,18 @@
|
|
7
7
|
**Author:** [Equiem](http://equiem.com.au/)
|
8
8
|
**Contributors:** [See contributors on GitHub][gh-contrib]
|
9
9
|
**Bugs/Support:** [Github Issues][gh-issues]
|
10
|
-
**Copyright:** 2015-
|
10
|
+
**Copyright:** 2015-2016
|
11
11
|
**License:** [MIT license][license]
|
12
12
|
**Status:** Active
|
13
13
|
|
14
14
|
## Synopsis
|
15
15
|
|
16
|
-
`acquia-cloud` is a Ruby binding for the Acquia Cloud API.
|
16
|
+
`acquia-cloud` is a Ruby binding for the Acquia Cloud API.
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
20
20
|
$ gem install acquia-cloud
|
21
|
-
|
21
|
+
|
22
22
|
Or add `gem 'acquia-cloud'` to your Gemfile and update your bundle.
|
23
23
|
|
24
24
|
## Usage
|
data/lib/acquia/cloud.rb
CHANGED
data/lib/acquia/cloud/api.rb
CHANGED
@@ -19,10 +19,19 @@ module Acquia
|
|
19
19
|
client.use Faraday::Response::RaiseError
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if args[:credentials].nil?
|
23
|
+
if ENV['ACQUIA_CLOUD_CREDENTIALS'].nil?
|
24
|
+
raise 'Unable to detect your credentials. Please populate ACQUIA_CLOUD_CREDENTIALS with your username and API key.'
|
25
|
+
end
|
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
|
26
35
|
end
|
27
36
|
|
28
37
|
def get(url = nil, params = nil, headers = nil, &block)
|
@@ -63,7 +63,7 @@ module Acquia
|
|
63
63
|
https = uri.scheme == 'https'
|
64
64
|
Net::HTTP.start(uri.host, uri.port, use_ssl: https) do |http|
|
65
65
|
request = Net::HTTP::Get.new uri
|
66
|
-
request.basic_auth
|
66
|
+
request.basic_auth *@cloud.api.credentials
|
67
67
|
|
68
68
|
http.request request do |response|
|
69
69
|
response.read_body do |chunk|
|
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.
|
4
|
+
version: 0.6.0.dev
|
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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -83,7 +83,6 @@ 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
|
87
86
|
- lib/acquia/cloud/database.rb
|
88
87
|
- lib/acquia/cloud/database_backup.rb
|
89
88
|
- lib/acquia/cloud/database_environment.rb
|
@@ -113,12 +112,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
112
|
version: 1.9.3
|
114
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
114
|
requirements:
|
116
|
-
- - "
|
115
|
+
- - ">"
|
117
116
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
117
|
+
version: 1.3.1
|
119
118
|
requirements: []
|
120
119
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.4.8
|
122
121
|
signing_key:
|
123
122
|
specification_version: 4
|
124
123
|
summary: Bindings to the Acquia Cloud API.
|
@@ -1,50 +0,0 @@
|
|
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? && !@key.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
|