Module: Toolhound::Client::Users
- Defined in:
- lib/toolhound-ruby/client/users.rb
Overview
Methods for the Users API
Instance Method Summary collapse
- #delete_user(user, options = {}) ⇒ Object
-
#edit_user(user, options = {}) ⇒ Object
(also: #update_user)
Edit a user.
- #update_email(user, options = {}) ⇒ Object
-
#user(user = nil, options = {}) ⇒ Sawyer::Resource
Get a single user.
-
#users(options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_users)
List users.
-
#validate_credentials(options = {}) ⇒ Boolean
Validate user username and password.
Instance Method Details
#delete_user(user, options = {}) ⇒ Object
61 62 63 |
# File 'lib/toolhound-ruby/client/users.rb', line 61 def delete_user(user, = {}) delete "users/#{user}", end |
#edit_user(user, options = {}) ⇒ Object Also known as: update_user
Edit a user
51 52 53 |
# File 'lib/toolhound-ruby/client/users.rb', line 51 def edit_user(user, = {}) patch "update_user/#{user}", end |
#update_email(user, options = {}) ⇒ Object
56 57 58 |
# File 'lib/toolhound-ruby/client/users.rb', line 56 def update_email(user, = {}) end |
#user(user = nil, options = {}) ⇒ Sawyer::Resource
Get a single user
24 25 26 27 28 29 30 31 |
# File 'lib/toolhound-ruby/client/users.rb', line 24 def user(user=nil, = {}) if user.nil? get "me", else get "users/#{user}", end # get User.path(user), options end |
#users(options = {}) ⇒ Array<Sawyer::Resource> Also known as: list_users
Note:
Logged in user must be an admin to see all users
List users
13 14 15 |
# File 'lib/toolhound-ruby/client/users.rb', line 13 def users( = {}) paginate "users", end |
#validate_credentials(options = {}) ⇒ Boolean
Validate user username and password
71 72 73 74 75 |
# File 'lib/toolhound-ruby/client/users.rb', line 71 def validate_credentials( = {}) !self.class.new().user.nil? rescue Toolhound::Unauthorized false end |