class Acquia::Cloud::Credentials

This class controls access to Acquia Cloud API credentials.

This class can load data from a few different places. Firstly, you can pass a string of the form “$email:$key”. You can also load a similar string from the environment variable ACQUIA_CLOUD_CREDENTIALS.

As a fallback if none of the above is provided then this class will check the ~/.acquia/cloudapi.conf file. This is the recommended approach for using credentials with this API as this file is shared between many different libraries.

Constants

CREDENTIALS_FILE

Attributes

email[R]
key[R]

Public Class Methods

new(value = nil) click to toggle source
# File lib/acquia/cloud/credentials.rb, line 21
def initialize(value = nil)
  value = ENV['ACQUIA_CLOUD_CREDENTIALS'] if value.nil?

  if value.nil?
    if File.exist? CREDENTIALS_FILE
      creds = YAML.load_file CREDENTIALS_FILE

      @email = creds['email']
      @key = creds['key']
    end
  else
    vals = value.split(':', 2)

    @email = vals[0]
    @key = vals[1]
  end
end

Public Instance Methods

defined?() click to toggle source
# File lib/acquia/cloud/credentials.rb, line 39
def defined?
  !@email.nil? && !@key.nil?
end
inspect() click to toggle source
# File lib/acquia/cloud/credentials.rb, line 45
def inspect
  old_inspect.gsub(/, @key=".*?"/, '')
end
Also aliased as: old_inspect
old_inspect()
Alias for: inspect