module Softlayer

Constants

VERSION

Attributes

configuration[RW]

Softlayer gem configuration.

Public Class Methods

client() click to toggle source

The configured SOAP client to the Softlayer service.

# File lib/softlayer.rb, line 99
def client
  check_configuration!
  @client ||= Softlayer::Client.new("SoftLayer_Account")
end
configure() { |configuration| ... } click to toggle source

Configure the gem.

# File lib/softlayer.rb, line 87
def configure
  self.configuration ||= Config.new
  yield configuration
end
configured?() click to toggle source

Returns true if the gem has been configured.

# File lib/softlayer.rb, line 82
def configured?
  configuration.present?
end
do_not_impersonate!() click to toggle source
# File lib/softlayer.rb, line 110
def do_not_impersonate!
  self.configuration.impersonate_user = nil
  self.configuration.impersonate_token = nil
end
impersonate(user, token) click to toggle source
# File lib/softlayer.rb, line 104
def impersonate(user, token)
  self.configuration.impersonate_user = user
  self.configuration.impersonate_token = token
  true
end
impersonating?() click to toggle source
# File lib/softlayer.rb, line 115
def impersonating?
  !self.configuration.impersonate_user.nil? && !self.configuration.impersonate_token.nil?
end
mock!() click to toggle source

Change mock state

# File lib/softlayer.rb, line 120
def mock!
  self.configuration.mock = true
end
mock?() click to toggle source

Check state of mock

# File lib/softlayer.rb, line 129
def mock?
  self.configuration.mock
end
reset!() click to toggle source

Reset the current configuration.

# File lib/softlayer.rb, line 93
def reset!
  self.configuration = nil
  @client = nil
end
root() click to toggle source
# File lib/softlayer.rb, line 77
def root
  File.dirname(__FILE__)
end
unmock!() click to toggle source
# File lib/softlayer.rb, line 124
def unmock!
  self.configuration.mock = false
end

Private Class Methods

check_configuration!() click to toggle source
# File lib/softlayer.rb, line 135
def check_configuration!
  fail Softlayer::Errors::MissingConfig.new unless self.configuration
  self.configuration.check!
end