Class: Softlayer::Mock::Account
Instance Attribute Summary
#id
Class Method Summary
collapse
add_attributes, all, create_object, find_by_key, get_class_from_return_object, message_to_params, request, save_on_database
Class Method Details
.find(master_user_id) ⇒ Object
10
11
12
13
14
15
|
# 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 ⇒ Object
37
38
39
|
# 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 ⇒ Object
21
22
23
|
# File 'lib/softlayer/mock/account.rb', line 21
def self.get_domains
get_relation('Softlayer::Dns::Domain','account','itself')
end
|
.get_master_user ⇒ Object
33
34
35
|
# 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_owned_brands ⇒ Object
17
18
19
|
# 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) ⇒ Object
41
42
43
44
45
|
# 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 ⇒ Object
29
30
31
|
# File 'lib/softlayer/mock/account.rb', line 29
def self.get_tickets
get_relation('Softlayer::Ticket','account_id','id')
end
|
.get_users ⇒ Object
25
26
27
|
# File 'lib/softlayer/mock/account.rb', line 25
def self.get_users
get_relation('Softlayer::User::Customer','account_id','id')
end
|