zm-ruby-client 2.2.3 → 2.2.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2e230cc508aac1aed324b8af691d7d681e110f9e7124b048e84c917c28863a2
4
- data.tar.gz: c481a9f54e7f13d8c0d9d8ca00ffe457958f7a76379fe13f35a8fa7451e92bd2
3
+ metadata.gz: a5a4bebcb7800be6b55381b31b54478860b70e5362c54791176efaa191acc660
4
+ data.tar.gz: 5fde40a0299e54e83590991d73dbc38fe91b4b23af26e1d4730ebb4b8057e179
5
5
  SHA512:
6
- metadata.gz: 8a1efc8ec41c509af9e1f395725ec4a38c4366c2685b582c82529ef8994f397ab80cf5f4e0efc9b75f9068bde8d1e0ce4d631f748f054a1848751ef158851802
7
- data.tar.gz: 381740a42f02a55c4b96d93ea34cdc7272b659af6a9bba6a020f82910020ea28c153ff47906204f7d077ea8eadab66bbcf75ba0fbd3da3944dd1710d5bb1f432
6
+ metadata.gz: e39fc183d251eb1c2ea95735dc3fc75ddee51d8e8528c326db7dc15ac234479da40cad1e3d3bdeed949e7c46cbe3d3dc53178d5dc48f54cfcc2b6b4a4a4bc335
7
+ data.tar.gz: ebb4ddfa47b3053f46bd80728584c6b7cc5b95d4d87f55aa2eb476bfd434faa86e52ed9aa67ceadd7bda2b091c902c792e011f3d2e314eeb768283ae77ac7065
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## Unreleased [3.0.0]
4
+
5
+ ### [3.0.0] 2025-04-14
6
+
7
+ - [Changed] Move token metadata decoder in token class
8
+ - [Changed] Move logger in ClusterConfig class
9
+ - [Added] Add color in logger
10
+ - [Added] Add NoOpRequest for Mailbox object as alive? method
11
+ - [Changed] Remove @all memorization
12
+ - [Added] Add BatchRequest on Cluster and Account class
13
+ - [Changed] Authorize array and undetermined parameters for add! and remove! methods
data/Gemfile CHANGED
@@ -1,8 +1,16 @@
1
1
  source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2
3
 
3
- ruby ">= 2.7"
4
+ ruby ">= 3.1"
4
5
 
5
6
  gem 'addressable', '2.8.7'
6
- gem 'faraday', '2.8.1'
7
+ gem 'faraday', '~>2.12'
7
8
  gem 'faraday-multipart', '1.0.4'
8
9
  gem 'version_sorter', '2.3.0'
10
+
11
+ group :development do
12
+ gem "rubocop"
13
+ gem "solargraph"
14
+ gem "yard"
15
+ gem "benchmark-ips"
16
+ end
data/README.md CHANGED
@@ -19,7 +19,8 @@ gem install zm-ruby-client
19
19
  ### Connection:
20
20
 
21
21
  ```ruby
22
- admin = Zm::Client::Cluster.new(Zm::Client::ClusterConfig.new('config.json'))
22
+ config = Zm::Client::ClusterConfig.new('config.json')
23
+ admin = Zm::Client::Cluster.new(config)
23
24
  admin.login
24
25
  ````
25
26
  or
@@ -27,7 +28,7 @@ or
27
28
  config = Zm::Client::ClusterConfig.new do |cc|
28
29
  cc.zimbra_admin_host = 'mail.domain.tld'
29
30
  cc.zimbra_admin_scheme = 'https'
30
- cc.zimbra_admin_port = 443
31
+ cc.zimbra_admin_port = 7071
31
32
  cc.zimbra_admin_login = 'admin@domain.tld'
32
33
  cc.zimbra_admin_password = 'secret'
33
34
  end
@@ -53,7 +54,9 @@ account = admin.accounts.find_by name: 'maxime@domain.tld'
53
54
  ```ruby
54
55
  account = Zm::Client::Account.new(admin) do |acc|
55
56
  acc.name = 'maxime@domain.tld'
