zm-ruby-client 0.14.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +6 -0
- data/lib/zm/client/account/account.rb +29 -17
- data/lib/zm/client/account/account_jsns_initializer.rb +44 -0
- data/lib/zm/client/account/accounts_builder.rb +6 -3
- data/lib/zm/client/account/accounts_collection.rb +11 -20
- data/lib/zm/client/account.rb +1 -0
- data/lib/zm/client/ace/ace.rb +22 -9
- data/lib/zm/client/ace/ace_jsns_builder.rb +38 -0
- data/lib/zm/client/ace/ace_jsns_initializer.rb +26 -0
- data/lib/zm/client/ace/aces_builder.rb +6 -9
- data/lib/zm/client/ace/aces_collection.rb +23 -9
- data/lib/zm/client/ace.rb +2 -0
- data/lib/zm/client/appointment/appointment.rb +9 -6
- data/lib/zm/client/appointment/appointments_collection.rb +6 -90
- data/lib/zm/client/backup/backup.rb +8 -4
- data/lib/zm/client/base/account_object.rb +34 -0
- data/lib/zm/client/base/account_objects_collection.rb +14 -0
- data/lib/zm/client/base/account_search_objects_collection.rb +125 -0
- data/lib/zm/client/base/admin_object.rb +6 -0
- data/lib/zm/client/base/admin_objects_collection.rb +65 -0
- data/lib/zm/client/base/base_jsns_builder.rb +19 -0
- data/lib/zm/client/base/base_jsns_initializer.rb +29 -0
- data/lib/zm/client/base/folder_object.rb +41 -0
- data/lib/zm/client/base/ldap_filter.rb +33 -0
- data/lib/zm/client/base/object.rb +19 -0
- data/lib/zm/client/base/objects_builder.rb +4 -0
- data/lib/zm/client/base/objects_collection.rb +11 -32
- data/lib/zm/client/base/zimbra_attribute.rb +119 -0
- data/lib/zm/client/base/zimbra_attributes_collection.rb +38 -0
- data/lib/zm/client/base.rb +15 -0
- data/lib/zm/client/cluster/cluster.rb +43 -7
- data/lib/zm/client/cluster/cluster_config.rb +19 -17
- data/lib/zm/client/connector/rest_account.rb +0 -3
- data/lib/zm/client/connector/soap_account.rb +66 -123
- data/lib/zm/client/connector/soap_admin.rb +28 -16
- data/lib/zm/client/connector/soap_base.rb +11 -3
- data/lib/zm/client/contact/contact.rb +2 -1
- data/lib/zm/client/contact/contacts_builder.rb +3 -13
- data/lib/zm/client/contact/contacts_collection.rb +6 -12
- data/lib/zm/client/cos/cos.rb +9 -5
- data/lib/zm/client/cos/coses_builder.rb +1 -16
- data/lib/zm/client/cos/coses_collection.rb +6 -9
- data/lib/zm/client/distributionlist/distributionlist.rb +44 -6
- data/lib/zm/client/distributionlist/distributionlists_builder.rb +2 -17
- data/lib/zm/client/distributionlist/distributionlists_collection.rb +4 -11
- data/lib/zm/client/distributionlist/dls_membership_collection.rb +24 -0
- data/lib/zm/client/distributionlist.rb +1 -0
- data/lib/zm/client/document/document.rb +7 -9
- data/lib/zm/client/domain/domain.rb +11 -6
- data/lib/zm/client/domain/domain_accounts_collection.rb +13 -0
- data/lib/zm/client/domain/domains_builder.rb +1 -19
- data/lib/zm/client/domain/domains_collection.rb +7 -10
- data/lib/zm/client/domain.rb +1 -0
- data/lib/zm/client/folder/folder.rb +50 -124
- data/lib/zm/client/folder/folder_grant.rb +44 -22
- data/lib/zm/client/folder/folder_grant_jsns_builder.rb +43 -0
- data/lib/zm/client/folder/folder_grants_collection.rb +35 -0
- data/lib/zm/client/folder/folder_jsns_builder.rb +132 -0
- data/lib/zm/client/folder/folder_jsns_initializer.rb +49 -0
- data/lib/zm/client/folder/folder_retention_policies_collection.rb +40 -0
- data/lib/zm/client/folder/folder_retention_policy.rb +8 -30
- data/lib/zm/client/folder/folders_builder.rb +2 -2
- data/lib/zm/client/folder/folders_collection.rb +21 -19
- data/lib/zm/client/folder/folders_jsns_builder.rb +22 -0
- data/lib/zm/client/folder.rb +6 -0
- data/lib/zm/client/identity/identities_builder.rb +4 -15
- data/lib/zm/client/identity/identities_collection.rb +7 -13
- data/lib/zm/client/identity/identity.rb +7 -5
- data/lib/zm/client/message/message.rb +111 -21
- data/lib/zm/client/message/messages_builder.rb +1 -1
- data/lib/zm/client/message/messages_collection.rb +10 -92
- data/lib/zm/client/mountpoint/mountpoint.rb +15 -68
- data/lib/zm/client/mountpoint/mountpoint_jsns_builder.rb +100 -0
- data/lib/zm/client/mountpoint/mountpoint_jsns_initializer.rb +33 -0
- data/lib/zm/client/mountpoint/mountpoints_builder.rb +1 -1
- data/lib/zm/client/mountpoint/mountpoints_collection.rb +14 -23
- data/lib/zm/client/mountpoint.rb +2 -0
- data/lib/zm/client/resource/resource.rb +5 -5
- data/lib/zm/client/resource/resources_builder.rb +1 -16
- data/lib/zm/client/resource/resources_collection.rb +5 -13
- data/lib/zm/client/search_folder/search_folder.rb +19 -39
- data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +86 -0
- data/lib/zm/client/search_folder/search_folder_jsns_initializer.rb +33 -0
- data/lib/zm/client/search_folder/search_folders_builder.rb +7 -11
- data/lib/zm/client/search_folder/search_folders_collection.rb +7 -15
- data/lib/zm/client/search_folder.rb +2 -0
- data/lib/zm/client/server/server.rb +7 -14
- data/lib/zm/client/server/server_accounts_collection.rb +19 -0
- data/lib/zm/client/server/servers_builder.rb +4 -16
- data/lib/zm/client/server/servers_collection.rb +5 -10
- data/lib/zm/client/server.rb +1 -0
- data/lib/zm/client/share/share.rb +2 -9
- data/lib/zm/client/share/shares_builder.rb +3 -12
- data/lib/zm/client/signature/signature.rb +17 -13
- data/lib/zm/client/signature/signature_jsns_builder.rb +5 -1
- data/lib/zm/client/signature/signature_jsns_initializer.rb +25 -0
- data/lib/zm/client/signature/signatures_builder.rb +7 -11
- data/lib/zm/client/signature/signatures_collection.rb +6 -14
- data/lib/zm/client/signature.rb +1 -0
- data/lib/zm/client/tag/tag.rb +27 -20
- data/lib/zm/client/tag/tag_jsns_builder.rb +55 -0
- data/lib/zm/client/tag/tag_jsns_initializer.rb +26 -0
- data/lib/zm/client/tag/tags_builder.rb +6 -9
- data/lib/zm/client/tag/tags_collection.rb +6 -12
- data/lib/zm/client/tag.rb +2 -0
- data/lib/zm/client/task/tasks_collection.rb +6 -90
- data/lib/zm/client/upload/upload.rb +1 -1
- data/lib/zm/client/version.rb +2 -2
- data/lib/zm/modules/common/dl_common.rb +3 -1
- data/lib/zm/modules/common/zimbra-attrs.json.bak +1 -0
- data/lib/zm/modules/zm_logger.rb +24 -0
- data/lib/zm/modules/zm_model.rb +41 -0
- data/test/accounts.rb +15 -1
- data/test/ace.rb +50 -0
- data/test/cluster.rb +41 -0
- data/test/cluster_zimbra_attributes.rb +38 -0
- data/test/folder.rb +125 -0
- data/test/folder_grant.rb +51 -0
- data/test/mountpoint.rb +49 -0
- data/test/retention_policies.rb +40 -0
- data/test/search_folder.rb +67 -0
- data/test/signature.rb +53 -0
- data/test/tag.rb +65 -0
- data/test/zimbra_attributes.rb +35 -0
- data/zm-ruby-client.gemspec +1 -0
- metadata +59 -3
@@ -4,20 +4,10 @@ module Zm
|
|
4
4
|
module Client
|
5
5
|
# class factory [contacts]
|
6
6
|
class ContactBuilder < Base::ObjectsBuilder
|
7
|
-
|
8
7
|
def initialize(parent, json)
|
9
|
-
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
def make
|
14
|
-
root = @json[:Body][:GetContactsResponse][:cn]
|
15
|
-
return [] if root.nil?
|
16
|
-
|
17
|
-
root = [root] unless root.is_a?(Array)
|
18
|
-
root.map do |s|
|
19
|
-
Contact.new(@parent, s)
|
20
|
-
end
|
8
|
+
super(parent, json)
|
9
|
+
@child_class = Contact
|
10
|
+
@json_item_key = :cn
|
21
11
|
end
|
22
12
|
end
|
23
13
|
end
|
@@ -3,23 +3,17 @@
|
|
3
3
|
module Zm
|
4
4
|
module Client
|
5
5
|
# collection account contacts
|
6
|
-
class ContactsCollection < Base::
|
6
|
+
class ContactsCollection < Base::AccountObjectsCollection
|
7
7
|
def initialize(parent)
|
8
|
-
@
|
9
|
-
|
10
|
-
|
11
|
-
def new
|
12
|
-
contact = Contact.new(@parent)
|
13
|
-
yield(contact) if block_given?
|
14
|
-
contact
|
8
|
+
@child_class = Contact
|
9
|
+
@builder_class = ContactBuilder
|
10
|
+
super(parent)
|
15
11
|
end
|
16
12
|
|
17
13
|
private
|
18
14
|
|
19
|
-
def
|
20
|
-
|
21
|
-
cb = ContactBuilder.new @parent, rep
|
22
|
-
cb.make
|
15
|
+
def make_query
|
16
|
+
@parent.sacc.get_all_contacts(@parent.token)
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
data/lib/zm/client/cos/cos.rb
CHANGED
@@ -16,11 +16,11 @@ module Zm
|
|
16
16
|
@zimbraZimletAvailableZimlets = [@zimbraZimletAvailableZimlets] if @zimbraZimletAvailableZimlets.is_a?(String)
|
17
17
|
end
|
18
18
|
|
19
|
-
def to_h
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
19
|
+
# def to_h
|
20
|
+
# hashmap = Hash[all_instance_variable_keys.map { |key| [key, instance_variable_get(arrow_name(key))] }]
|
21
|
+
# hashmap.delete_if { |_, v| v.nil? }
|
22
|
+
# hashmap
|
23
|
+
# end
|
24
24
|
|
25
25
|
def all_instance_variable_keys
|
26
26
|
attrs_write
|
@@ -46,6 +46,10 @@ module Zm
|
|
46
46
|
@servers ||= read_servers
|
47
47
|
end
|
48
48
|
|
49
|
+
def accounts
|
50
|
+
# todo sélectionner tous les comptes qui ont zimbraCOSID=self.id
|
51
|
+
end
|
52
|
+
|
49
53
|
private
|
50
54
|
|
51
55
|
def read_servers
|
@@ -7,22 +7,7 @@ module Zm
|
|
7
7
|
def initialize(parent, json)
|
8
8
|
super(parent, json)
|
9
9
|
@child_class = Cos
|
10
|
-
|
11
|
-
|
12
|
-
# def make
|
13
|
-
# return [] if json_items.nil?
|
14
|
-
#
|
15
|
-
# json_items.map do |entry|
|
16
|
-
# cos = Cos.new(@parent)
|
17
|
-
# cos.init_from_json(entry)
|
18
|
-
# cos
|
19
|
-
# end
|
20
|
-
# end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def json_items
|
25
|
-
@json_items ||= @json[:Body][json_key][:cos]
|
10
|
+
@json_item_key = :cos
|
26
11
|
end
|
27
12
|
end
|
28
13
|
end
|
@@ -3,29 +3,26 @@
|
|
3
3
|
module Zm
|
4
4
|
module Client
|
5
5
|
# Collection coses
|
6
|
-
class CosesCollection < Base::
|
6
|
+
class CosesCollection < Base::AdminObjectsCollection
|
7
7
|
def initialize(parent)
|
8
8
|
@child_class = Cos
|
9
|
+
@builder_class = CosesBuilder
|
10
|
+
@search_type = SearchType::COS
|
9
11
|
@parent = parent
|
10
|
-
reset_query_params
|
11
12
|
end
|
12
13
|
|
13
|
-
def find_by(hash
|
14
|
-
rep = sac.get_cos(hash.values.first, hash.keys.first,
|
14
|
+
def find_by(hash)
|
15
|
+
rep = sac.get_cos(hash.values.first, hash.keys.first, attrs_comma)
|
15
16
|
entry = rep[:Body][:GetCosResponse][:cos].first
|
16
17
|
|
18
|
+
reset_query_params
|
17
19
|
build_from_entry(entry)
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
22
|
-
def build_response
|
23
|
-
CosesBuilder.new(@parent, make_query).make
|
24
|
-
end
|
25
|
-
|
26
24
|
def reset_query_params
|
27
25
|
super
|
28
|
-
@search_type = SearchType::COS
|
29
26
|
@attrs = SearchType::Attributes::COS.dup
|
30
27
|
end
|
31
28
|
end
|
@@ -6,21 +6,22 @@ module Zm
|
|
6
6
|
# objectClass: zimbraDistributionList
|
7
7
|
class DistributionList < Base::AdminObject
|
8
8
|
attr_accessor :members
|
9
|
-
attr_reader :owners
|
9
|
+
attr_reader :owners, :aces
|
10
10
|
|
11
11
|
def initialize(parent)
|
12
12
|
extend(DistributionListCommon)
|
13
13
|
super(parent)
|
14
14
|
@members = []
|
15
15
|
@owners = []
|
16
|
+
@aces = []
|
16
17
|
@grantee_type = 'grp'.freeze
|
17
18
|
end
|
18
19
|
|
19
|
-
def to_h
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
20
|
+
# def to_h
|
21
|
+
# hashmap = Hash[all_instance_variable_keys.map { |key| [key, instance_variable_get(arrow_name(key))] }]
|
22
|
+
# hashmap.delete_if { |_, v| v.nil? }
|
23
|
+
# hashmap
|
24
|
+
# end
|
24
25
|
|
25
26
|
def all_instance_variable_keys
|
26
27
|
DistributionListCommon::ALL_ATTRS
|
@@ -35,6 +36,7 @@ module Zm
|
|
35
36
|
@zimbraMailAlias = [@zimbraMailAlias].compact unless @zimbraMailAlias.is_a?(Array)
|
36
37
|
@zimbraMailAlias.delete(@name)
|
37
38
|
@aliases = @zimbraMailAlias
|
39
|
+
set_aces_from_json
|
38
40
|
end
|
39
41
|
|
40
42
|
def create!
|
@@ -99,6 +101,16 @@ module Zm
|
|
99
101
|
@members -= emails
|
100
102
|
end
|
101
103
|
|
104
|
+
def add_owners!(*emails)
|
105
|
+
# todo à tester
|
106
|
+
sac.distribution_list_action(@id, :id, { op: 'addOwners', owner: { by: :name, type: :usr, _content: emails } })
|
107
|
+
end
|
108
|
+
|
109
|
+
def remove_owners!(*emails)
|
110
|
+
# todo à tester
|
111
|
+
sac.distribution_list_action(@id, :id, { op: 'removeOwners', owner: { by: :name, type: :usr, _content: emails } })
|
112
|
+
end
|
113
|
+
|
102
114
|
def local_transport
|
103
115
|
raise Zm::Client::SoapError, 'zimbraMailHost is null' if zimbraMailHost.nil?
|
104
116
|
|
@@ -120,6 +132,32 @@ module Zm
|
|
120
132
|
|
121
133
|
zimbraMailTransport.start_with?('smtp')
|
122
134
|
end
|
135
|
+
|
136
|
+
def memberships
|
137
|
+
@memberships ||= DlsMembershipCollection.new(self)
|
138
|
+
end
|
139
|
+
|
140
|
+
def hide_in_gal?
|
141
|
+
zimbraHideInGal == 'TRUE'
|
142
|
+
end
|
143
|
+
|
144
|
+
def group?
|
145
|
+
zimbraMailStatus == 'disabled'
|
146
|
+
end
|
147
|
+
|
148
|
+
def mailing_list?
|
149
|
+
zimbraMailStatus == 'enabled'
|
150
|
+
end
|
151
|
+
|
152
|
+
def set_aces_from_json
|
153
|
+
return if @zimbraACE.nil?
|
154
|
+
|
155
|
+
zimbra_aces = @zimbraACE.is_a?(Array) ? @zimbraACE : [@zimbraACE]
|
156
|
+
@aces = zimbra_aces.map do |str|
|
157
|
+
parts = str.split(/\s+/)
|
158
|
+
{ zimbra_id: parts[0], type: parts[1], right: parts[2] }
|
159
|
+
end
|
160
|
+
end
|
123
161
|
end
|
124
162
|
end
|
125
163
|
end
|
@@ -2,27 +2,12 @@
|
|
2
2
|
|
3
3
|
module Zm
|
4
4
|
module Client
|
5
|
-
# class factory [
|
5
|
+
# class factory [dls]
|
6
6
|
class DistributionListsBuilder < Base::ObjectsBuilder
|
7
7
|
def initialize(parent, json)
|
8
8
|
super(parent, json)
|
9
9
|
@child_class = DistributionList
|
10
|
-
|
11
|
-
|
12
|
-
# def make
|
13
|
-
# return [] if json_items.nil?
|
14
|
-
#
|
15
|
-
# json_items.map do |entry|
|
16
|
-
# dl = DistributionList.new(@parent)
|
17
|
-
# dl.init_from_json(entry)
|
18
|
-
# dl
|
19
|
-
# end
|
20
|
-
# end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def json_items
|
25
|
-
@json_items ||= @json[:Body][json_key][:dl]
|
10
|
+
@json_item_key = :dl
|
26
11
|
end
|
27
12
|
end
|
28
13
|
end
|
@@ -3,34 +3,27 @@
|
|
3
3
|
module Zm
|
4
4
|
module Client
|
5
5
|
# Collection Resources
|
6
|
-
class DistributionListsCollection < Base::
|
6
|
+
class DistributionListsCollection < Base::AdminObjectsCollection
|
7
7
|
def initialize(parent)
|
8
8
|
@child_class = DistributionList
|
9
|
+
@builder_class = DistributionListsBuilder
|
10
|
+
@search_type = SearchType::DL
|
9
11
|
@parent = parent
|
10
12
|
reset_query_params
|
11
13
|
end
|
12
14
|
|
13
|
-
def ldap
|
14
|
-
@apply_cos = 0
|
15
|
-
self
|
16
|
-
end
|
17
|
-
|
18
15
|
def find_by(hash)
|
19
16
|
rep = sac.get_distribution_list(hash.values.first, hash.keys.first, attrs_comma)
|
20
17
|
entry = rep[:Body][:GetDistributionListResponse][:dl].first
|
21
18
|
|
19
|
+
reset_query_params
|
22
20
|
build_from_entry(entry)
|
23
21
|
end
|
24
22
|
|
25
23
|
private
|
26
24
|
|
27
|
-
def build_response
|
28
|
-
DistributionListsBuilder.new(@parent, make_query).make
|
29
|
-
end
|
30
|
-
|
31
25
|
def reset_query_params
|
32
26
|
super
|
33
|
-
@search_type = SearchType::DL
|
34
27
|
@attrs = SearchType::Attributes::DL.dup
|
35
28
|
@all_servers = 1
|
36
29
|
@refresh = 0
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Zm
|
4
|
+
module Client
|
5
|
+
DlMembership = Struct.new(:name, :id, :via)
|
6
|
+
|
7
|
+
class DlsMembershipCollection < Base::ObjectsCollection
|
8
|
+
def initialize(parent)
|
9
|
+
@parent = parent
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def make_query
|
15
|
+
@parent.sac.get_distribution_list_membership(@parent.id, :id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_response
|
19
|
+
@all = make_query.dig(:Body, :GetDistributionListMembershipResponse, :dl) || []
|
20
|
+
@all.map { |json| DlMembership.new(json[:name], json[:id], json[:via]) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -19,8 +19,8 @@ module Zm
|
|
19
19
|
yield(self) if block_given?
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
INSTANCE_VARIABLE_KEYS
|
22
|
+
def all_instance_variable_keys
|
23
|
+
INSTANCE_VARIABLE_KEYS
|
24
24
|
end
|
25
25
|
|
26
26
|
def folder
|
@@ -31,6 +31,11 @@ module Zm
|
|
31
31
|
@parent.sacc.item_action(@parent.token, :tag, @id, tn: tag_name)
|
32
32
|
end
|
33
33
|
|
34
|
+
def move!(folder_id)
|
35
|
+
@parent.sacc.item_action(@parent.token, 'move', @id, l: folder_id)
|
36
|
+
@l = folder_id
|
37
|
+
end
|
38
|
+
|
34
39
|
def delete!
|
35
40
|
@parent.sacc.item_action(@parent.token, :delete, @id)
|
36
41
|
end
|
@@ -39,13 +44,6 @@ module Zm
|
|
39
44
|
uploader = Upload.new(@parent, RestAccountConnector.new)
|
40
45
|
uploader.download_file(folder.absFolderPath, nil, nil, [id], dest_file_path)
|
41
46
|
end
|
42
|
-
|
43
|
-
def init_from_json(json)
|
44
|
-
INSTANCE_VARIABLE_KEYS.each do |key|
|
45
|
-
var_name = "@#{key}"
|
46
|
-
instance_variable_set(var_name, json[key])
|
47
|
-
end
|
48
|
-
end
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
@@ -15,11 +15,11 @@ module Zm
|
|
15
15
|
@grantee_type = 'dom'.freeze
|
16
16
|
end
|
17
17
|
|
18
|
-
def to_h
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
18
|
+
# def to_h
|
19
|
+
# hashmap = Hash[all_instance_variable_keys.map { |key| [key, instance_variable_get(arrow_name(key))] }]
|
20
|
+
# hashmap.delete_if { |_, v| v.nil? }
|
21
|
+
# hashmap
|
22
|
+
# end
|
23
23
|
|
24
24
|
def all_instance_variable_keys
|
25
25
|
INSTANCE_VARIABLE_KEYS
|
@@ -51,9 +51,14 @@ module Zm
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def accounts
|
54
|
-
@accounts ||=
|
54
|
+
@accounts ||= DomainAccountsCollection.new(self)
|
55
55
|
end
|
56
56
|
|
57
|
+
# def account_quotas(server_id)
|
58
|
+
# rep = sac.get_quota_usage(name, nil, nil, nil, nil, nil, nil, server_id)
|
59
|
+
# AccountsBuilder.new(@parent, rep).make
|
60
|
+
# end
|
61
|
+
|
57
62
|
def init_from_json(json)
|
58
63
|
super(json)
|
59
64
|
return unless json[:a].is_a? Array
|
@@ -7,25 +7,7 @@ module Zm
|
|
7
7
|
def initialize(parent, json)
|
8
8
|
super(parent, json)
|
9
9
|
@child_class = Domain
|
10
|
-
|
11
|
-
|
12
|
-
# def make
|
13
|
-
# records = []
|
14
|
-
# return records if json_items.nil?
|
15
|
-
#
|
16
|
-
# json_items.each do |entry|
|
17
|
-
# domain = Domain.new(@parent)
|
18
|
-
# domain.init_from_json(entry)
|
19
|
-
# records << domain
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# records
|
23
|
-
# end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def json_items
|
28
|
-
@json_items ||= @json[:Body][json_key][:domain]
|
10
|
+
@json_item_key = :domain
|
29
11
|
end
|
30
12
|
end
|
31
13
|
end
|
@@ -3,29 +3,26 @@
|
|
3
3
|
module Zm
|
4
4
|
module Client
|
5
5
|
# Class Collection [Domain]
|
6
|
-
class DomainsCollection < Base::
|
6
|
+
class DomainsCollection < Base::AdminObjectsCollection
|
7
7
|
def initialize(parent)
|
8
8
|
@child_class = Domain
|
9
|
-
@
|
10
|
-
|
9
|
+
@builder_class = DomainsBuilder
|
10
|
+
@search_type = SearchType::DOMAIN
|
11
|
+
super(parent)
|
11
12
|
end
|
12
13
|
|
13
|
-
def find_by(hash
|
14
|
-
rep = sac.get_domain(hash.values.first, hash.keys.first,
|
14
|
+
def find_by(hash)
|
15
|
+
rep = sac.get_domain(hash.values.first, hash.keys.first, attrs_comma)
|
15
16
|
entry = rep[:Body][:GetDomainResponse][:domain].first
|
16
17
|
|
18
|
+
reset_query_params
|
17
19
|
build_from_entry(entry)
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
22
|
-
def build_response
|
23
|
-
DomainsBuilder.new(@parent, make_query).make
|
24
|
-
end
|
25
|
-
|
26
24
|
def reset_query_params
|
27
25
|
super
|
28
|
-
@search_type = SearchType::DOMAIN
|
29
26
|
@attrs = SearchType::Attributes::DOMAIN.dup
|
30
27
|
@all_servers = 1
|
31
28
|
@refresh = 0
|
data/lib/zm/client/domain.rb
CHANGED