Module: FileboundClient::Endpoints::Users
- Defined in:
- lib/filebound_client/endpoints/users.rb
Overview
Module for Users resource endpoint
Class Method Summary collapse
-
.included(klass) ⇒ Object
This will call macros to create resource methods on the fly.
Instance Method Summary collapse
-
#user(user_id, query_params = nil) ⇒ User
Retrieves a single user by its key.
-
#user_add(user, groups) ⇒ int
Adds a user.
-
#user_assignments(user_id, query_params = nil) ⇒ Array
Retrieves assignments for a user.
-
#user_groups(user_id, query_params = nil) ⇒ Array
Retrieves groups for a user.
-
#user_routeditems(user_id, query_params = nil) ⇒ Array
Retrieves routed items for a user.
-
#user_update(user, groups) ⇒ int
Edits a user.
Class Method Details
.included(klass) ⇒ Object
This will call macros to create resource methods on the fly
6 7 8 9 10 11 |
# File 'lib/filebound_client/endpoints/users.rb', line 6 def self.included(klass) klass.instance_eval do allow_new :user allow_all :users end end |
Instance Method Details
#user(user_id, query_params = nil) ⇒ User
Retrieves a single user by its key
17 18 19 |
# File 'lib/filebound_client/endpoints/users.rb', line 17 def user(user_id, query_params = nil) get("/users/#{user_id}", query_params) end |
#user_add(user, groups) ⇒ int
Adds a user. The user.id must be nil or 0.
68 69 70 71 |
# File 'lib/filebound_client/endpoints/users.rb', line 68 def user_add(user, groups) raise Client::FileboundClientException.new('Id is required', 0) if user[:userId].greater_than_zero? put('/users', nil, user, user: user, groups: groups) end |
#user_assignments(user_id, query_params = nil) ⇒ Array
Retrieves assignments for a user
41 42 43 |
# File 'lib/filebound_client/endpoints/users.rb', line 41 def user_assignments(user_id, query_params = nil) get_user_children(user_id, __method__, query_params) end |
#user_groups(user_id, query_params = nil) ⇒ Array
Retrieves groups for a user
33 34 35 |
# File 'lib/filebound_client/endpoints/users.rb', line 33 def user_groups(user_id, query_params = nil) get_user_children(user_id, __method__, query_params) end |
#user_routeditems(user_id, query_params = nil) ⇒ Array
Retrieves routed items for a user
25 26 27 |
# File 'lib/filebound_client/endpoints/users.rb', line 25 def user_routeditems(user_id, query_params = nil) get_user_children(user_id, __method__, query_params) end |
#user_update(user, groups) ⇒ int
Edits a user. The user.Id must be not nil and > 0.
54 55 56 57 |
# File 'lib/filebound_client/endpoints/users.rb', line 54 def user_update(user, groups) raise Client::FileboundClientException.new('Id is required', 0) unless user[:dd].greater_than_zero? put('/users', nil, user: user, groups: groups) end |