57
+ acc.givenName = 'Maxime'
58
+ acc.sn = 'DÉSÉCOT'
56
59
  end
57
- account.zimbraMailQuota = 0
60
+
58
61
  account.save
59
62
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.2.6
@@ -51,6 +51,7 @@ module Zm
51
51
  end
52
52
 
53
53
  def where(*rights)
54
+ rights.flatten!
54
55
  @rights += rights
55
56
  @rights.uniq!
56
57
  self
@@ -34,6 +34,7 @@ module Zm
34
34
  end
35
35
 
36
36
  def folders(*folders)
37
+ folders.flatten!
37
38
  folders.select! { |folder| folder.is_a?(Zm::Client::Folder) }
38
39
  return self if folders.empty?
39
40
 
@@ -42,6 +43,7 @@ module Zm
42
43
  end
43
44
 
44
45
  def folder_ids(*folder_ids)
46
+ folder_ids.flatten!
45
47
  folder_ids.uniq!
46
48
  return self if @folder_ids == folder_ids
47
49
 
@@ -23,11 +23,13 @@ module Zm
23
23
  end
24
24
 
25
25
  def sections(*entries)
26
+ entries.flatten!
26
27
  @sections += entries
27
28
  self
28
29
  end
29
30
 
30
31
  def rights(*entries)
32
+ entries.flatten!
31
33
  @rights += entries
32
34
  self
33
35
  end
@@ -83,10 +83,9 @@ module Zm
83
83
  end
84
84
 
85
85
  def domain_key
86
- return @domain_key if @domain_key
87
- return @parent.domain_key(domain_name) if @parent.logged?
86
+ return @domain_key if defined?(@domain_key)
88
87
 
89
- nil
88
+ @parent.domain_key(domain_name)
90
89
  end
91
90
 
92
91
  def login
@@ -22,6 +22,7 @@ module Zm
22
22
  end
23
23
 
24
24
  def preferences(*entries)
25
+ entries.flatten!
25
26
  @preferences += entries
26
27
  self
27
28
  end
@@ -106,9 +106,11 @@ module Zm
106
106
  alias distribution_lists distributionlists
107
107
 
108
108
  def domain_key(domain_name)
109
- key = @config.domain_key(domain_name)
110
- key ||= find_domain_key(domain_name)
111
- key
109
+ if logged?
110
+ find_domain_key(domain_name)
111
+ else
112
+ @config.domain_key(domain_name)
113
+ end
112
114
  end
113
115
 
114
116
  def count_object(type)
@@ -10,7 +10,14 @@ module Zm
10
10
  GROUP_PATTERN = 'group'
11
11
 
12
12
  attr_accessor :anniversary, :assistantPhone, :birthday, :callbackPhone, :carPhone, :company, :companyPhone,
13
- :custom1, :department, :email, :email2, :email3, :email4, :email5, :email6, :email7, :firstName, :fullName, :homeCity, :homeCountry, :homeFax, :homePhone, :homePostalCode, :homeState, :homeStreet, :homeURL, :imAddress1, :imAddress2, :imAddress3, :imAddress4, :imAddress5, :jobTitle, :lastName, :maidenName, :middleName, :mobilePhone, :namePrefix, :nameSuffix, :nickname, :notes, :otherCity, :otherCountry, :otherFax, :otherPhone, :otherPostalCode, :otherState, :otherStreet, :otherURL, :pager, :workCity, :workCountry, :workFax, :workPhone, :workPostalCode, :workState, :workStreet, :workURL, :image, :id, :name, :l, :type, :tn, :shared_account_id, :shared_folder_account_id
13
+ :custom1, :department, :email, :email2, :email3, :email4, :email5, :email6, :email7, :firstName,
14
+ :fullName, :homeCity, :homeCountry, :homeFax, :homePhone, :homePostalCode, :homeState, :homeStreet,
15
+ :homeURL, :imAddress1, :imAddress2, :imAddress3, :imAddress4, :imAddress5, :jobTitle, :lastName,
16
+ :maidenName, :middleName, :mobilePhone, :namePrefix, :nameSuffix, :nickname, :notes, :otherCity,
17
+ :otherCountry, :otherFax, :otherPhone, :otherPostalCode, :otherState, :otherStreet, :otherURL,
18
+ :pager, :workCity, :workCountry, :workFax, :workPhone, :workPostalCode, :workState, :workStreet,
19
+ :workURL, :image, :id, :name, :l, :type, :tn, :shared_account_id, :shared_folder_account_id,
20
+ :fileAs
14
21
 
