class Softlayer::Config

Attributes

api_key[RW]
impersonate_token[RW]
impersonate_user[RW]
mock[RW]
open_timeout[RW]
read_timeout[RW]
username[RW]

Public Class Methods

new(params = {}) click to toggle source
# File lib/softlayer/config.rb, line 13
def initialize(params = {})
  @username = params[:username] if params[:username]
  @api_key = params[:api_key] if params[:api_key]
  @open_timeout = 5
  @read_timeout = 5
  @mock = false
end

Public Instance Methods

check!() click to toggle source

Check the configuration.

Will raise a Softlayer::Errors::MissingConfigOption if any of the API login ID or the API key are missing.

# File lib/softlayer/config.rb, line 24
def check!
  fail Softlayer::Errors::MissingConfigOption.new('username') unless username && username.strip.length > 0
  fail Softlayer::Errors::MissingConfigOption.new('api_key') unless api_key && api_key.strip.length > 0
end
mock?() click to toggle source
# File lib/softlayer/config.rb, line 29
def mock?
  self.mock
end