rocketchat 0.0.6 → 0.0.7
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/README.md +16 -5
- data/lib/rocket_chat/gem_version.rb +1 -1
- data/lib/rocket_chat/messages/user.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ff674c069b6c5cc2bb466966c996007d1cc286b
|
4
|
+
data.tar.gz: 2d8ba00018c162adea4a1a7204419aa52c3fdb61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40935960e7f75f53ae5eeb87608f2e232e6e837e7b1cb24247ed94f2b54cebcba1685ad9b4c7ef6d6892217727624985eef57a287d2c7041856833458a6ba3d3
|
7
|
+
data.tar.gz: fb0484eae8d74644066810a156ce8cc1b2adeb7ddf001f855362d92469f18d168bca08815877e5bed8d06816a8a0327d5bc9372d305600481379ea3167174ad9
|
data/README.md
CHANGED
@@ -75,7 +75,7 @@ require 'rocketchat'
|
|
75
75
|
|
76
76
|
rocket_server = RocketChat::Server.new('http://your.server.address/')
|
77
77
|
session = rocket_server.login('username', 'password')
|
78
|
-
session.users.create('new_username', 'user@example.com', 'New User', '123456',
|
78
|
+
user = session.users.create('new_username', 'user@example.com', 'New User', '123456',
|
79
79
|
active: true, send_welcome_email: false)
|
80
80
|
```
|
81
81
|
|
@@ -91,7 +91,7 @@ require 'rocketchat'
|
|
91
91
|
|
92
92
|
rocket_server = RocketChat::Server.new('http://your.server.address/')
|
93
93
|
session = rocket_server.login('username', 'password')
|
94
|
-
session.users.update('LAjzCDLqggCT7B82M',
|
94
|
+
user = session.users.update('LAjzCDLqggCT7B82M',
|
95
95
|
email: 'updated@example.com',
|
96
96
|
name: 'Updated Name',
|
97
97
|
roles: ['user', 'moderator']
|
@@ -110,12 +110,23 @@ require 'rocketchat'
|
|
110
110
|
|
111
111
|
rocket_server = RocketChat::Server.new('http://your.server.address/')
|
112
112
|
session = rocket_server.login('username', 'password')
|
113
|
-
session.users.info(username: 'some_username')
|
113
|
+
user = session.users.info(username: 'some_username')
|
114
114
|
```
|
115
115
|
|
116
116
|
Either user_id (RocketChat's ID) or username can be used.
|
117
117
|
|
118
|
-
|
118
|
+
|
119
|
+
To delete a user, the same options as an info request can be used (`user_id` or `username`).
|
120
|
+
|
121
|
+
To search for (list) users:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
require 'rocketchat'
|
125
|
+
|
126
|
+
rocket_server = RocketChat::Server.new('http://your.server.address/')
|
127
|
+
session = rocket_server.login('username', 'password')
|
128
|
+
users = session.users.list(query: { email: 'foo@example.com' })
|
129
|
+
```
|
119
130
|
|
120
131
|
|
121
132
|
To set a user's avatar:
|
@@ -125,7 +136,7 @@ require 'rocketchat'
|
|
125
136
|
|
126
137
|
rocket_server = RocketChat::Server.new('http://your.server.address/')
|
127
138
|
session = rocket_server.login('username', 'password')
|
128
|
-
session.users.set_avatar('http://image_url')
|
139
|
+
success = session.users.set_avatar('http://image_url')
|
129
140
|
```
|
130
141
|
|
131
142
|
There is an optional parameter user_id, that works if the setting user is allowed to set other's avatar.
|
@@ -70,6 +70,32 @@ module RocketChat
|
|
70
70
|
)['success']
|
71
71
|
end
|
72
72
|
|
73
|
+
#
|
74
|
+
# users.list REST API
|
75
|
+
# @param [Integer] offset Query offset
|
76
|
+
# @param [Integer] count Query count/limit
|
77
|
+
# @param [Hash] sort Query field sort hash. eg `{ active: 1, email: -1 }`
|
78
|
+
# @param [Hash] fields Query fields to return. eg `{ name: 1, email: 0 }`
|
79
|
+
# @param [Hash] query The query. `{ active: true, type: { $in: ['user', 'bot'] } }`
|
80
|
+
# @return [User[]]
|
81
|
+
# @raise [HTTPError, StatusError]
|
82
|
+
#
|
83
|
+
def list(offset: nil, count: nil, sort: nil, fields: nil, query: nil)
|
84
|
+
body = {}
|
85
|
+
body[:offset] = offset.to_i if offset.is_a? Integer
|
86
|
+
body[:count] = count.to_i if count.is_a? Integer
|
87
|
+
body[:sort] = sort.to_json if sort.is_a? Hash
|
88
|
+
body[:fields] = fields.to_json if fields.is_a? Hash
|
89
|
+
body[:query] = query.to_json if query.is_a? Hash
|
90
|
+
|
91
|
+
response = session.request_json(
|
92
|
+
'/api/v1/users.list',
|
93
|
+
body: body
|
94
|
+
)
|
95
|
+
|
96
|
+
response['users'].map { |hash| RocketChat::User.new hash } if response['success']
|
97
|
+
end
|
98
|
+
|
73
99
|
#
|
74
100
|
# users.info REST API
|
75
101
|
# @param [String] user_id Rocket.Chat user id
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- int512
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|