jabber_admin 2.1.0 → 2.2.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -34
- data/CHANGELOG.md +4 -0
- data/Envfile +1 -0
- data/LICENSE +1 -1
- data/lib/jabber_admin/api_call.rb +3 -8
- data/lib/jabber_admin/commands/get_vcard.rb +0 -6
- data/lib/jabber_admin/commands/set_presence.rb +1 -2
- data/lib/jabber_admin/commands/set_vcard.rb +0 -7
- data/lib/jabber_admin/errors.rb +3 -3
- data/lib/jabber_admin/version.rb +1 -1
- data/lib/jabber_admin.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7780c8908ad5c57767c7ffc6b73ccd6069047d158a23b2ca134f602a4dd3b41e
|
|
4
|
+
data.tar.gz: 9cb29334e9306b201990516958116c0e61122ca0e20110d2ab4745217eed5504
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f600aaaa4728684447546519fe2cca5aff31c56ffce9c80281b36c5ef53b971b4a62bde6aa4f404c37b47bb1a7e133318284fe8743aab984aa30ef9401ab255e
|
|
7
|
+
data.tar.gz: c0afc0f2ad68411033dd3341b685bc236288bae51134f5190025076c3af8e9a7da60c9a52127c5511d9b0e0ada0f7b17f44348417e300c9e91dd0bf9c7cc2adc
|
data/.rubocop.yml
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://potpourri.hausgold.de/config/rubocop.yml
|
|
3
|
+
- https://potpourri.hausgold.de/config/rubocop-gem.yml
|
|
4
|
+
|
|
1
5
|
plugins:
|
|
2
6
|
- rubocop-rspec
|
|
3
7
|
- rubocop-rails
|
|
@@ -5,9 +9,6 @@ plugins:
|
|
|
5
9
|
Rails:
|
|
6
10
|
Enabled: true
|
|
7
11
|
|
|
8
|
-
Style/Documentation:
|
|
9
|
-
Enabled: true
|
|
10
|
-
|
|
11
12
|
AllCops:
|
|
12
13
|
NewCops: enable
|
|
13
14
|
SuggestExtensions: false
|
|
@@ -20,34 +21,3 @@ AllCops:
|
|
|
20
21
|
- config/**/*
|
|
21
22
|
- build/**/*
|
|
22
23
|
- gemfiles/**/*
|
|
23
|
-
|
|
24
|
-
Metrics/BlockLength:
|
|
25
|
-
Exclude:
|
|
26
|
-
- Rakefile
|
|
27
|
-
- spec/**/*.rb
|
|
28
|
-
- '**/*.rake'
|
|
29
|
-
- '*.gemspec'
|
|
30
|
-
|
|
31
|
-
# MFA is not yet enabled for our gems yet.
|
|
32
|
-
Gemspec/RequireMFA:
|
|
33
|
-
Enabled: false
|
|
34
|
-
|
|
35
|
-
# Document all the things.
|
|
36
|
-
Style/DocumentationMethod:
|
|
37
|
-
Enabled: true
|
|
38
|
-
RequireForNonPublicMethods: true
|
|
39
|
-
|
|
40
|
-
# Because +expect_any_instance_of().to have_received()+ is not
|
|
41
|
-
# supported with the +with(hash_including)+ matchers
|
|
42
|
-
RSpec/MessageSpies:
|
|
43
|
-
EnforcedStyle: receive
|
|
44
|
-
|
|
45
|
-
# Allow deeper nesting because of the predefined/non-predefined -
|
|
46
|
-
# bang/non-bang cases.
|
|
47
|
-
RSpec/NestedGroups:
|
|
48
|
-
Max: 4
|
|
49
|
-
|
|
50
|
-
# We stay at 80 characters per line.
|
|
51
|
-
# See: https://rubystyle.guide/#max-line-length
|
|
52
|
-
Layout/LineLength:
|
|
53
|
-
Max: 80
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
|
4
4
|
|
|
5
|
+
### 2.2.0 (19 December 2025)
|
|
6
|
+
|
|
7
|
+
* Migrated to a shared Rubocop configuration for HAUSGOLD gems ([#24](https://github.com/hausgold/jabber_admin/pull/24))
|
|
8
|
+
|
|
5
9
|
### 2.1.0 (24 October 2025)
|
|
6
10
|
|
|
7
11
|
* Added support for Rails 8.1 ([#23](https://github.com/hausgold/jabber_admin/pull/23))
|
data/Envfile
CHANGED
data/LICENSE
CHANGED
|
@@ -21,14 +21,14 @@ module JabberAdmin
|
|
|
21
21
|
|
|
22
22
|
# The resulting URL of the API call. This URL is constructed with the
|
|
23
23
|
# +JabberAdmin.configuration.url+ as base and the command name as the
|
|
24
|
-
# suffix. The configuration is allowed to end with
|
|
24
|
+
# suffix. The configuration is allowed to end with trailing slash, or not.
|
|
25
25
|
#
|
|
26
26
|
# @return [String] the API call URL
|
|
27
27
|
def url
|
|
28
28
|
"#{JabberAdmin.configuration.url.strip.chomp('/')}/#{@command}"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# This method compose the actual request,
|
|
31
|
+
# This method compose the actual request, performs it and stores the
|
|
32
32
|
# response to the instance. Additional calls to this method will not
|
|
33
33
|
# repeat the request, but will deliver the response directly.
|
|
34
34
|
#
|
|
@@ -50,9 +50,6 @@ module JabberAdmin
|
|
|
50
50
|
#
|
|
51
51
|
# @raise JabberAdmin::ApiError
|
|
52
52
|
# @raise JabberAdmin::CommandError
|
|
53
|
-
#
|
|
54
|
-
# rubocop:disable Metrics/AbcSize -- because its the bundled check logic
|
|
55
|
-
# rubocop:disable Metrics/MethodLength -- ditto
|
|
56
53
|
def check_response
|
|
57
54
|
# The REST API responds a 404 status code when the command is not known.
|
|
58
55
|
if response.code == 404
|
|
@@ -82,8 +79,6 @@ module JabberAdmin
|
|
|
82
79
|
raise CommandError.new('Command was not successful', response) \
|
|
83
80
|
unless response.body == '0'
|
|
84
81
|
end
|
|
85
|
-
# rubocop:enable Metrics/AbcSize
|
|
86
|
-
# rubocop:enable Metrics/MethodLength
|
|
87
82
|
|
|
88
83
|
# Just a simple DSL wrapper for the response method.
|
|
89
84
|
#
|
|
@@ -93,7 +88,7 @@ module JabberAdmin
|
|
|
93
88
|
end
|
|
94
89
|
|
|
95
90
|
# Just a simple DSL wrapper for the response method. But this variant
|
|
96
|
-
#
|
|
91
|
+
# performs a response check which will raise exceptions when there are
|
|
97
92
|
# issues.
|
|
98
93
|
#
|
|
99
94
|
# @raise JabberAdmin::ApiError
|
|
@@ -34,9 +34,6 @@ module JabberAdmin
|
|
|
34
34
|
# rubocop:disable Metrics/MethodLength -- because the ejabberd REST API
|
|
35
35
|
# is hard to use in complex scenarios, so we have to work
|
|
36
36
|
# around it
|
|
37
|
-
# rubocop:disable Metrics/AbcSize -- ditto
|
|
38
|
-
# rubocop:disable Metrics/CyclomaticComplexity -- ditto
|
|
39
|
-
# rubocop:disable Metrics/PerceivedComplexity -- ditto
|
|
40
37
|
def self.call(callable, *keys, user:)
|
|
41
38
|
uid, host = user.split('@')
|
|
42
39
|
val = proc do |key|
|
|
@@ -77,9 +74,6 @@ module JabberAdmin
|
|
|
77
74
|
end
|
|
78
75
|
end
|
|
79
76
|
# rubocop:enable Metrics/MethodLength
|
|
80
|
-
# rubocop:enable Metrics/AbcSize
|
|
81
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
82
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
83
77
|
end
|
|
84
78
|
end
|
|
85
79
|
end
|
|
@@ -16,7 +16,6 @@ module JabberAdmin
|
|
|
16
16
|
# @param priority [String] presence priority (eg. +7+)
|
|
17
17
|
#
|
|
18
18
|
# rubocop:disable Metrics/ParameterLists -- because of the mapping
|
|
19
|
-
# rubocop:disable Metrics/MethodLength -- because of the mapping
|
|
20
19
|
def self.call(callable, user:, type: 'available', show: 'chat',
|
|
21
20
|
status: '', priority: '7')
|
|
22
21
|
uid, host = user.split('@')
|
|
@@ -31,7 +30,7 @@ module JabberAdmin
|
|
|
31
30
|
status: status,
|
|
32
31
|
priority: priority)
|
|
33
32
|
end
|
|
34
|
-
# rubocop:enable Metrics/ParameterLists
|
|
33
|
+
# rubocop:enable Metrics/ParameterLists
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
36
|
end
|
|
@@ -31,11 +31,6 @@ module JabberAdmin
|
|
|
31
31
|
# @param sym_args [Hash{Symbol => Mixed}] additional keys/values to
|
|
32
32
|
# set to the vCard
|
|
33
33
|
# @return [Hash] the vCard details
|
|
34
|
-
#
|
|
35
|
-
# rubocop:disable Metrics/MethodLength -- because the ejabberd REST API
|
|
36
|
-
# is hard to use in complex scenarios, so we have to work
|
|
37
|
-
# around it
|
|
38
|
-
# rubocop:disable Metrics/AbcSize -- ditto
|
|
39
34
|
def self.call(callable, args = {}, user:, **sym_args)
|
|
40
35
|
args = args.merge(sym_args)
|
|
41
36
|
uid, host = user.split('@')
|
|
@@ -62,8 +57,6 @@ module JabberAdmin
|
|
|
62
57
|
args.each { |key, val| set[key, val] }
|
|
63
58
|
args
|
|
64
59
|
end
|
|
65
|
-
# rubocop:enable Metrics/MethodLength
|
|
66
|
-
# rubocop:enable Metrics/AbcSize
|
|
67
60
|
end
|
|
68
61
|
end
|
|
69
62
|
end
|
data/lib/jabber_admin/errors.rb
CHANGED
|
@@ -15,7 +15,7 @@ module JabberAdmin
|
|
|
15
15
|
|
|
16
16
|
# Create a new exception.
|
|
17
17
|
#
|
|
18
|
-
# @param msg [String] the
|
|
18
|
+
# @param msg [String] the exception message
|
|
19
19
|
# @param response [RestClient::Response] the response when available
|
|
20
20
|
def initialize(msg, response = nil)
|
|
21
21
|
@response = response
|
|
@@ -24,8 +24,8 @@ module JabberAdmin
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# This exception is raised when the request was denied due to
|
|
28
|
-
# issues or a general
|
|
27
|
+
# This exception is raised when the request was denied due to permission
|
|
28
|
+
# issues or a general unavailability of the command on the REST API. This
|
|
29
29
|
# simply means the response code from ejabberd was not 200 OK.
|
|
30
30
|
class RequestError < Error; end
|
|
31
31
|
|
data/lib/jabber_admin/version.rb
CHANGED
data/lib/jabber_admin.rb
CHANGED
|
@@ -93,7 +93,7 @@ module JabberAdmin
|
|
|
93
93
|
# perform the response checks and raise in case of issues. The non-bang
|
|
94
94
|
# versions skip this checks. For unknown commands the
|
|
95
95
|
# +JabberAdmin::ApiCall+ is directly utilized with the method name as
|
|
96
|
-
# command. (Without the
|
|
96
|
+
# command. (Without the trailing bang, when it is present)
|
|
97
97
|
#
|
|
98
98
|
# @param method [Symbol, String, #to_s] the name of the command to run
|
|
99
99
|
# @param args [Array<Mixed>] all additional API call payload
|