-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented users.list
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,7 @@ require 'rocketchat' | |
|
||
rocket_server = RocketChat::Server.new('http://your.server.address/') | ||
session = rocket_server.login('username', 'password') | ||
session.users.create('new_username', '[email protected]', 'New User', '123456', | ||
user = session.users.create('new_username', '[email protected]', 'New User', '123456', | ||
active: true, send_welcome_email: false) | ||
``` | ||
|
||
|
@@ -91,7 +91,7 @@ require 'rocketchat' | |
|
||
rocket_server = RocketChat::Server.new('http://your.server.address/') | ||
session = rocket_server.login('username', 'password') | ||
session.users.update('LAjzCDLqggCT7B82M', | ||
user = session.users.update('LAjzCDLqggCT7B82M', | ||
email: '[email protected]', | ||
name: 'Updated Name', | ||
roles: ['user', 'moderator'] | ||
|
@@ -110,12 +110,23 @@ require 'rocketchat' | |
|
||
rocket_server = RocketChat::Server.new('http://your.server.address/') | ||
session = rocket_server.login('username', 'password') | ||
session.users.info(username: 'some_username') | ||
user = session.users.info(username: 'some_username') | ||
``` | ||
|
||
Either user_id (RocketChat's ID) or username can be used. | ||
|
||
Deleting a user can be done with the same options. | ||
|
||
To delete a user, the same options as an info request can be used (`user_id` or `username`). | ||
|
||
To search for (list) users: | ||
|
||
```ruby | ||
require 'rocketchat' | ||
|
||
rocket_server = RocketChat::Server.new('http://your.server.address/') | ||
session = rocket_server.login('username', 'password') | ||
users = session.users.list(query: { email: '[email protected]' }) | ||
``` | ||
|
||
|
||
To set a user's avatar: | ||
|
@@ -125,7 +136,7 @@ require 'rocketchat' | |
|
||
rocket_server = RocketChat::Server.new('http://your.server.address/') | ||
session = rocket_server.login('username', 'password') | ||
session.users.set_avatar('http://image_url') | ||
success = session.users.set_avatar('http://image_url') | ||
``` | ||
|
||
There is an optional parameter user_id, that works if the setting user is allowed to set other's avatar. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module RocketChat | ||
VERSION = '0.0.6'.freeze | ||
VERSION = '0.0.7'.freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters