class Softlayer::Mock::Account

Public Class Methods

find(master_user_id) click to toggle source
# File lib/softlayer/mock/account.rb, line 10
def self.find(master_user_id)
  $database[get_class_from_return_object].each do |key,obj|
    return obj if obj.master_user.id == master_user_id
  end
  nil
end
get_account_status() click to toggle source
# File lib/softlayer/mock/account.rb, line 37
def self.get_account_status
  get_relation('Softlayer::Account::Status','id','account_status_id').first
end
get_domains() click to toggle source
# File lib/softlayer/mock/account.rb, line 21
def self.get_domains
  get_relation('Softlayer::Dns::Domain','account','itself')
end
get_master_user() click to toggle source
# File lib/softlayer/mock/account.rb, line 33
def self.get_master_user
  get_users.select { |user| user.account_id == get_object.id && user.parent_id == nil }.first
end
get_object() click to toggle source
# File lib/softlayer/mock/account.rb, line 4
def self.get_object
  obj = find(Softlayer.configuration.impersonate_user)
  return obj if !obj.nil?
  find_by_key(Softlayer.configuration.username)
end
get_owned_brands() click to toggle source
# File lib/softlayer/mock/account.rb, line 17
def self.get_owned_brands
  get_relation('Softlayer::Brand','id','brand_id')
end
get_relation(relation_name,attr,attr_relation) click to toggle source
# File lib/softlayer/mock/account.rb, line 41
def self.get_relation(relation_name,attr,attr_relation)
  return_objects = []
  $database[relation_name].select { |key,obj| return_objects.push(obj) if obj.send(attr) == get_object.send(attr_relation) }
  return_objects
end
get_tickets() click to toggle source
# File lib/softlayer/mock/account.rb, line 29
def self.get_tickets
  get_relation('Softlayer::Ticket','account_id','id')
end
get_users() click to toggle source
# File lib/softlayer/mock/account.rb, line 25
def self.get_users
  get_relation('Softlayer::User::Customer','account_id','id')
end