zm-ruby-client 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -0
  3. data/README.md +128 -27
  4. data/VERSION +1 -1
  5. data/lib/zm/client/account/account.rb +12 -19
  6. data/lib/zm/client/account/account_aliases_collection.rb +6 -4
  7. data/lib/zm/client/account/account_dls_membership_collection.rb +4 -3
  8. data/lib/zm/client/account/account_dls_owner_collection.rb +3 -2
  9. data/lib/zm/client/account/account_jsns_builder.rb +10 -10
  10. data/lib/zm/client/account/accounts_collection.rb +27 -16
  11. data/lib/zm/client/ace/ace.rb +3 -6
  12. data/lib/zm/client/ace/ace_jsns_builder.rb +6 -6
  13. data/lib/zm/client/appointment/appointment.rb +32 -14
  14. data/lib/zm/client/appointment/appointment_jsns_builder.rb +5 -5
  15. data/lib/zm/client/appointment/appointment_jsns_initializer.rb +6 -1
  16. data/lib/zm/client/appointment/appointments_collection.rb +12 -9
  17. data/lib/zm/client/backup/backup.rb +5 -2
  18. data/lib/zm/client/backup/backups_collection.rb +3 -2
  19. data/lib/zm/client/base/account_objects_collection.rb +1 -0
  20. data/lib/zm/client/base/account_search_objects_collection.rb +6 -6
  21. data/lib/zm/client/base/admin_objects_collection.rb +60 -7
  22. data/lib/zm/client/base/base_account_jsns_builder.rb +89 -87
  23. data/lib/zm/client/base/base_jsns_builder.rb +3 -3
  24. data/lib/zm/client/base/base_jsns_initializer.rb +20 -15
  25. data/lib/zm/client/base/mailbox_infos_collection.rb +92 -90
  26. data/lib/zm/client/base/mailbox_object.rb +49 -160
  27. data/lib/zm/client/base/mailbox_prefs_collection.rb +54 -52
  28. data/lib/zm/client/base/object.rb +19 -2
  29. data/lib/zm/client/base/objects_collection.rb +10 -10
  30. data/lib/zm/client/base/zimbra_attribute.rb +28 -42
  31. data/lib/zm/client/base/zimbra_attributes_collection.rb +38 -24
  32. data/lib/zm/client/{cluster/batch_request.rb → batch_request.rb} +1 -1
  33. data/lib/zm/client/cluster/cluster.rb +24 -61
  34. data/lib/zm/client/cluster/cluster_config.rb +35 -15
  35. data/lib/zm/client/contact/contact.rb +15 -13
  36. data/lib/zm/client/contact/contact_jsns_builder.rb +9 -6
  37. data/lib/zm/client/contact/contact_jsns_initializer.rb +2 -2
  38. data/lib/zm/client/contact/contact_member.rb +3 -3
  39. data/lib/zm/client/contact/contact_members_collection.rb +3 -3
  40. data/lib/zm/client/contact/contacts_builder.rb +1 -1
  41. data/lib/zm/client/contact/contacts_collection.rb +2 -2
  42. data/lib/zm/client/contact/group_contact_jsns_builder.rb +18 -14
  43. data/lib/zm/client/contact/mod_group_contact.rb +12 -8
  44. data/lib/zm/client/cos/cos.rb +15 -31
  45. data/lib/zm/client/cos/cos_jsns_builder.rb +21 -21
  46. data/lib/zm/client/cos/coses_collection.rb +11 -6
  47. data/lib/zm/client/datasource/datasource.rb +3 -9
  48. data/lib/zm/client/datasource/datasource_jsns_builder.rb +4 -4
  49. data/lib/zm/client/datasource/datasources_builder.rb +1 -1
  50. data/lib/zm/client/datasource/datasources_collection.rb +2 -2
  51. data/lib/zm/client/deprecated_constants.rb +36 -0
  52. data/lib/zm/client/distributionlist/distributionlist.rb +15 -47
  53. data/lib/zm/client/distributionlist/distributionlist_aces_collection.rb +4 -4
  54. data/lib/zm/client/distributionlist/distributionlist_aliases_collection.rb +7 -5
  55. data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +29 -41
  56. data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +14 -3
  57. data/lib/zm/client/distributionlist/distributionlist_members_collection.rb +14 -10
  58. data/lib/zm/client/distributionlist/distributionlist_owners_collection.rb +13 -13
  59. data/lib/zm/client/distributionlist/distributionlists_collection.rb +15 -7
  60. data/lib/zm/client/distributionlist/dls_membership_collection.rb +8 -6
  61. data/lib/zm/client/document/document.rb +5 -11
  62. data/lib/zm/client/document/document_jsns_builder.rb +2 -2
  63. data/lib/zm/client/document/documents_collection.rb +4 -4
  64. data/lib/zm/client/domain/domain.rb +8 -25
  65. data/lib/zm/client/domain/domain_jsns_builder.rb +13 -13
  66. data/lib/zm/client/domain/domains_collection.rb +13 -6
  67. data/lib/zm/client/filter_rules/filter_rules_collection.rb +1 -1
  68. data/lib/zm/client/filter_rules/outgoing_filter_rules_collection.rb +1 -1
  69. data/lib/zm/client/folder/folder.rb +34 -21
  70. data/lib/zm/client/folder/folder_default.rb +39 -0
  71. data/lib/zm/client/folder/folder_grant_jsns_builder.rb +3 -3
  72. data/lib/zm/client/folder/folder_grants_collection.rb +1 -1
  73. data/lib/zm/client/folder/folder_jsns_builder.rb +12 -12
  74. data/lib/zm/client/folder/folder_jsns_initializer.rb +1 -1
  75. data/lib/zm/client/folder/folder_retention_policies_collection.rb +6 -2
  76. data/lib/zm/client/folder/folder_view.rb +15 -0
  77. data/lib/zm/client/folder/folders_jsns_builder.rb +1 -1
  78. data/lib/zm/client/folder/mod_document_folder.rb +16 -12
  79. data/lib/zm/client/identity/identities_collection.rb +1 -1
  80. data/lib/zm/client/identity/identity.rb +3 -9
  81. data/lib/zm/client/identity/identity_jsns_builder.rb +8 -8
  82. data/lib/zm/client/{base/ldap_filter.rb → ldap_filter.rb} +1 -1
  83. data/lib/zm/client/license/licenses_collection.rb +1 -1
  84. data/lib/zm/client/mailbox/mailbox_item_concern.rb +0 -2
  85. data/lib/zm/client/message/message.rb +14 -19
  86. data/lib/zm/client/message/message_attachments_collection.rb +39 -0
  87. data/lib/zm/client/message/message_flags_collection.rb +130 -0
  88. data/lib/zm/client/message/message_jsns_builder.rb +4 -8
  89. data/lib/zm/client/message/message_jsns_initializer.rb +4 -4
  90. data/lib/zm/client/message/message_recipients.rb +19 -43
  91. data/lib/zm/client/message/messages_collection.rb +20 -4
  92. data/lib/zm/client/mountpoint/{mountpoint.rb → mount_point.rb} +4 -10
  93. data/lib/zm/client/mountpoint/{mountpoint_jsns_builder.rb → mount_point_jsns_builder.rb} +3 -3
  94. data/lib/zm/client/mountpoint/{mountpoint_jsns_initializer.rb → mount_point_jsns_initializer.rb} +1 -1
  95. data/lib/zm/client/mountpoint/{mountpoints_builder.rb → mount_points_builder.rb} +1 -1
  96. data/lib/zm/client/mta_queue/mta_queue.rb +4 -16
  97. data/lib/zm/client/mta_queue/mta_queue_action.rb +12 -0
  98. data/lib/zm/client/mta_queue/mta_queue_jsns_builder.rb +7 -7
  99. data/lib/zm/client/mta_queue/mta_queue_name.rb +14 -0
  100. data/lib/zm/client/mta_queue/mta_queues_collection.rb +4 -3
  101. data/lib/zm/client/mta_queue_item/mta_queue_items_collection.rb +1 -0
  102. data/lib/zm/client/recipient.rb +21 -0
  103. data/lib/zm/client/{common/recipients.rb → recipients.rb} +0 -16
  104. data/lib/zm/client/resource/resource.rb +3 -7
  105. data/lib/zm/client/resource/resource_jsns_builder.rb +13 -13
  106. data/lib/zm/client/resource/resources_collection.rb +20 -7
  107. data/lib/zm/client/search_folder/search_folder.rb +4 -11
  108. data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +6 -6
  109. data/lib/zm/client/search_folder/search_folders_collection.rb +1 -1
  110. data/lib/zm/client/server/server.rb +16 -22
  111. data/lib/zm/client/server/server_services.rb +26 -0
  112. data/lib/zm/client/server/servers_collection.rb +6 -6
  113. data/lib/zm/client/share/share.rb +2 -5
  114. data/lib/zm/client/share/shares_builder.rb +1 -1
  115. data/lib/zm/client/share/shares_collection.rb +5 -4
  116. data/lib/zm/client/signature/signature.rb +7 -13
  117. data/lib/zm/client/signature/signature_jsns_builder.rb +13 -13
  118. data/lib/zm/client/signature/signature_jsns_initializer.rb +2 -2
  119. data/lib/zm/client/signature/signatures_collection.rb +1 -1
  120. data/lib/zm/client/tag/account_object_tags_collection.rb +45 -47
  121. data/lib/zm/client/tag/tag.rb +3 -9
  122. data/lib/zm/client/tag/tag_jsns_builder.rb +3 -3
  123. data/lib/zm/client/tag/tags_builder.rb +1 -1
  124. data/lib/zm/client/tag/tags_collection.rb +2 -2
  125. data/lib/zm/client/task/task.rb +2 -2
  126. data/lib/zm/client/task/tasks_collection.rb +2 -2
  127. data/lib/zm/client/token.rb +4 -1
  128. data/lib/zm/client/upload.rb +179 -1
  129. data/lib/zm/client/{common/utils.rb → utils.rb} +6 -3
  130. data/lib/zm/client/zm_logger.rb +1 -1
  131. data/lib/zm/client.rb +227 -10
  132. data/lib/zm/connector/network_error_handler.rb +18 -0
  133. data/lib/zm/{client/connector → connector}/rest_connector.rb +46 -40
  134. data/lib/zm/{client/connector/soap_account.rb → connector/soap_account_connector.rb} +15 -17
  135. data/lib/zm/{client/connector/soap_admin.rb → connector/soap_admin_connector.rb} +3 -5
  136. data/lib/zm/connector/soap_base_connector.rb +115 -0
  137. data/lib/zm/connector.rb +13 -0
  138. data/lib/zm/error/auth_error.rb +8 -0
  139. data/lib/zm/error/connection_error.rb +8 -0
  140. data/lib/zm/error/rest_error.rb +8 -0
  141. data/lib/zm/{client/connector → error}/soap_error.rb +1 -10
  142. data/lib/zm/error/zm_error.rb +8 -0
  143. data/lib/zm/error.rb +11 -0
  144. data/lib/zm/relationship/has_many.rb +22 -0
  145. data/lib/zm/relationship/jsns_builder.rb +21 -0
  146. data/lib/zm/relationship/relationship.rb +113 -0
  147. data/lib/zm/relationship/schema.rb +32 -0
  148. data/lib/zm/relationship.rb +5 -0
  149. data/lib/zm/{client/soap_request → soap_request}/request_methods_admin.rb +11 -5
  150. data/lib/zm/{client/soap_request → soap_request}/request_methods_mailbox.rb +1 -1
  151. data/lib/zm/{client/soap_request/account_soap_constants.rb → soap_request/soap_account_constants.rb} +1 -1
  152. data/lib/zm/{client/soap_request/admin_soap_constants.rb → soap_request/soap_admin_constants.rb} +1 -1
  153. data/lib/zm/{client/soap_request → soap_request}/soap_constants.rb +1 -1
  154. data/lib/zm/{client/soap_request → soap_request}/soap_context.rb +13 -5
  155. data/lib/zm/{client/soap_request → soap_request}/soap_element.rb +1 -1
  156. data/lib/zm/{client/soap_request/mail_soap_constants.rb → soap_request/soap_mail_constants.rb} +1 -1
  157. data/lib/zm/soap_request.rb +14 -0
  158. data/lib/zm/support/cache/entry.rb +3 -3
  159. data/lib/zm/support/cache/file_store.rb +4 -6
  160. data/lib/zm/support/cache/null_store.rb +2 -4
  161. data/lib/zm/support/cache/store.rb +17 -9
  162. data/lib/zm/support/cache.rb +13 -8
  163. data/lib/zm/support.rb +7 -0
  164. data/lib/zm/{modules → utils}/belongs_to_folder.rb +1 -1
  165. data/lib/zm/{modules → utils}/belongs_to_tag.rb +2 -2
  166. data/lib/zm/utils/content_part.rb +9 -0
  167. data/lib/zm/utils/content_type.rb +11 -0
  168. data/lib/zm/{modules → utils}/has_soap_admin_connector.rb +1 -1
  169. data/lib/zm/utils/inspector.rb +26 -0
  170. data/lib/zm/utils/log_filter.rb +30 -0
  171. data/lib/zm/utils/missing_method_static_collection.rb +17 -0
  172. data/lib/zm/utils/regex.rb +11 -0
  173. data/lib/zm/utils/search_utils.rb +13 -0
  174. data/lib/zm/utils.rb +16 -0
  175. data/lib/zm-ruby-client.rb +12 -0
  176. data/sig/zm/client/admin_objects.rbs +261 -0
  177. data/sig/zm/client/base.rbs +191 -0
  178. data/sig/zm/client/cluster.rbs +152 -0
  179. data/sig/zm/client/mailbox.rbs +766 -0
  180. data/sig/zm/error.rbs +23 -0
  181. metadata +99 -91
  182. data/.gitignore +0 -59
  183. data/.rubocop.yml +0 -6
  184. data/.ruby-version +0 -1
  185. data/Gemfile +0 -11
  186. data/SECURITY.md +0 -21
  187. data/bin/console +0 -11
  188. data/lib/zm/client/account.rb +0 -9
  189. data/lib/zm/client/ace.rb +0 -7
  190. data/lib/zm/client/appointment.rb +0 -7
  191. data/lib/zm/client/backup.rb +0 -6
  192. data/lib/zm/client/base.rb +0 -21
  193. data/lib/zm/client/cluster.rb +0 -4
  194. data/lib/zm/client/common/message.rb +0 -10
  195. data/lib/zm/client/common.rb +0 -5
  196. data/lib/zm/client/connector/soap_base.rb +0 -104
  197. data/lib/zm/client/constant.rb +0 -229
  198. data/lib/zm/client/contact.rb +0 -11
  199. data/lib/zm/client/cos.rb +0 -10
  200. data/lib/zm/client/datasource.rb +0 -7
  201. data/lib/zm/client/distributionlist.rb +0 -8
  202. data/lib/zm/client/document.rb +0 -7
  203. data/lib/zm/client/domain.rb +0 -10
  204. data/lib/zm/client/filter_rule.rb +0 -7
  205. data/lib/zm/client/folder.rb +0 -14
  206. data/lib/zm/client/identity.rb +0 -7
  207. data/lib/zm/client/license.rb +0 -5
  208. data/lib/zm/client/message/attachments_collection.rb +0 -55
  209. data/lib/zm/client/message/message_flags.rb +0 -115
  210. data/lib/zm/client/message.rb +0 -10
  211. data/lib/zm/client/mountpoint.rb +0 -7
  212. data/lib/zm/client/mta_queue.rb +0 -7
  213. data/lib/zm/client/mta_queue_item.rb +0 -6
  214. data/lib/zm/client/resource.rb +0 -7
  215. data/lib/zm/client/search_folder.rb +0 -7
  216. data/lib/zm/client/server.rb +0 -7
  217. data/lib/zm/client/share.rb +0 -7
  218. data/lib/zm/client/signature.rb +0 -7
  219. data/lib/zm/client/soap_request.rb +0 -11
  220. data/lib/zm/client/tag.rb +0 -8
  221. data/lib/zm/client/task.rb +0 -6
  222. data/lib/zm/client/upload/upload.rb +0 -160
  223. data/lib/zm/modules/base.rb +0 -9
  224. data/lib/zm/modules/common/zimbra-attrs.json +0 -58
  225. data/lib/zm/modules/inspector.rb +0 -24
  226. data/lib/zm/modules/missing_method_static_collection.rb +0 -13
  227. data/lib/zm/modules/zm_model.rb +0 -43
  228. data/zm-ruby-client.gemspec +0 -27
  229. /data/lib/zm/client/mountpoint/{mountpoints_collection.rb → mount_points_collection.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4c2c32c371d0de77fe4892230e967cbba6afc90e0aae91b82af2e4ef9fbc09c
4
- data.tar.gz: e22eb3274715dfe64d2a67c0bbf1df6caf502c51450ae24767f7ed473e041b11
3
+ metadata.gz: 5accd01f014ba998f54c30e0a2daa825442a12efe17463e398613516b3798f6c
4
+ data.tar.gz: 2f3b468efbf5bba59b9493c2c3e9e16820e306b6af92bab8f89a9ba623b21eda
5
5
  SHA512:
6
- metadata.gz: 494f3fd894e55e673bd7e3322718cbe4905caabee6ac5ae92b3968ded15440e8549c4a8240229847005852f1fb99c1ef4e8257ce9e9442b0949032a2578cb715
7
- data.tar.gz: 0ef90ae3f7cb2e75f23b05f314e00d46bdcf398e324e9613ecd1729e63b77f7737b125fa27231038cfa9e2b3a6b67617e39b0ac9f23d864cdefdd3d182f1eef7
6
+ metadata.gz: d17ab24f8f5ef9b0180e1115bcdbe7949aeb0ab139b893597b7ba4f72e0ac611dc67363161b646ff0ead7a726245fadb83c701091b6ac34797aaea74b26db270
7
+ data.tar.gz: 3bcfdb6d64434deca30bf35587ad6b83b95aa424b6fd7a9d6bc4fa4c85fef44361107e039e00794b28da1aab05b9b89958ea43bb06304299059963b6cdae0121
data/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # Changelog
2
2
 
3
+ ## Released [3.1.0]
4
+
5
+ ### [3.1.0] 2026-07
6
+
7
+ #### Upgrading from 3.0
8
+
9
+ - **Ruby 3.3 or newer is required.**
10
+ - **Only `require 'zm-ruby-client'` is supported.** Files were moved and are now autoloaded: requiring internal
11
+ files (`zm/client/...`) no longer works.
12
+ - **Error classes moved from `Zm::Client` to `Zm::Error`.** The 3.0 names still work in 3.1 but print a deprecation
13
+ warning on first use and will be removed in 4.0. Update your `rescue` clauses:
14
+
15
+ | 3.0 (deprecated) | 3.1 |
16
+ |---|---|
17
+ | `Zm::Client::ZmError` | `Zm::Error::ZmError` |
18
+ | `Zm::Client::SoapError` | `Zm::Error::SoapError` |
19
+ | `Zm::Client::AuthError` | `Zm::Error::AuthError` |
20
+ | `Zm::Client::RestError` | `Zm::Error::RestError` |
21
+
22
+ - **Network failures raise `Zm::Error::ConnectionError`** (a `Zm::Error::ZmError`) instead of Faraday errors
23
+ (`Faraday::ConnectionFailed`, `Faraday::TimeoutError`, `Faraday::SSLError`). The Faraday error is kept as `cause`.
24
+ - **Low-level classes moved out of `Zm::Client`.** The 3.0 names are deprecated the same way:
25
+
26
+ | 3.0 (deprecated) | 3.1 |
27
+ |---|---|
28
+ | `Zm::Client::SoapAdminConnector`, `SoapAccountConnector`, `SoapBaseConnector`, `RestConnector` | `Zm::Connector::*` |
29
+ | `Zm::Client::SoapElement`, `SoapConstants`, `SoapAdminConstants`, `SoapAccountConstants`, `SoapMailConstants` | `Zm::SoapRequest::*` |
30
+ | `Zm::Client::SoapUtils` | `Zm::Utils::SearchUtils` |
31
+ | `Zm::Client::Regex`, `ContentType`, `ContentPart` | `Zm::Utils::*` |
32
+
33
+ - **Renamed without alias:** the top-level `GroupContact` and `DocumentFolder` modules are now
34
+ `Zm::Client::ModGroupContact` and `Zm::Client::ModDocumentFolder`.
35
+ - **Removed constants:** `Zm::Client::ShareType`, `FolderType`, `SearchType`, `BackupTypes`, `CountTypes`, `COMMA` and
36
+ `DOUBLEPOINT`. Use the plain values instead, for example `cluster.count_object(:account)` or
37
+ `cluster.count_object('account')`.
38
+ - **`ZimbraAttribute` keeps only `name`, `type`, `immutable?` and `objects_scope`** (plus the `is_*_scoped?`
39
+ predicates): `optionalIn`, `requiredIn`, `flags`, `cardinality`, `callback`, `value`, `max`, `min` and `since` were
40
+ removed, as well as `ZimbraAttributesCollection#all_versioned`. The attributes catalog is read from the CSV file only
41
+ (`zimbra-attrs.json` was removed from the gem).
42
+ - **Cache:** only read requests (`Get*`, `Search*`, `Count*`) are cached and entries are stored with msgpack. Entries
43
+ written by 3.0 are ignored: you can delete the old `file_store` directory.
44
+ - **Stricter arguments:** `Utils.format_email` raises `ArgumentError` on a nil, non-String or blank email, and
45
+ distribution list members `add!`/`remove!` raise `ArgumentError` on nil instead of returning false.
46
+ - **`clone` no longer shares collections with the original:** a cloned distribution list starts with empty `members`
47
+ and `owners` (aliases are rebuilt from `zimbraMailAlias`).
48
+ - **`Contact#l` is a String** (`'7'` for a new contact), like the other mailbox items.
49
+ - TLS certificates are still not verified by default: set `ssl_verify` to enable it.
50
+
51
+ #### Changes
52
+
53
+ - [Added] Deprecated aliases for the 3.0 names moved out of Zm::Client (error classes, connectors, SoapElement, SOAP constants, SoapUtils, Regex, ContentType, ContentPart): they print a warning on first use and will be removed in 4.0
54
+ - [Fixed] Cluster#count_object accepts a String again ('account', as in 3.0) as well as a Symbol
55
+ - [Added] Add live CRUD tests (accounts, account folders, appointments, contacts, identities, messages, signatures and tags, resources, distribution lists, domains, coses) against a real server in test/live, rake test:live task configured by ZIMBRA_ADMIN_URL, ZIMBRA_ADMIN_LOGIN and ZIMBRA_ADMIN_PASSWORD
56
+ - [Fixed] ContactJsnsBuilder no longer sends internal instance variables (updated, token, tags, folder, shared account ids) as contact attributes
57
+ - [Fixed] GroupContactJsnsBuilder: to_create and to_patch raised NameError, the folder is read from l, members are sent without op on creation
58
+ - [Fixed] MessageFlagsCollection: read!, unread!, flag! and unflag! raised NoMethodError (soap_connector called on the message instead of its account)
59
+ - [Changed] MessageFlagsCollection: read!, unread!, flag! and unflag! update the message flags (f) after the request
60
+ - [Fixed] Contact: the default folder (l) is set through l= and is a String like the other mailbox items
61
+ - [Fixed] Base::Object#clone: the copy no longer shares the memoized jsns builder and collections of the original (a clone of a created identity or cos sent the original name), and no longer raises when the original has no id
62
+ - [Added] Add RBS signatures for the public API in sig/ (cluster, config, errors, admin objects and collections, mailbox entry points), rake rbs:validate and rbs:test tasks
63
+ - [Added] Add massive update and delete in admin collection classes
64
+ - [Added] Add optional TLS certificate verification in ClusterConfig (ssl_verify, ssl_ca_file, ssl_ca_path), disabled by default
65
+ - [Changed] Cache only read SOAP requests (Get*, Search*, Count*): write and auth requests are no longer replayed from cache
66
+ - [Changed] Store cache entries with msgpack only (no Marshal), cache files created with 0600 and directories with 0700: existing cache entries are ignored
67
+ - [Fixed] Mask passwords, preauth and auth tokens in debug and verbose HTTP logs
68
+ - [Changed] Raise Zm::Error::ConnectionError (original Faraday error as cause) on connection failure, timeout and SSL error instead of Faraday errors
69
+ - [Fixed] REST download and read error messages were always empty (streamed body), error pages are no longer written to the destination file
70
+ - [Fixed] Alias, distribution list member and owner add!/remove! raised FrozenError on frozen emails and mutated the given strings
71
+ - [Changed] Utils.format_email raises ArgumentError on nil, non-String or blank email instead of NoMethodError
72
+ - [Fixed] Delegated account connector shared the cluster SOAP context: every following admin request carried the account header
73
+ - [Fixed] Server#mailboxes and AccountsCollection#quotas left the target server set on the cluster admin connector
74
+ - [Fixed] MessagesCollection#find_each(secure: true) looped forever when the search request failed
75
+ - [Changed] Replace require by autoload to reduce memory usage
76
+ - [Changed] Share the Zimbra attributes catalog between clusters using the same attributes file (CSV parsed and accessors defined once)
77
+ - [Changed] ZimbraAttribute keeps only name, type, immutable? and objects_scope (catalog memory reduced by about 65%): optionalIn, requiredIn, flags, cardinality, callback, value, max, min and since readers removed
78
+ - [Removed] Remove unused zimbra-attrs.json file from the gem
79
+ - [Removed] Remove ZimbraAttributesCollection#all_versioned (never set, always nil)
80
+ - [Changed] Reduce allocations when building objects from SOAP responses (about 90% fewer for accounts)
81
+ - [Changed] Autoload cache stores and msgpack: the default null_store no longer loads msgpack and FileStore (about 1.2 MB less)
82
+ - [Added] Add Zm::Support::Cache.storage(key), registered_storage may now hold constant names (Symbol) instead of classes
83
+ - [Fixed] Autoload ClusterConfigError and ClusterConfigDomain (NameError when referenced before ClusterConfig was loaded)
84
+ - [Fixed] Autoload Attachment and DlMembership (NameError when referenced before their collection was loaded)
85
+ - [Fixed] Require time explicitly: Time.parse (created_at, last_logon, appointments) only worked because csv loaded it
86
+ - [Fixed] DistributionListMembersCollection add!/remove! raise ArgumentError on nil instead of returning false
87
+ - [Changed] Change code structure files
88
+ - [Changed] Add secure option in messages find_each method
89
+ - [Changed] Require Ruby 3.3 minimum
90
+ - [Changed] Add csv and logger dependencies, remove bundler dependency, pin dependency major versions
91
+ - [Fixed] Fix default zimbra attributes file path in ClusterConfig
92
+ - [Fixed] Remove duplicated Recipient class in MessageRecipients
93
+ - [Fixed] Rename TagBuilder to TagsBuilder to match autoload (account tags raised NameError)
94
+ - [Fixed] Remove duplicated attribute accessors in SearchFolder
95
+ - [Fixed] Accept keyword attributes in admin update!, update_all! and mass_update! (local_transport! raised ArgumentError)
96
+ - [Fixed] Rescue Zm::Error::SoapError in mass_update! and mass_delete! (onerror option raised NameError)
97
+ - [Changed] Fix indentation in several collection classes
98
+
3
99
  ## Released [3.0.0]
4
100
 
5
101
  ### [3.0.0] 2025-12(27)
data/README.md CHANGED
@@ -1,57 +1,158 @@
1
1
  # zm-ruby-client
2
2
 
3
- Library to interface with Zimbra simply.
3
+ [![Gem Version](https://img.shields.io/gem/v/zm-ruby-client)](https://rubygems.org/gems/zm-ruby-client)
4
+ ![Ruby](https://img.shields.io/badge/ruby-3.3%2B-CC342D)
5
+ [![License](https://img.shields.io/badge/license-GPL--3.0-blue)](LICENSE)
4
6
 
5
- Author: Maxime Désécot <maxime.desecot@gmail.com>
7
+ **Zimbra and Carbonio in plain Ruby: code that reads like what it does.**
6
8
 
7
- ## Installation
9
+ ```ruby
10
+ cluster.accounts.find_by(name: 'john@domain.tld').update!(zimbraAccountStatus: 'locked')
11
+ ```
8
12
 
9
- OS: Linux distribution LTS
13
+ No XML, no SOAP envelopes, no token juggling. Read the line out loud, that's what it does.
10
14
 
11
- Language: Ruby3.2+
15
+ - **Readable**: short verbs (`find_by`, `where`, `save!`, `update!`, `delete!`) and chainable queries.
16
+ - **Complete**: admin side (accounts, domains, COS, distribution lists, servers…) and mailbox side
17
+ (messages, folders, contacts, calendars, tags, shares…), over both SOAP and REST.
18
+ - **Lightweight**: Ruby 3.3+, few dependencies, code autoloaded on demand.
19
+
20
+ ## Install
12
21
 
13
22
  ```bash
14
23
  gem install zm-ruby-client
15
24
  ```
16
25
 
17
- ## Examples of uses:
18
-
19
- ### Connection:
26
+ ## Connect
20
27
 
21
28
  ```ruby
22
- cluster = Zm::Client::Cluster.new(Zm::Client::ClusterConfig.new('config.json'))
23
- cluster.login
24
- ````
25
- or
26
- ```ruby
29
+ require 'zm-ruby-client'
30
+
27
31
  config = Zm::Client::ClusterConfig.new do |cc|
28
- cc.zimbra_admin_url = 'https://mail.domain.tld:7071'
29
- cc.zimbra_admin_login = 'admin@domain.tld'
32
+ cc.zimbra_admin_url = 'https://mail.domain.tld:7071'
33
+ cc.zimbra_admin_login = 'admin@domain.tld'
30
34
  cc.zimbra_admin_password = 'secret'
31
35
  end
36
+
32
37
  cluster = Zm::Client::Cluster.new(config)
33
38
  cluster.login
34
- ````
39
+ ```
40
+
41
+ Prefer a file? `Zm::Client::ClusterConfig.new('config.json')` (or `.yml`), see [examples/config.json](examples/config.json).
42
+
43
+ TLS certificates are not verified by default. To enable verification:
44
+
45
+ ```ruby
46
+ cc.ssl_verify = true
47
+ cc.ssl_ca_file = '/etc/ssl/certs/zimbra-ca.pem' # optional, for a private CA (or ssl_ca_path)
48
+ ```
35
49
 
36
- ### List all accounts
50
+ ## Feel the difference
51
+
52
+ **Find an account, change it.**
53
+
54
+ ```ruby
55
+ account = cluster.accounts.find_by name: 'john@domain.tld'
56
+ account.zimbraAccountStatus # => "active"
57
+
58
+ account.update!(zimbraAccountStatus: 'locked')
59
+ ```
60
+
61
+ **Query LDAP like a database.** Pagination is handled for you.
62
+
63
+ ```ruby
64
+ cluster.accounts
65
+ .where('(zimbraLastLogonTimestamp<=20250101000000Z)')
66
+ .attrs('zimbraLastLogonTimestamp')
67
+ .find_each { |account| puts "#{account.name} last seen #{account.last_logon}" }
68
+ ```
69
+
70
+ **Lock every dormant account. One line.**
37
71
 
38
72
  ```ruby
39
- filter = '(&(mail=*@domain.tld)(zimbraLastLogonTimestamp<=20190225000000Z))'
40
- accounts = cluster.accounts.where(filter).all
73
+ cluster.accounts.where('(zimbraLastLogonTimestamp<=20250101000000Z)').update_all!(zimbraAccountStatus: 'locked')
41
74
  ```
42
75
 
43
- ### Find an account
76
+ **Step into any mailbox, no user password needed.**
44
77
 
45
78
  ```ruby
46
- account = cluster.accounts.find_by name: 'maxime@domain.tld'
79
+ account.login
80
+
81
+ account.messages.where('is:unread from:boss@domain.tld').all.each do |message|
82
+ puts "#{message.date} #{message.su}"
83
+ end
47
84
  ```
48
85
 
49
- ### Create an account
86
+ **Create anything with a block.**
50
87
 
51
88
  ```ruby
52
- account = Zm::Client::Account.new(cluster) do |acc|
53
- acc.name = 'maxime@domain.tld'
89
+ folder = account.folders.new do |f|
90
+ f.name = 'Invoices'
91
+ f.color = 3
54
92
  end
55
- account.zimbraMailQuota = 0
56
- account.save
57
- ```
93
+ folder.save!
94
+ ```
95
+
96
+ **Import and export whole folders.**
97
+
98
+ ```ruby
99
+ account.folders.find(10).upload('holidays.ics') # Calendar
100
+ account.folders.find(2).download('inbox.tgz') # Inbox backup
101
+ account.folders.find(7).export_contacts # Contacts, as CSV
102
+ ```
103
+
104
+ **Ask quick questions.**
105
+
106
+ ```ruby
107
+ cluster.email_exist?('john@domain.tld') # => true
108
+ cluster.accounts.where('(mail=*@domain.tld)').count # => 1250
109
+ ```
110
+
111
+ ## Type signatures
112
+
113
+ RBS signatures for the public API are shipped in `sig/`. [rbs collection](https://github.com/ruby/rbs) picks them up
114
+ from the installed gem, for use with [Steep](https://github.com/soutaro/steep) or your editor:
115
+
116
+ ```bash
117
+ bundle exec rbs collection install
118
+ ```
119
+
120
+ ## Upgrading from 3.0
121
+
122
+ 3.1 requires Ruby 3.3, moves the error classes to `Zm::Error` (`rescue Zm::Error::SoapError`) and raises
123
+ `Zm::Error::ConnectionError` on network failures. The 3.0 names (`Zm::Client::SoapError`…) still work but print a
124
+ deprecation warning: they will be removed in 4.0. See the [upgrade notes](CHANGELOG.md#upgrading-from-30) for the
125
+ full list.
126
+
127
+ ## Development
128
+
129
+ ```bash
130
+ bundle install
131
+ bundle exec rake test # offline unit tests, no server needed
132
+ bundle exec rake rbs:validate # check the RBS signatures
133
+ bundle exec rake rbs:test # unit tests with RBS runtime type checking
134
+ bundle exec rubocop
135
+ ```
136
+
137
+ **Live tests** run real CRUD operations (accounts, domains, COS, distribution lists, resources, and the folders,
138
+ messages, contacts, appointments, tags, signatures and identities of an account) against a Zimbra or Carbonio server:
139
+
140
+ ```bash
141
+ ZIMBRA_ADMIN_URL=https://mail.domain.tld:7071 \
142
+ ZIMBRA_ADMIN_LOGIN=admin@domain.tld \
143
+ ZIMBRA_ADMIN_PASSWORD=secret \
144
+ bundle exec rake test:live
145
+ ```
146
+
147
+ Each test creates its own data (accounts, lists and resources in a temporary `zmlive-*.test` domain) and deletes it
148
+ afterwards, even when the test fails. They are skipped when a variable is missing. Set `ZIMBRA_LOG_PATH=/dev/stdout`
149
+ to see the SOAP requests. Use a test server: the tests need full admin rights and create and delete domains.
150
+
151
+ ## Learn more
152
+
153
+ - [examples/](examples): ready-to-run scripts
154
+ - [CHANGELOG.md](CHANGELOG.md): what's new
155
+
156
+ ## License
157
+
158
+ GPL-3.0, by Maxime Désécot.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.1
1
+ 3.1.0
@@ -1,23 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'zm/client/account/account_aliases_collection'
4
-
5
3
  module Zm
6
4
  module Client
7
5
  # objectClass: zimbraAccount
8
6
  class Account < Base::MailboxObject
9
- include RequestMethodsAdmin
7
+ include SoapRequest::RequestMethodsAdmin
10
8
 
11
9
  # #################################################################
12
10
  # Associations
13
11
  # #################################################################
14
12
 
15
- def aliases
16
- return @aliases if defined? @aliases
17
-
18
- @aliases = AccountAliasesCollection.new(self)
19
- end
20
-
21
13
  def cos
22
14
  return @cos if defined? @cos
23
15
 
@@ -45,12 +37,12 @@ module Zm
45
37
  end
46
38
 
47
39
  def build_flush_cache
48
- soap_request = SoapElement.admin(SoapAdminConstants::FLUSH_CACHE_REQUEST)
49
- node_cache = SoapElement.create('cache')
50
- .add_attributes({ type: SoapConstants::ACCOUNT, allServers: SoapUtils::ON })
40
+ soap_request = Zm::SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::FLUSH_CACHE_REQUEST)
41
+ node_cache = Zm::SoapRequest::SoapElement.create('cache')
42
+ .add_attributes({ type: Zm::SoapRequest::SoapConstants::ACCOUNT, allServers: Zm::Utils::SearchUtils::ON })
51
43
  soap_request.add_node(node_cache)
52
- node_entry = SoapElement.create('entry')
53
- .add_attribute(SoapConstants::BY, SoapConstants::ID)
44
+ node_entry = Zm::SoapRequest::SoapElement.create('entry')
45
+ .add_attribute(Zm::SoapRequest::SoapConstants::BY, SoapRequest::SoapConstants::ID)
54
46
  .add_content(@id)
55
47
  node_cache.add_node(node_entry)
56
48
  soap_request
@@ -60,11 +52,7 @@ module Zm
60
52
  @parent.zimbra_attributes.all_account_attrs_writable_names
61
53
  end
62
54
 
63
- def jsns_builder
64
- return @jsns_builder if defined? @jsns_builder
65
-
66
- @jsns_builder = AccountJsnsBuilder.new(self)
67
- end
55
+ has_jsns_builder
68
56
 
69
57
  def batch
70
58
  return @batch if defined? @batch
@@ -72,6 +60,11 @@ module Zm
72
60
  @batch = BatchRequest.new(soap_account_connector)
73
61
  end
74
62
 
63
+ def empty_dumpster!
64
+ soap_request = Zm::SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::EMPTY_DUMPSTER_REQUEST)
65
+ soap_connector.invoke(soap_request)
66
+ end
67
+
75
68
  private
76
69
 
77
70
  def do_update!(hash)
@@ -14,7 +14,8 @@ module Zm
14
14
  end
15
15
 
16
16
  def add!(email)
17
- return false if all.include?(Utils.format_email(email))
17
+ email = Utils.format_email(email)
18
+ return false if all.include?(email)
18
19
 
19
20
  @parent.sac.invoke(build_add(email))
20
21
 
@@ -23,13 +24,14 @@ module Zm
23
24
  end
24
25
 
25
26
  def build_add(email)
26
- soap_request = SoapElement.admin(SoapAdminConstants::ADD_ACCOUNT_ALIAS_REQUEST)
27
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::ADD_ACCOUNT_ALIAS_REQUEST)
27
28
  soap_request.add_attributes({ id: @parent.id, alias: email })
28
29
  soap_request
29
30
  end
30
31
 
31
32
  def remove!(email)
32
- return false unless all.include?(Utils.format_email(email))
33
+ email = Utils.format_email(email)
34
+ return false unless all.include?(email)
33
35
 
34
36
  @parent.sac.invoke(build_remove(email))
35
37
 
@@ -38,7 +40,7 @@ module Zm
38
40
  end
39
41
 
40
42
  def build_remove(email)
41
- soap_request = SoapElement.admin(SoapAdminConstants::REMOVE_ACCOUNT_ALIAS_REQUEST)
43
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::REMOVE_ACCOUNT_ALIAS_REQUEST)
42
44
  soap_request.add_attributes({ id: @parent.id, alias: email })
43
45
  soap_request
44
46
  end
@@ -5,6 +5,7 @@ module Zm
5
5
  # Collection Account dls membership
6
6
  class AccountDlsMembershipCollection < Base::ObjectsCollection
7
7
  def initialize(parent)
8
+ super()
8
9
  @parent = parent
9
10
  end
10
11
 
@@ -13,9 +14,9 @@ module Zm
13
14
  end
14
15
 
15
16
  def build_query
16
- soap_request = SoapElement.admin(SoapAdminConstants::GET_ACCOUNT_MEMBERSHIP_REQUEST)
17
- node_account = SoapElement.create(SoapConstants::ACCOUNT)
18
- .add_attribute(SoapConstants::BY, SoapConstants::ID)
17
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_ACCOUNT_MEMBERSHIP_REQUEST)
18
+ node_account = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACCOUNT)
19
+ .add_attribute(SoapRequest::SoapConstants::BY, SoapRequest::SoapConstants::ID)
19
20
  .add_content(@parent.id)
20
21
  soap_request.add_node(node_account)
21
22
  soap_request
@@ -5,6 +5,7 @@ module Zm
5
5
  # Collection Account dls membership
6
6
  class AccountDlsOwnerCollection < Base::ObjectsCollection
7
7
  def initialize(parent)
8
+ super()
8
9
  @parent = parent
9
10
  end
10
11
 
@@ -15,10 +16,10 @@ module Zm
15
16
  def build_query
16
17
  jsns = {
17
18
  query: "(zimbraACE=#{@parent.id} usr ownDistList)",
18
- types: SearchType::DL
19
+ types: :distributionlists
19
20
  }
20
21
 
21
- SoapElement.admin(SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
22
+ SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
22
23
  .add_attributes(jsns)
23
24
  end
24
25
 
@@ -15,7 +15,7 @@ module Zm
15
15
  }
16
16
  req.compact!
17
17
 
18
- soap_request = SoapElement.admin(SoapAdminConstants::CREATE_ACCOUNT_REQUEST)
18
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::CREATE_ACCOUNT_REQUEST)
19
19
  .add_attributes(req)
20
20
 
21
21
  add_soap_request_nodes(soap_request)
@@ -32,15 +32,15 @@ module Zm
32
32
  end
33
33
 
34
34
  def add_soap_request_node(soap_request, key, value)
35
- node_attr = SoapElement.create(SoapConstants::A)
36
- .add_attribute(SoapConstants::N, key)
35
+ node_attr = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::A)
36
+ .add_attribute(SoapRequest::SoapConstants::N, key)
37
37
  .add_content(value)
38
38
  soap_request.add_node(node_attr)
39
39
  end
40
40
 
41
41
  def to_update
42
- soap_request = SoapElement.admin(SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
43
- .add_attribute(SoapConstants::ID, @item.id)
42
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
43
+ .add_attribute(SoapRequest::SoapConstants::ID, @item.id)
44
44
 
45
45
  add_soap_request_nodes(soap_request)
46
46
 
@@ -48,8 +48,8 @@ module Zm
48
48
  end
49
49
 
50
50
  def to_patch(hash)
51
- soap_request = SoapElement.admin(SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
52
- .add_attribute(SoapConstants::ID, @item.id)
51
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
52
+ .add_attribute(SoapRequest::SoapConstants::ID, @item.id)
53
53
 
54
54
  hash.each do |key, values|
55
55
  values = [values] unless values.is_a?(Array)
@@ -62,12 +62,12 @@ module Zm
62
62
  end
63
63
 
64
64
  def to_delete
65
- SoapElement.admin(SoapAdminConstants::DELETE_ACCOUNT_REQUEST)
66
- .add_attribute(SoapConstants::ID, @item.id)
65
+ SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::DELETE_ACCOUNT_REQUEST)
66
+ .add_attribute(SoapRequest::SoapConstants::ID, @item.id)
67
67
  end
68
68
 
69
69
  def to_rename(new_name)
70
- SoapElement.admin(SoapAdminConstants::RENAME_ACCOUNT_REQUEST)
70
+ SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::RENAME_ACCOUNT_REQUEST)
71
71
  .add_attributes({ id: @item.id, newName: new_name })
72
72
  end
73
73
 
@@ -7,7 +7,7 @@ module Zm
7
7
  def initialize(parent)
8
8
  @child_class = Account
9
9
  @builder_class = AccountsBuilder
10
- @search_type = SearchType::ACCOUNT
10
+ @search_type = :accounts
11
11
  super
12
12
  end
13
13
 
@@ -19,24 +19,20 @@ module Zm
19
19
  end
20
20
 
21
21
  def build_find_by(hash)
22
- soap_request = SoapElement.admin(SoapAdminConstants::GET_ACCOUNT_REQUEST)
23
- node_account = SoapElement.create(SoapConstants::ACCOUNT)
24
- .add_attribute(SoapConstants::BY, hash.keys.first)
22
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_ACCOUNT_REQUEST)
23
+ node_account = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACCOUNT)
24
+ .add_attribute(SoapRequest::SoapConstants::BY, hash.keys.first)
25
25
  .add_content(hash.values.first)
