Class: Zimbra::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/zimbra/base.rb
Overview
Constant Summary
collapse
- NAMESPACES =
{
'Domain' => 'domain',
'Account' => 'account',
'DistributionList' => 'dl'
}
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(id, name, zimbra_attrs = {}, node = nil) ⇒ Base
Returns a new instance of Base.
46
47
48
49
50
|
# File 'lib/zimbra/base.rb', line 46
def initialize(id, name, zimbra_attrs = {}, node = nil)
self.id = id
self.name = name
self.zimbra_attrs = zimbra_attrs
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
44
45
46
|
# File 'lib/zimbra/base.rb', line 44
def id
@id
end
|
#name ⇒ Object
Returns the value of attribute name.
44
45
46
|
# File 'lib/zimbra/base.rb', line 44
def name
@name
end
|
#zimbra_attrs ⇒ Object
Returns the value of attribute zimbra_attrs.
44
45
46
|
# File 'lib/zimbra/base.rb', line 44
def zimbra_attrs
@zimbra_attrs
end
|
Class Method Details
.all ⇒ Object
16
17
18
|
# File 'lib/zimbra/base.rb', line 16
def all
BaseService.all(class_name)
end
|
.class_name ⇒ Object
12
13
14
|
# File 'lib/zimbra/base.rb', line 12
def class_name
name.gsub(/Zimbra::/, '')
end
|
.create(name, attrs = {}) ⇒ Object
28
29
30
|
# File 'lib/zimbra/base.rb', line 28
def create(name, attrs = {})
BaseService.create(name, attrs, class_name)
end
|
.find_by_id(id) ⇒ Object
20
21
22
|
# File 'lib/zimbra/base.rb', line 20
def find_by_id(id)
BaseService.get_by_id(id, class_name)
end
|
.find_by_name(name) ⇒ Object
24
25
26
|
# File 'lib/zimbra/base.rb', line 24
def find_by_name(name)
BaseService.get_by_name(name, class_name)
end
|
.zimbra_attrs_to_load ⇒ Object
37
38
39
40
|
# File 'lib/zimbra/base.rb', line 37
def zimbra_attrs_to_load
return [] if @zimbra_attrs_to_load.nil?
@zimbra_attrs_to_load
end
|
.zimbra_attrs_to_load=(array) ⇒ Object
32
33
34
35
|
# File 'lib/zimbra/base.rb', line 32
def zimbra_attrs_to_load=(array)
fail(ArgumentError, 'Must be an array') unless array.is_a?Array
@zimbra_attrs_to_load = array
end
|
Instance Method Details
#delete ⇒ Object
56
57
58
|
# File 'lib/zimbra/base.rb', line 56
def delete
BaseService.delete(id, self.class.class_name)
end
|
#modify(attrs = {}) ⇒ Object
60
61
62
63
|
# File 'lib/zimbra/base.rb', line 60
def modify(attrs = {})
rename(attrs.delete('name')) if attrs['name']
BaseService.modify(id, attrs, self.class.class_name)
end
|
#rename(newname) ⇒ Object
Zimbra only allows renaming domains directly through LDAP