15
22
  def initialize(parent)
16
23
  @l = FolderDefault::CONTACTS[:id]
@@ -7,11 +7,13 @@ module Zm
7
7
  EXCLUDE_INSTANCE_VARIABLE_KEYS = %i[@id @name @parent @l @type @tn @jsns_builder].freeze
8
8
 
9
9
  def to_jsns
10
- {
10
+ jsns = {
11
11
  cn: {
12
12
  a: instance_variables_array.map(&Utils::A_NODE_PROC),
13
13
  l: @item.folder_id || Zm::Client::FolderDefault::CONTACTS[:id],
14
- m: members_node
14
+ m: @item.members.all.map do |m|
15
+ { type: m.type, value: m.value }
16
+ end
15
17
  }
16
18
  }
17
19
 
@@ -23,7 +25,9 @@ module Zm
23
25
  cn: {
24
26
  a: instance_variables_array.map(&Utils::A_NODE_PROC),
25
27
  id: @item.id,
26
- m: members_node
28
+ m: @item.members.all.reject(&:current?).map do |m|
29
+ { type: m.type, value: m.value, op: m.op }
30
+ end
27
31
  }
28
32
  }
29
33
 
@@ -31,7 +35,7 @@ module Zm
31
35
  end
32
36
 
33
37
  def to_patch(hash)