26
26
  soap_request.add_node(node_account)
27
- soap_request.add_attribute(SoapConstants::ATTRS, attrs_comma)
28
- soap_request.add_attribute(SoapConstants::APPLY_COS, @apply_cos)
27
+ soap_request.add_attribute(SoapRequest::SoapConstants::ATTRS, attrs_comma)
28
+ soap_request.add_attribute(SoapRequest::SoapConstants::APPLY_COS, @apply_cos)
29
29
  soap_request
30
30
  end
31
31
 
32
32
  def quotas(domain_name: @domain_name, target_server_id: @target_server_id)
33
33
  return nil if domain_name.nil? && target_server_id.nil?
34
34
 
35
- if target_server_id.nil?
36
- @all_servers = SoapUtils::ON
37
- else
38
- sac.context.target_server(target_server_id)
39
- end
35
+ @all_servers = Zm::Utils::SearchUtils::ON if target_server_id.nil?
40
36
 
41
37
  jsns = {
42
38
  domain: domain_name,
@@ -49,11 +45,9 @@ module Zm
49
45
  }
50
46
  jsns.compact!
51
47
 
52
- soap_request = SoapElement.admin(SoapAdminConstants::GET_QUOTA_USAGE_REQUEST)
48
+ soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_QUOTA_USAGE_REQUEST)
53
49
  .add_attributes(jsns)
