Class: Zm::Client::Base::ZimbraAttributesCollection
Instance Attribute Summary collapse
#all
Instance Method Summary
collapse
#method_missing
Constructor Details
Returns a new instance of ZimbraAttributesCollection.
14
15
16
17
18
19
20
21
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 14
def initialize(parent)
@parent = parent
@all = CSV.open(File.expand_path(@parent.config.zimbra_attributes_path), headers: true, skip_blanks: true, strip: true, header_converters: lambda { |h| h.to_sym }).map do |attr|
attr_h = attr.to_h.delete_if { |_, v| v.nil? }
ZimbraAttribute.new(**attr_h)
end.freeze
end
|
Instance Attribute Details
#all_versioned ⇒ Object
Returns the value of attribute all_versioned.
12
13
14
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 12
def all_versioned
@all_versioned
end
|
Instance Method Details
#all_account_attr_types_h ⇒ Object
120
121
122
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 120
def all_account_attr_types_h
@all_account_attr_types_h ||= Hash[all_account_attrs.map { |attr| [attr.name, attr.type] }].freeze
end
|
#all_account_attrs ⇒ Object
############################### Account ###############################
108
109
110
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 108
def all_account_attrs
@all_account_attrs ||= @all.select { |attr| attr.is_account_scoped? || attr.is_mailRecipient_scoped? }.freeze
end
|
#all_account_attrs_writable ⇒ Object
112
113
114
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 112
def all_account_attrs_writable
@all_account_attrs_writable ||= all_account_attrs.reject(&:immutable?).freeze
end
|
#all_account_attrs_writable_names ⇒ Object
116
117
118
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 116
def all_account_attrs_writable_names
@all_account_attrs_writable_names ||= all_account_attrs_writable.map(&:name).freeze
end
|
#all_cos_attr_types_h ⇒ Object
48
49
50
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 48
def all_cos_attr_types_h
@all_cos_attr_types_h ||= Hash[all_cos_attrs.map { |attr| [attr.name, attr.type] }].freeze
end
|
#all_cos_attrs ⇒ Object
############################### Cos ###############################
36
37
38
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 36
def all_cos_attrs
@all_cos_attrs ||= @all.select(&:is_cos_scoped?).freeze
end
|
#all_cos_attrs_writable ⇒ Object
40
41
42
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 40
def all_cos_attrs_writable
@all_cos_attrs_writable ||= all_cos_attrs.reject(&:immutable?).freeze
end
|
#all_cos_attrs_writable_names ⇒ Object
44
45
46
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 44
def all_cos_attrs_writable_names
@all_cos_attrs_writable_names ||= all_cos_attrs_writable.map(&:name).freeze
end
|
#all_distributionlist_attrs ⇒ Object
############################### Distribution List ###############################
132
133
134
135
136
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 132
def all_distributionlist_attrs
@all_distributionlist_attrs ||= @all.select do |attr|
attr.is_distributionList_scoped? || attr.is_group_scoped? || attr.is_groupDynamicUnit_scoped? || attr.is_groupStaticUnit_scoped?
end.freeze
end
|
#all_distributionlist_attrs_types_h ⇒ Object
146
147
148
149
150
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 146
def all_distributionlist_attrs_types_h
@all_distributionlist_attrs_types_h ||= Hash[all_distributionlist_attrs.map do |attr|
[attr.name, attr.type]
end].freeze
end
|
#all_distributionlist_attrs_writable ⇒ Object
138
139
140
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 138
def all_distributionlist_attrs_writable
@all_distributionlist_attrs_writable ||= all_distributionlist_attrs.reject(&:immutable?).freeze
end
|
#all_distributionlist_attrs_writable_names ⇒ Object
142
143
144
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 142
def all_distributionlist_attrs_writable_names
@all_distributionlist_attrs_writable_names ||= all_distributionlist_attrs_writable.map(&:name).freeze
end
|
#all_domain_attr_types_h ⇒ Object
96
97
98
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 96
def all_domain_attr_types_h
@all_domain_attr_types_h ||= Hash[all_domain_attrs.map { |attr| [attr.name, attr.type] }].freeze
end
|
#all_domain_attrs ⇒ Object
############################### Domain ###############################
84
85
86
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 84
def all_domain_attrs
@all_domain_attrs ||= @all.select(&:is_domain_scoped?).freeze
end
|
#all_domain_attrs_writable ⇒ Object
88
89
90
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 88
def all_domain_attrs_writable
@all_domain_attrs_writable ||= all_domain_attrs.reject(&:immutable?).freeze
end
|
#all_domain_attrs_writable_names ⇒ Object
92
93
94
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 92
def all_domain_attrs_writable_names
@all_domain_attrs_writable_names ||= all_domain_attrs_writable.map(&:name).freeze
end
|
#all_resource_attrs ⇒ Object
############################### Calendar Resource ###############################
160
161
162
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 160
def all_resource_attrs
@all_resource_attrs ||= @all.select(&:is_calendarResource_scoped?).freeze
end
|
#all_resource_attrs_types_h ⇒ Object
172
173
174
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 172
def all_resource_attrs_types_h
@all_resource_attrs_types_h ||= Hash[all_resource_attrs.map { |attr| [attr.name, attr.type] }].freeze
end
|
#all_resource_attrs_writable ⇒ Object
164
165
166
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 164
def all_resource_attrs_writable
@all_resource_attrs_writable ||= all_resource_attrs.reject(&:immutable?).freeze
end
|
#all_resource_attrs_writable_names ⇒ Object
168
169
170
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 168
def all_resource_attrs_writable_names
@all_resource_attrs_writable_names ||= all_resource_attrs_writable.map(&:name).freeze
end
|
#all_server_attr_types_h ⇒ Object
72
73
74
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 72
def all_server_attr_types_h
@all_server_attr_types_h ||= Hash[all_server_attrs.map { |attr| [attr.name, attr.type] }].freeze
end
|
#all_server_attrs ⇒ Object
############################### Server ###############################
60
61
62
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 60
def all_server_attrs
@all_server_attrs ||= @all.select(&:is_server_scoped?).freeze
end
|
#all_server_attrs_writable ⇒ Object
64
65
66
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 64
def all_server_attrs_writable
@all_server_attrs_writable ||= all_server_attrs.reject(&:immutable?).freeze
end
|
#all_server_attrs_writable_names ⇒ Object
68
69
70
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 68
def all_server_attrs_writable_names
@all_server_attrs_writable_names ||= all_server_attrs_writable.map(&:name).freeze
end
|
#set_account_methods ⇒ Object
124
125
126
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 124
def set_account_methods
Account.attr_accessor(*all_account_attrs.map { |attr| attr.name.to_sym })
end
|
#set_cos_methods ⇒ Object
52
53
54
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 52
def set_cos_methods
Cos.attr_accessor(*all_cos_attrs.map { |attr| attr.name.to_sym })
end
|
#set_distributionlist_methods ⇒ Object
152
153
154
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 152
def set_distributionlist_methods
DistributionList.attr_accessor(*all_distributionlist_attrs.map { |attr| attr.name.to_sym })
end
|
#set_domain_methods ⇒ Object
100
101
102
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 100
def set_domain_methods
Domain.attr_accessor(*all_domain_attrs.map { |attr| attr.name.to_sym })
end
|
#set_methods ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 23
def set_methods
set_server_methods
set_cos_methods
set_domain_methods
set_account_methods
set_distributionlist_methods
set_resource_methods
end
|
#set_resource_methods ⇒ Object
176
177
178
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 176
def set_resource_methods
Resource.attr_accessor(*all_resource_attrs.map { |attr| attr.name.to_sym })
end
|
#set_server_methods ⇒ Object
76
77
78
|
# File 'lib/zm/client/base/zimbra_attributes_collection.rb', line 76
def set_server_methods
Server.attr_accessor(*all_server_attrs.map { |attr| attr.name.to_sym })
end
|