34
- {
38
+ jsns = {
35
39
  cn: {
36
40
  id: @item.id,
37
41
  a: hash.map(&Utils::A_ARRAY_PROC).flatten(1).map(&Utils::A_NODE_PROC)
@@ -43,14 +47,14 @@ module Zm
43
47
 
44
48
  alias to_create to_jsns
45
49
 
46
- def members_node
47
- @item.members.all.reject(&:current?).map do |m|
48
- { type: m.type, value: m.value, op: m.op }
49
- end
50
- end
50
+ # def members_node
51
+ # @item.members.all.reject(&:current?).map do |m|
52
+ # { type: m.type, value: m.value, op: m.op }
53
+ # end
54
+ # end
51
55
 
52
56
  def instance_variables_array
53
- [[:nickname, @item.name], [:fullname, @item.name], [:fileAs, "8:#{@item.name}"], %i[type group]]
57
+ [[:nickname, @item.name], [:fullName, @item.name], [:fileAs, "8:#{@item.name}"], %i[type group]]
54
58
  end
55
59
  end
56
60
  end
@@ -19,6 +19,7 @@ module Zm
19
19
  end
20
20
 
21
21
  def add!(*servers)
22
+ servers.flatten!
22
23
  server_ids = server_ids(servers)
23
24
  server_ids.delete_if { |id| @parent.zimbraMailHostPool.include?(id) }
24
25
  return false if server_ids.empty?
@@ -31,6 +32,7 @@ module Zm
31
32
  end
32
33
 
33
34
  def remove!(*servers)
35
+ servers.flatten!
34
36
  server_ids = server_ids(servers)
35
37
  server_ids.delete_if { |id| !@parent.zimbraMailHostPool.include?(id) }
36
38
  return false if server_ids.empty?
@@ -12,6 +12,7 @@ module Zm
12
12
  end
13
13
 
14
14
  def add!(*emails)
15
+ emails.flatten!
15
16
  emails.each { |email| Utils.format_email(email) }
16
17
  emails.delete_if { |email| @all.include?(email) }
17
18
  return false if emails.empty?
@@ -23,6 +24,7 @@ module Zm
23
24
  end
24
25
 
25
26
  def remove!(*emails)
27
+ emails.flatten!
26
28
  emails.each { |email| Utils.format_email(email) }
27
29
  emails.delete_if { |email| !@all.include?(email) }
28
30
  return false if emails.empty?
@@ -17,6 +17,7 @@ module Zm
17
17
  end
18
18
 
19
19
  def add!(*new_tags)
20
+ new_tags.flatten!
20
21
  Utils.map_format(new_tags, String, :name)
21
22
  return false if new_tags.delete_if { |tag_name| all.include?(tag_name) }.empty?
22
23
 
@@ -35,6 +36,7 @@ module Zm
35
36
  end
36
37
 
37
38
  def remove!(*tag_names)
39
+ tag_names.flatten!
38
40
  Utils.map_format(tag_names, String, :name)
39
41
  return false if tag_names.delete_if { |tag_name| !all.include?(tag_name) }.empty?
40
42
 
@@ -124,7 +124,7 @@ zimbraPrefTimeZoneId,"account,cos,domain","accountCosDomainInherited,domainAdmin
124
124
  zimbraPrefUseTimeZoneListInCalendar,"account,cos","accountInherited,domainAdminModifiable",,single,,,boolean,,,,
125
125
  zimbraPrefCalendarInitialView,"account,cos","accountInherited,domainAdminModifiable",,single,,,enum,"day,week,workWeek,month,list,year",,,
126
126
  zimbraPrefImapSearchFoldersEnabled,"account,cos","accountInherited,domainAdminModifiable",,single,,,boolean,,,,
127
- zimbraMailTransport,mailRecipient,,,single,,,astring,,320,,
127
+ zimbraMailTransport,"mailRecipient,domain",,,single,,,astring,,320,,
128
128
  zimbraAuthLdapExternalDn,account,domainAdminModifiable,,single,,,,,256,,
129
129
  zimbraPrefHtmlEditorDefaultFontFamily,"account,cos","accountInherited,domainAdminModifiable",,single,,,,,64,,
130
130
  zimbraPrefHtmlEditorDefaultFontSize,"account,cos","accountInherited,domainAdminModifiable",,single,,,astring,,32,,
@@ -733,4 +733,5 @@ zimbraPrefDefaultCalendarId,"account,cos,calendarResource",,,single,,,cstring,,,
733
733
  zimbraRecoveryAccountCodeValidity,"account,cos,calendarResource",,,single,,,cstring,,,,
734
734
  zimbraResetPasswordRecoveryCodeExpiry,"account,cos,calendarResource",,,single,,,cstring,,,,
735
735
  zimbraShowClientTOS,"account,domain,cos,calendarResource",,,single,,,cstring,,,,
736
- zimbraDistributionListSendShareMessageToNewMembers,distributionList,,,single,,,boolean,,,,
736
+ zimbraDistributionListSendShareMessageToNewMembers,distributionList,,,single,,,boolean,,,,
737
+ zimbraServiceEnabled,,,server,multi,,,cstring,,,,
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.add_dependency 'addressable', '2.8.7'
28
28
  s.add_dependency 'version_sorter', '2.3.0'
29
- s.add_dependency 'faraday', '2.8.1'
29
+ s.add_dependency 'faraday', '>= 2.8.1'
30
30
  s.add_dependency 'faraday-multipart', '1.0.4'
31
31
  s.add_dependency "bundler", ">= 1.15.0"
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zm-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Désécot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.8.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.8.1
55
55
  - !ruby/object:Gem::Dependency
@@ -87,6 +87,7 @@ extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
89
  - ".gitignore"
90
+ - CHANGELOG.md
90
91
  - Gemfile
91
92
  - LICENSE
92
93
  - README.md
@@ -340,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
341
  - !ruby/object:Gem::Version
341
342
  version: 1.8.11
342
343
  requirements: []
343
- rubygems_version: 3.1.6
344
+ rubygems_version: 3.4.10
344
345
  signing_key:
345
346
  specification_version: 4
346
347
  summary: zm-ruby-client