Class: CloudhouseGuardian::UserList
Instance Attribute Summary
Attributes inherited from BaseObject
#appliance_api_key, #appliance_url, #insecure, #sec_key
Instance Method Summary
collapse
Methods inherited from BaseObject
#http_delete, #http_get, #http_post, #http_put, #make_headers
Constructor Details
#initialize(appliance_url, appliance_api_key, sec_key, insecure) ⇒ UserList
Returns a new instance of UserList.
13
14
15
16
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 13
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
super(appliance_url, appliance_api_key, sec_key, insecure)
@inner_list = []
end
|
Instance Method Details
#<<(obj) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 36
def <<(obj)
if ["User", "CloudhouseGuardian::User"].include?(obj.class.name)
@inner_list << obj
else
raise "Can only append 'User' to 'UserList'"
end
end
|
#[](idx) ⇒ Object
19
20
21
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 19
def [](idx)
return @inner_list[idx]
end
|
#count ⇒ Object
24
25
26
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 24
def count
return @inner_list.count
end
|
#each(&block) ⇒ Object
30
31
32
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 30
def each(&block)
@inner_list.each(&block)
end
|
#find_by_email(email) ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 63
def find_by_email(email)
@inner_list.each do |x|
if x.email == email
return x
end
end
return nil
end
|
#find_by_id(id) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 52
def find_by_id(id)
@inner_list.each do |x|
if x.id.to_s == id.to_s
return x
end
end
return nil
end
|
#from_hash(h) ⇒ Object
3
4
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 3
def from_hash(h)
end
|
#to_hash ⇒ Object
5
6
7
8
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 5
def to_hash
h = {}
return h
end
|
#to_json ⇒ Object
9
10
11
12
|
# File 'lib/cloudhouse_guardian/UserList.rb', line 9
def to_json(options = nil)
h = to_hash
return h.to_json(options)
end
|