jabber_admin 0.1.3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +30 -0
- data/.gitignore +4 -2
- data/.rubocop.yml +35 -0
- data/.simplecov +5 -0
- data/.travis.yml +8 -6
- data/.yardopts +4 -0
- data/CHANGELOG.md +58 -0
- data/Gemfile +4 -2
- data/Makefile +108 -0
- data/README.md +145 -21
- data/Rakefile +5 -3
- data/bin/config.rb +11 -0
- data/bin/console +3 -3
- data/docker-compose.yml +15 -0
- data/jabber_admin.gemspec +34 -27
- data/lib/jabber_admin.rb +97 -34
- data/lib/jabber_admin/api_call.rb +110 -20
- data/lib/jabber_admin/commands.rb +6 -13
- data/lib/jabber_admin/commands/ban_account.rb +11 -10
- data/lib/jabber_admin/commands/create_room.rb +15 -10
- data/lib/jabber_admin/commands/create_room_with_opts.rb +20 -14
- data/lib/jabber_admin/commands/get_vcard.rb +84 -0
- data/lib/jabber_admin/commands/muc_register_nick.rb +26 -0
- data/lib/jabber_admin/commands/register.rb +16 -11
- data/lib/jabber_admin/commands/registered_users.rb +18 -0
- data/lib/jabber_admin/commands/restart.rb +8 -5
- data/lib/jabber_admin/commands/send_direct_invitation.rb +19 -16
- data/lib/jabber_admin/commands/send_stanza.rb +21 -0
- data/lib/jabber_admin/commands/send_stanza_c2s.rb +28 -0
- data/lib/jabber_admin/commands/set_nickname.rb +22 -0
- data/lib/jabber_admin/commands/set_presence.rb +37 -0
- data/lib/jabber_admin/commands/set_room_affiliation.rb +17 -12
- data/lib/jabber_admin/commands/set_vcard.rb +68 -0
- data/lib/jabber_admin/commands/subscribe_room.rb +19 -12
- data/lib/jabber_admin/commands/unregister.rb +13 -7
- data/lib/jabber_admin/commands/unsubscribe_room.rb +10 -7
- data/lib/jabber_admin/configuration.rb +6 -1
- data/lib/jabber_admin/exceptions.rb +41 -0
- data/lib/jabber_admin/version.rb +20 -1
- metadata +119 -25
- data/lib/jabber_admin/initializer.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 434740883cadd905c938944abc50d9a2ed761658137485ec9653e0452882faa5
|
4
|
+
data.tar.gz: c554a92ce698d861870464612295c13583cce069f7a0d537444375a1a46045aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 490904b5047f1f8d983c06cc58837973e4d67286eb6fa2c35a9457c538595762af44fef9eff10d0205f723a93cbd10a760643bd3308daae91295c95e0ca62490
|
7
|
+
data.tar.gz: aa2dc6b86777dff40e71d57fdcdfd8c3f842eb59c9c8b18bd4f1e303267e1fbf72cc32ba55c57bf0891b49fdeae98cdc26420d7e7f1e7ccdc14450b7175f5f65
|
data/.editorconfig
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# http://editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
indent_style = space
|
6
|
+
indent_size = 2
|
7
|
+
end_of_line = lf
|
8
|
+
charset = utf-8
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
insert_final_newline = true
|
11
|
+
|
12
|
+
[*.md]
|
13
|
+
trim_trailing_whitespace = true
|
14
|
+
|
15
|
+
[*.json]
|
16
|
+
indent_style = space
|
17
|
+
indent_size = 2
|
18
|
+
|
19
|
+
[*.yml]
|
20
|
+
indent_style = space
|
21
|
+
indent_size = 2
|
22
|
+
|
23
|
+
[Makefile]
|
24
|
+
trim_trailing_whitespace = true
|
25
|
+
indent_style = tab
|
26
|
+
indent_size = 4
|
27
|
+
|
28
|
+
[*.sh]
|
29
|
+
indent_style = space
|
30
|
+
indent_size = 2
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
Documentation:
|
4
|
+
Enabled: true
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
DisplayCopNames: true
|
8
|
+
TargetRubyVersion: 2.5
|
9
|
+
|
10
|
+
Metrics/BlockLength:
|
11
|
+
Exclude:
|
12
|
+
- Rakefile
|
13
|
+
- spec/**/*.rb
|
14
|
+
- '**/*.rake'
|
15
|
+
- '*.gemspec'
|
16
|
+
|
17
|
+
# Document all the things.
|
18
|
+
Style/DocumentationMethod:
|
19
|
+
Enabled: true
|
20
|
+
RequireForNonPublicMethods: true
|
21
|
+
|
22
|
+
# Because +expect_any_instance_of().to have_received()+ is not
|
23
|
+
# supported with the +with(hash_including)+ matchers
|
24
|
+
RSpec/MessageSpies:
|
25
|
+
EnforcedStyle: receive
|
26
|
+
|
27
|
+
# Allow deeper nesting because of the predefined/non-predefined -
|
28
|
+
# bang/non-bang cases.
|
29
|
+
RSpec/NestedGroups:
|
30
|
+
Max: 4
|
31
|
+
|
32
|
+
# We stay at 80 characters per line.
|
33
|
+
# See: https://rubystyle.guide/#max-line-length
|
34
|
+
Metrics/LineLength:
|
35
|
+
Max: 80
|
data/.simplecov
ADDED
data/.travis.yml
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
+
sudo: false
|
1
2
|
env:
|
2
3
|
global:
|
3
|
-
- CC_TEST_REPORTER_ID=
|
4
|
-
sudo: false
|
4
|
+
- CC_TEST_REPORTER_ID=05f9944a34899135739ab519c57a179a3f4677999fd832fa87da25d3643702b7
|
5
5
|
language: ruby
|
6
6
|
rvm:
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
before_install: gem install bundler
|
7
|
+
- 2.6
|
8
|
+
- 2.6
|
9
|
+
- 2.5
|
10
|
+
before_install: gem install bundler
|
11
11
|
before_script:
|
12
12
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
13
|
- chmod +x ./cc-test-reporter
|
14
14
|
- ./cc-test-reporter before-build
|
15
|
+
script:
|
16
|
+
- bundle exec rspec
|
15
17
|
after_script:
|
16
18
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
### 1.0.2
|
2
|
+
|
3
|
+
* Corrected the GNU Make release target
|
4
|
+
* Corrected the empty arguments check
|
5
|
+
|
6
|
+
### 1.0.1
|
7
|
+
|
8
|
+
* Gracefully handle a missing vCard when a vCard field is queried (#7)
|
9
|
+
|
10
|
+
### 1.0.0
|
11
|
+
|
12
|
+
* All `JabberAdmin` errors `[UnknownCommandError, CommandError, RequestError]`
|
13
|
+
now ship the response object correctly (was always set to `nil` previously)
|
14
|
+
(#6)
|
15
|
+
* Improved the default exceptions messages with the response body (#6)
|
16
|
+
* Added support for setting/fetching vCard details (`JabberAdmin.set_vcard`,
|
17
|
+
`JabberAdmin.get_vcard`) (#6)
|
18
|
+
* Dropped support for Ruby <2.5 (#6)
|
19
|
+
* Added some versioning helpers (eg. `JabberAdmin.version`)
|
20
|
+
|
21
|
+
### 0.2.0
|
22
|
+
|
23
|
+
* [BC] The configuration has changed
|
24
|
+
* `api_host` => `url`, we require now the full base URL of the REST API, this
|
25
|
+
allows custom mod_http_api paths (See: https://bit.ly/2rBxatJ)
|
26
|
+
* `admin` => `username`, we want to be use common sense API client jargon
|
27
|
+
here
|
28
|
+
* We support from now on predefined AND freestyle commands on the `JabberAdmin`
|
29
|
+
module
|
30
|
+
* We support from now on bang and non-bang command variants (for both
|
31
|
+
predefined and freestyle commands) which allows the client to use builtin
|
32
|
+
error handling or not
|
33
|
+
* [BC] Previously only bang variants were possible, without response checking,
|
34
|
+
look out for more exceptions when you migrate
|
35
|
+
* New predefined commands:
|
36
|
+
* muc_register_nick
|
37
|
+
* send_stanza_c2s
|
38
|
+
* set_nickname
|
39
|
+
* set_presence
|
40
|
+
* The documentation was greatly improved
|
41
|
+
* The testcases were rewritten and tested with VCR against a real ejabberd
|
42
|
+
server (18.01)
|
43
|
+
|
44
|
+
### 0.1.4
|
45
|
+
|
46
|
+
* Added support for predefined commands
|
47
|
+
* ban_account
|
48
|
+
* create_room
|
49
|
+
* create_room_with_opts
|
50
|
+
* register
|
51
|
+
* registered_users
|
52
|
+
* restart
|
53
|
+
* send_direct_invitation
|
54
|
+
* send_stanza
|
55
|
+
* set_room_affiliation
|
56
|
+
* subscribe_room
|
57
|
+
* unregister
|
58
|
+
* unsubscribe_room
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in jabber_admin.gemspec
|
6
8
|
gemspec
|
data/Makefile
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
MAKEFLAGS += --warn-undefined-variables -j1
|
2
|
+
SHELL := bash
|
3
|
+
.SHELLFLAGS := -eu -o pipefail -c
|
4
|
+
.DEFAULT_GOAL := all
|
5
|
+
.DELETE_ON_ERROR:
|
6
|
+
.SUFFIXES:
|
7
|
+
.PHONY:
|
8
|
+
|
9
|
+
# Environment switches
|
10
|
+
MAKE_ENV ?= docker
|
11
|
+
COMPOSE_RUN_SHELL_FLAGS ?= --rm
|
12
|
+
|
13
|
+
# Directories
|
14
|
+
VENDOR_DIR ?= vendor/bundle
|
15
|
+
|
16
|
+
# Host binaries
|
17
|
+
BASH ?= bash
|
18
|
+
COMPOSE ?= docker-compose
|
19
|
+
ECHO ?= echo
|
20
|
+
GREP ?= grep
|
21
|
+
ID ?= id
|
22
|
+
MKDIR ?= mkdir
|
23
|
+
RM ?= rm
|
24
|
+
SED ?= sed
|
25
|
+
SORT ?= sort
|
26
|
+
|
27
|
+
# Container binaries
|
28
|
+
BUNDLE ?= bundle
|
29
|
+
RAKE ?= rake
|
30
|
+
RUBOCOP ?= rubocop
|
31
|
+
|
32
|
+
all:
|
33
|
+
# jabber_admin
|
34
|
+
#
|
35
|
+
# install Install the dependencies
|
36
|
+
# test Run the whole test suite
|
37
|
+
# test-style Check the coding styles
|
38
|
+
# clean Clean the dependencies
|
39
|
+
#
|
40
|
+
# shell Run an interactive shell on the container
|
41
|
+
# shell-irb Run an interactive IRB shell on the container
|
42
|
+
#
|
43
|
+
# supported-commands-list Generate the supported commands list
|
44
|
+
|
45
|
+
# Define a generic shell run wrapper
|
46
|
+
# $1 - The command to run
|
47
|
+
ifeq ($(MAKE_ENV),docker)
|
48
|
+
define run-shell
|
49
|
+
$(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
|
50
|
+
-e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
|
51
|
+
-e HOME=/tmp -e BUNDLE_APP_CONFIG=/app/.bundle \
|
52
|
+
-u `$(ID) -u` test bash -c 'sleep 0.1; echo; $(1)'
|
53
|
+
endef
|
54
|
+
else ifeq ($(MAKE_ENV),baremetal)
|
55
|
+
define run-shell
|
56
|
+
$(1)
|
57
|
+
endef
|
58
|
+
endif
|
59
|
+
|
60
|
+
install:
|
61
|
+
# Install the dependencies
|
62
|
+
@$(MKDIR) -p $(VENDOR_DIR)
|
63
|
+
@$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
|
64
|
+
|
65
|
+
test: install
|
66
|
+
# Run the whole test suite
|
67
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE))
|
68
|
+
|
69
|
+
test-style: test-style-ruby
|
70
|
+
|
71
|
+
test-style-ruby:
|
72
|
+
# Run the static code analyzer (rubocop)
|
73
|
+
@$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
|
74
|
+
|
75
|
+
clean:
|
76
|
+
# Clean the dependencies
|
77
|
+
@$(RM) -rf $(VENDOR_DIR)
|
78
|
+
|
79
|
+
clean-containers:
|
80
|
+
# Clean running containers
|
81
|
+
ifeq ($(MAKE_ENV),docker)
|
82
|
+
@$(COMPOSE) down
|
83
|
+
endif
|
84
|
+
|
85
|
+
distclean: clean clean-containers
|
86
|
+
|
87
|
+
shell: install
|
88
|
+
# Run an interactive shell on the container
|
89
|
+
@$(call run-shell,$(BASH) -i)
|
90
|
+
|
91
|
+
shell-irb: install
|
92
|
+
# Run an interactive IRB shell on the container
|
93
|
+
@$(call run-shell,bin/console)
|
94
|
+
|
95
|
+
release:
|
96
|
+
# Release a new gem version
|
97
|
+
@$(BUNDLE) exec $(RAKE) release
|
98
|
+
|
99
|
+
supported-commands-list:
|
100
|
+
# Generate the supported commands list
|
101
|
+
@$(ECHO)
|
102
|
+
@$(GREP) -oP '@see https?://.*' -R lib/jabber_admin/commands/ \
|
103
|
+
| $(SED) \
|
104
|
+
-e 's/@see //g' \
|
105
|
+
-e 's/.rb:/](/g' \
|
106
|
+
-e 's/$$/)/g' \
|
107
|
+
-e 's#^lib/jabber_admin/commands/#- [#g' \
|
108
|
+
| $(SORT)
|
data/README.md
CHANGED
@@ -1,10 +1,21 @@
|
|
1
|
-
|
1
|
+
![jabber_admin](doc/assets/project.svg)
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![
|
3
|
+
[![Build Status](https://travis-ci.com/hausgold/jabber_admin.svg?branch=master)](https://travis-ci.com/hausgold/jabber_admin)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/jabber_admin.svg)](https://badge.fury.io/rb/jabber_admin)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/dd51c4668e97771baaba/maintainability)](https://codeclimate.com/repos/5cac8bcb6969c376ed007c70/maintainability)
|
6
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/dd51c4668e97771baaba/test_coverage)](https://codeclimate.com/repos/5cac8bcb6969c376ed007c70/test_coverage)
|
7
|
+
[![API docs](https://img.shields.io/badge/docs-API-blue.svg)](https://www.rubydoc.info/gems/jabber_admin)
|
5
8
|
|
6
|
-
|
7
|
-
admin API.
|
9
|
+
jabber_admin is a small library to easily communicate with the [ejabberd
|
10
|
+
admin API](https://docs.ejabberd.im/developer/ejabberd-api/admin-api).
|
11
|
+
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [Configuration](#configuration)
|
14
|
+
- [Usage](#usage)
|
15
|
+
- [Predefined commands](#predefined-commands)
|
16
|
+
- [Freestyle commands](#freestyle-commands)
|
17
|
+
- [Development](#development)
|
18
|
+
- [Contributing](#contributing)
|
8
19
|
|
9
20
|
## Installation
|
10
21
|
|
@@ -16,36 +27,149 @@ gem 'jabber_admin'
|
|
16
27
|
|
17
28
|
And then execute:
|
18
29
|
|
19
|
-
|
30
|
+
```bash
|
31
|
+
$ bundle
|
32
|
+
```
|
20
33
|
|
21
34
|
Or install it yourself as:
|
22
35
|
|
23
|
-
|
36
|
+
```bash
|
37
|
+
$ gem install jabber_admin
|
38
|
+
```
|
39
|
+
|
40
|
+
## Configuration
|
41
|
+
|
42
|
+
You can configure the jabber_admin gem in a global initializer way with the
|
43
|
+
`JabberAdmin.configure` method which yields the configuration directly.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
JabberAdmin.configure do |config|
|
47
|
+
# The ejabberd REST API endpoint as a full URL.
|
48
|
+
# Take care of the path part, because this is individually
|
49
|
+
# configured on ejabberd. (See: https://bit.ly/2rBxatJ)
|
50
|
+
config.url = 'http://jabber.local/api'
|
51
|
+
# Provide here the full user JID in order to authenticate as
|
52
|
+
# a administrator.
|
53
|
+
config.username = 'admin@jabber.local'
|
54
|
+
# The password of the administrator account.
|
55
|
+
config.password = 'password'
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
In case this is not cool for you, you can get and modify the configuration
|
60
|
+
directly with the help of the `JabberAdmin.configuration` getter.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
JabberAdmin.configuration.url = 'http://jabber.local/api'
|
64
|
+
JabberAdmin.configuration.username = 'admin@jabber.local'
|
65
|
+
JabberAdmin.configuration.password = 'password'
|
66
|
+
```
|
24
67
|
|
25
68
|
## Usage
|
26
69
|
|
27
|
-
|
70
|
+
### Predefined commands
|
71
|
+
|
72
|
+
We support some handy predefined commands out of the box which ease the quick
|
73
|
+
start usage. These predefined commands comes with a good documentation
|
74
|
+
(including valid example data) and a nifty interface. When it is possible to
|
75
|
+
fill up missing data from a full user/room JID we do so. Say while sending a
|
76
|
+
direct invitation, you just pass the full room JID and we take care of
|
77
|
+
splitting it up to fulfill the separate room name and the separate MUC service
|
78
|
+
domain.
|
79
|
+
|
80
|
+
All our predefined commands are available directly underneath the `JabberAdmin`
|
81
|
+
module as methods. Just call them like this:
|
82
|
+
|
83
|
+
```ruby
|
28
84
|
JabberAdmin.restart!
|
29
|
-
JabberAdmin.
|
85
|
+
JabberAdmin.register(user: 'peter@example.com', password: '123')
|
30
86
|
```
|
31
87
|
|
32
|
-
|
88
|
+
Have a close look at the method names. We support bang and non-bang variants.
|
89
|
+
The bang variants perform in-deep response validation and raise children of
|
90
|
+
`JabberAdmin::Error` in case of detected issues. These issues can be
|
91
|
+
unpermitted API requests, or invalid payload values, etc. The predefined
|
92
|
+
commands also perform response body checks when it is appropriate. (Eg. many
|
93
|
+
commands respond a single zero as a success indicator)
|
94
|
+
|
95
|
+
The non-bang variants will just fire the request and do not perform any checks
|
96
|
+
on the response. You can implement your own error handling or response analysis
|
97
|
+
if you like. You could also just fire and forget them. It's up to you.
|
98
|
+
|
99
|
+
Here comes a list of all supported predefined commands:
|
100
|
+
|
101
|
+
- [ban_account](https://bit.ly/2KW9xVt)
|
102
|
+
- [create_room](https://bit.ly/2rB8DFR)
|
103
|
+
- [create_room_with_opts](https://bit.ly/2IBEfVO)
|
104
|
+
- [muc_register_nick](https://bit.ly/2G9EBNQ)
|
105
|
+
- [registered_users](https://bit.ly/2KhwT6Z)
|
106
|
+
- [register](https://bit.ly/2wyhAox)
|
107
|
+
- [restart](https://bit.ly/2G7YEwd)
|
108
|
+
- [send_direct_invitation](https://bit.ly/2wuTpr2)
|
109
|
+
- [send_stanza_c2s](https://bit.ly/2wwUcYr)
|
110
|
+
- [send_stanza](https://bit.ly/2rzxyK1)
|
111
|
+
- [set_nickname](https://bit.ly/2rBdyqc)
|
112
|
+
- [set_presence](https://bit.ly/2rzxyK1)
|
113
|
+
- [set_room_affiliation](https://bit.ly/2G5MfbW)
|
114
|
+
- [subscribe_room](https://bit.ly/2Ke7Zoy)
|
115
|
+
- [unregister](https://bit.ly/2wwYnDE)
|
116
|
+
- [unsubscribe_room](https://bit.ly/2G5zcrj)
|
117
|
+
|
118
|
+
If you want to contribute more, we accept pull requests!
|
119
|
+
|
120
|
+
### Freestyle commands
|
121
|
+
|
122
|
+
In case you want to send commands easily without delivering new predefined
|
123
|
+
commands with documentation and some nifty tricks, you can simply call the
|
124
|
+
ejabberd REST API with your custom commands like this:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
JabberAdmin.status
|
128
|
+
JabberAdmin.get_last(user: 'tom', host: 'ejabberd.local')
|
129
|
+
JabberAdmin.set_presence!(...)
|
130
|
+
```
|
131
|
+
|
132
|
+
The `JabberAdmin` is smart enough to detect that the given command is not a
|
133
|
+
predefined command and therefore it assembles a new `JabberAdmin::ApiCall`
|
134
|
+
instance and passes down all arguments. If you look closely you see again that
|
135
|
+
we support a bang and non-bang variant. The error handling works the same as on
|
136
|
+
predefined commands.
|
137
|
+
|
138
|
+
By default the `JabberAdmin::ApiCall` instance assumes it should perform body
|
139
|
+
checks on the response which is not clever on data fetching commands, due to
|
140
|
+
the fact that they do not deliver `0` as body. The body validation can be
|
141
|
+
turned off with the additional `check_res_body: false` argument.
|
33
142
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
143
|
+
```ruby
|
144
|
+
JabberAdmin.get_last! \
|
145
|
+
check_res_body: false, user: 'tom', host: 'ejabberd.local'
|
146
|
+
```
|
147
|
+
|
148
|
+
In case you want to make use of the memorize feature of each
|
149
|
+
`JabberAdmin::ApiCall` instance, just build it up directly.
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
command = JabberAdmin::ApiCall.new('get_last'
|
153
|
+
user: 'tom',
|
154
|
+
host: 'ejabberd.local')
|
155
|
+
# Get the response and memorize it
|
156
|
+
command.response.object_id # => 21934400
|
157
|
+
# A second call to the response method will not perform a request again
|
158
|
+
command.response.object_id # => 21934400
|
159
|
+
```
|
42
160
|
|
43
161
|
## Development
|
44
162
|
|
45
|
-
After checking out the repo, run `
|
163
|
+
After checking out the repo, run `make install` to install dependencies. Then,
|
164
|
+
run `make test` to run the tests. You can also run `make shell-irb` for an
|
165
|
+
interactive prompt that will allow you to experiment.
|
46
166
|
|
47
|
-
To
|
167
|
+
To release a new version, update the version number in `version.rb`, and then
|
168
|
+
run `make release`, which will create a git tag for the version, push git
|
169
|
+
commits and tags, and push the `.gem` file to
|
170
|
+
[rubygems.org](https://rubygems.org).
|
48
171
|
|
49
172
|
## Contributing
|
50
173
|
|
51
|
-
Bug reports and pull requests are welcome on GitHub at
|
174
|
+
Bug reports and pull requests are welcome on GitHub at
|
175
|
+
https://github.com/hausgold/jabber_admin.
|