acquia-cloud 0.5.8 → 0.6.0.dev

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15c71a91e7e03182227930284c9233977438867e
4
- data.tar.gz: a4c1584a89d2885d038bbde0cdffe3cc4275b49b
3
+ metadata.gz: 4561c0e33f1c791e2adb973ac464880f5222c8b6
4
+ data.tar.gz: beec6a1c7d1ddcf642f524a588b222a536d810bb
5
5
  SHA512:
6
- metadata.gz: 0694b6756881070e9525e8527b031701b2d50dd4d53d1b7159aad39a86dd95eba975979950c94e9b707cba2737efc7115d72db39f5e2cb2d0602fddf30785ad5
7
- data.tar.gz: 2526577633e006b176636e642f7eadc705b7db9d7cd0eee01c05e1185ed8e7224abeb049c1afefbc0dc845557755c1d6701a518f40976b4b0755951b888f8916
6
+ metadata.gz: e0f67b6c765d1bba28b27ce86e8311c65253657d9b6e9aa897430e03f5850131644f7a88f8c333ba2464814722c4183fea8576dde2ef41ed7245c2bbd792f9af
7
+ data.tar.gz: 3e7bc9468622f7565504534b03e207090704f713c20a8c44a6ddffc23a092b8361647914491ae6abce73f8e629e76c25ea7b7ca132bbf4816be4184b6279d398
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Equiem Services Pty Ltd
1
+ Copyright (c) 2015 Matthew Scharley
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a
4
4
  copy of this software and associated documentation files (the "Software"),
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-2017
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
@@ -30,7 +30,6 @@ end
30
30
  %w{
31
31
  version
32
32
  errors
33
- credentials
34
33
  api
35
34
  database
36
35
  database_backup
@@ -19,10 +19,19 @@ module Acquia
19
19
  client.use Faraday::Response::RaiseError
20
20
  end
21
21
 
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
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 @cloud.api.credentials.email, @cloud.api.credentials.key
66
+ request.basic_auth *@cloud.api.credentials
67
67
 
68
68
  http.request request do |response|
69
69
  response.read_body do |chunk|
@@ -1,5 +1,5 @@
1
1
  module Acquia
2
2
  class Cloud
3
- VERSION = '0.5.8'
3
+ VERSION = '0.6.0.dev'
4
4
  end
5
5
  end
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.8
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-23 00:00:00.000000000 Z
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: '0'
117
+ version: 1.3.1
119
118
  requirements: []
120
119
  rubyforge_project:
121
- rubygems_version: 2.6.9
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