54
- json = sac.invoke(soap_request)
55
-
56
- sac.context.target_server(nil) unless target_server_id.nil?
50
+ json = target_server_id.nil? ? sac.invoke(soap_request) : sac.target_invoke(soap_request, target_server_id)
57
51
 
58
52
  reset_query_params
59
53
  @builder_class.new(@parent, json).make
@@ -63,7 +57,24 @@ module Zm
63
57
 
64
58
  def reset_query_params
65
59
  super
66
- @attrs = SearchType::Attributes::ACCOUNT.dup
60
+ @attrs = %w[
61
+ displayName
62
+ zimbraId
63
+ cn
64
+ sn
65
+ zimbraMailHost
66
+ uid
67
+ zimbraCOSId
68
+ zimbraAccountStatus
69
+ zimbraLastLogonTimestamp
70
+ description
71
+ zimbraIsSystemAccount
72
+ zimbraIsDelegatedAdminAccount
73
+ zimbraAuthTokenValidityValue
74
+ zimbraMailStatus
75
+ zimbraIsAdminAccount
76
+ zimbraIsExternalVirtualAccount
77
+ ]
67
78
  end
68
79
  end
69
80
  end
@@ -4,6 +4,9 @@ module Zm
4
4
  module Client
5
5
  # class account ace
