module Fog::Softlayer

Constants

SL_API_URL
SL_STORAGE_AUTH_URL
VERSION

Public Class Methods

escape(str,extra_exclude_chars = '') click to toggle source

CGI.escape, but without special treatment on spaces

# File lib/fog/softlayer.rb, line 69
def self.escape(str,extra_exclude_chars = '')
  str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
    '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
  end
end
mock_account_id() click to toggle source
# File lib/fog/softlayer.rb, line 52
def self.mock_account_id
  Fog.mocking? and @sl_account_id ||= Fog::Mock.random_numbers(7)
end
mock_global_identifier() click to toggle source
# File lib/fog/softlayer.rb, line 60
def self.mock_global_identifier
  Fog::UUID.uuid
end
mock_vm_id() click to toggle source
# File lib/fog/softlayer.rb, line 56
def self.mock_vm_id
  Fog::Mock.random_numbers(7)
end
stringify_keys(obj) click to toggle source
# File lib/fog/softlayer.rb, line 75
def self.stringify_keys(obj)
  return obj.inject({}){|memo,(k,v)| memo[k.to_s] =  stringify_keys(v); memo} if obj.is_a? Hash
  return obj.inject([]){|memo,v    | memo         << stringify_keys(v); memo} if obj.is_a? Array
  obj
end
valid_request?(required, passed) click to toggle source
# File lib/fog/softlayer.rb, line 64
def self.valid_request?(required, passed)
  required.all? {|k| k = k.to_sym; passed.key?(k) and !passed[k].nil?}
end