Class: LessonlyApi::Users
- Inherits:
-
Request
- Object
- ResourceType::Base
- Request
- LessonlyApi::Users
- Defined in:
- lib/lessonly_api/users.rb
Overview
The collection of methods to fetch users’ data.
Class Method Summary collapse
-
.archive(id) ⇒ ResourceType::User
Archive a user docs.lessonly.com/#archive-user.
-
.create(attributes = {}) ⇒ ResourceType::User
Create a user docs.lessonly.com/#create-user.
-
.create_user_assignments(id, assignments = []) ⇒ ResourceType::UserAssignments
Create assignments for a user docs.lessonly.com/#create-user-assignments.
-
.delete(id) ⇒ ResourceType::User
Delete a user docs.lessonly.com/#delete-user.
-
.list(page: 1, per_page: 50, **filters) ⇒ ResourceType::Users
Retrieve all users docs.lessonly.com/#list-users.
-
.restore(id) ⇒ ResourceType::User
Restore an archived user docs.lessonly.com/#restore-user.
-
.show(id) ⇒ ResourceType::User
Retrieve all the user’s details including their custom field data docs.lessonly.com/#show-user-details.
-
.update(id, attributes = {}) ⇒ ResourceType::User
Update a user docs.lessonly.com/#update-user.
-
.update_user_groups(id, attributes = {}) ⇒ ResourceType::UserGroup
Update a user’s involvement in various groups docs.lessonly.com/#update-user-groups.
-
.user_assignments(id) ⇒ ResourceType::UserAssignments
Return a list of assignments for a given user docs.lessonly.com/#user-assignments.
-
.user_groups(id) ⇒ ResourceType::UserGroup
Return the list of a user’s group memberships and groups they are managing docs.lessonly.com/#user-groups.
Methods inherited from Request
Methods inherited from ResourceType::Base
#attributes, dump, fields, from_json, #initialize, load
Constructor Details
This class inherits a constructor from LessonlyApi::ResourceType::Base
Class Method Details
.archive(id) ⇒ ResourceType::User
Archive a user docs.lessonly.com/#archive-user
53 54 55 56 |
# File 'lib/lessonly_api/users.rb', line 53 def archive(id) raw_result = send_put("/users/#{id}/archive") ResourceType::User.new(raw_result) end |
.create(attributes = {}) ⇒ ResourceType::User
Create a user docs.lessonly.com/#create-user
32 33 34 35 |
# File 'lib/lessonly_api/users.rb', line 32 def create(attributes = {}) raw_result = send_post('/users', attributes) ResourceType::User.new(raw_result) end |
.create_user_assignments(id, assignments = []) ⇒ ResourceType::UserAssignments
Create assignments for a user docs.lessonly.com/#create-user-assignments
118 119 120 121 |
# File 'lib/lessonly_api/users.rb', line 118 def create_user_assignments(id, assignments = []) raw_result = send_post("/users/#{id}/assignments", assignments: assignments) ResourceType::UserAssignments.new(raw_result) end |
.delete(id) ⇒ ResourceType::User
Delete a user docs.lessonly.com/#delete-user
73 74 75 76 77 |
# File 'lib/lessonly_api/users.rb', line 73 def delete(id) raw_result = send_delete("/users/#{id}") # TODO: there should be other type, possibly ResourceType::User.new(raw_result) end |
.list(page: 1, per_page: 50, **filters) ⇒ ResourceType::Users
Retrieve all users docs.lessonly.com/#list-users
12 13 14 15 |
# File 'lib/lessonly_api/users.rb', line 12 def list(page: 1, per_page: 50, **filters) raw_result = send_get('/users', page: page, per_page: per_page, filter: filters) ResourceType::Users.new(raw_result) end |
.restore(id) ⇒ ResourceType::User
Restore an archived user docs.lessonly.com/#restore-user
63 64 65 66 |
# File 'lib/lessonly_api/users.rb', line 63 def restore(id) raw_result = send_put("/users/#{id}/restore") ResourceType::User.new(raw_result) end |
.show(id) ⇒ ResourceType::User
Retrieve all the user’s details including their custom field data docs.lessonly.com/#show-user-details
22 23 24 25 |
# File 'lib/lessonly_api/users.rb', line 22 def show(id) raw_result = send_get("/users/#{id}") LessonlyApi::ResourceType::User.new(raw_result) end |
.update(id, attributes = {}) ⇒ ResourceType::User
Update a user docs.lessonly.com/#update-user
43 44 45 46 |
# File 'lib/lessonly_api/users.rb', line 43 def update(id, attributes = {}) raw_result = send_put("/users/#{id}", attributes) ResourceType::User.new(raw_result) end |
.update_user_groups(id, attributes = {}) ⇒ ResourceType::UserGroup
Update a user’s involvement in various groups docs.lessonly.com/#update-user-groups
96 97 98 99 100 |
# File 'lib/lessonly_api/users.rb', line 96 def update_user_groups(id, attributes = {}) raw_result = send_put("/users/#{id}/groups", attributes) # TODO: there should be other type, possibly ResourceType::UserGroup.new(raw_result) end |
.user_assignments(id) ⇒ ResourceType::UserAssignments
Return a list of assignments for a given user docs.lessonly.com/#user-assignments
107 108 109 110 |
# File 'lib/lessonly_api/users.rb', line 107 def user_assignments(id) raw_result = send_get("/users/#{id}/assignments") ResourceType::UserAssignments.new(raw_result) end |
.user_groups(id) ⇒ ResourceType::UserGroup
Return the list of a user’s group memberships and groups they are managing docs.lessonly.com/#user-groups
84 85 86 87 88 |
# File 'lib/lessonly_api/users.rb', line 84 def user_groups(id) raw_result = send_get("/users/#{id}/groups") # TODO: there should be other type, possibly ResourceType::UserGroup.new(raw_result) end |