6
6
  class Ace < Base::Object
7
+ extend Zm::Relationship
8
+ has_jsns_builder
9
+
7
10
  GT_USER = 'usr'
8
11
  GT_GROUP = 'grp'
9
12
  GT_DOMAIN = 'dom'
@@ -24,12 +27,6 @@ module Zm
24
27
  @parent.soap_connector.invoke(jsns_builder.to_delete)
25
28
  true
26
29
  end
27
-
28
- def jsns_builder
29
- return @jsns_builder if defined? @jsns_builder
30
-
31
- @jsns_builder = AceJsnsBuilder.new(self)
32
- end
33
30
  end
34
31
  end
35
32
  end
@@ -5,21 +5,21 @@ module Zm
5
5
  # class for account ace jsns builder
6
6
  class AceJsnsBuilder < Base::BaseJsnsBuilder
7
7
  def to_find
8
- soap_request = SoapElement.account(SoapAccountConstants::GET_RIGHTS_REQUEST)
8
+ soap_request = SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::GET_RIGHTS_REQUEST)
9
9
 
10
- soap_request.add_attribute(SoapConstants::ACE, @item.rights.map { |r| { right: r } }) unless @item.rights.empty?
10
+ soap_request.add_attribute(SoapRequest::SoapConstants::ACE, @item.rights.map { |r| { right: r } }) unless @item.rights.empty?
11
11
 
12
12
  soap_request
13
13
  end
14
14
 
15
15
  def to_jsns
16
- SoapElement.account(SoapAccountConstants::GRANT_RIGHTS_REQUEST)
17
- .add_attribute(SoapConstants::ACE, attrs)
16
+ SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::GRANT_RIGHTS_REQUEST)
17
+ .add_attribute(SoapRequest::SoapConstants::ACE, attrs)
18
18
  end
19
19
 
20
20
  def to_delete
21
- SoapElement.account(SoapAccountConstants::REVOKE_RIGHTS_REQUEST)
22
- .add_attribute(SoapConstants::ACE, attrs)
21
+ SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::REVOKE_RIGHTS_REQUEST)
22
+ .add_attribute(SoapRequest::SoapConstants::ACE, attrs)
23
23
  end
24
24
 
25
25
  def attrs