Module: X::Resources::Actions::Lists
- Included in:
- X::Resources::API
- Defined in:
- x-resources/lib/x/resources/actions/lists.rb
Overview
Create, update, delete, follow, and pin lists as the authenticated user
Internal to x-resources: X::Resources::API includes it, and its methods are public API of the client that includes API, but the module is only how they are grouped, and some of them need the methods of another, so include API rather than this module alone.
Instance Method Summary collapse
-
#add_list_member(list, user) ⇒ Boolean
Add a member to a list as the authenticated user.
-
#create_list(name, **params) ⇒ List
Create a list owned by the authenticated user.
-
#delete_list(list) ⇒ Boolean
Delete a list as the authenticated user.
-
#follow_list(list) ⇒ Boolean
Follow a list as the authenticated user.
-
#pin_list(list) ⇒ Boolean
Pin a list as the authenticated user.
-
#remove_list_member(list, user) ⇒ Boolean
Remove a member from a list as the authenticated user.
-
#unfollow_list(list) ⇒ Boolean
Unfollow a list as the authenticated user.
-
#unpin_list(list) ⇒ Boolean
Unpin a list as the authenticated user.
-
#update_list(list, **params) ⇒ Boolean
Update the name, description, or privacy of a list as the authenticated user.
Instance Method Details
#add_list_member(list, user) ⇒ Boolean
Add a member to a list as the authenticated user
64 65 66 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 64 def add_list_member(list, user) List.from_id(list, client: self).add_member(user) end |
#create_list(name, **params) ⇒ List
Create a list owned by the authenticated user
28 29 30 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 28 def create_list(name, **params) List.create(name, client: self, **params) end |
#delete_list(list) ⇒ Boolean
Delete a list as the authenticated user
52 53 54 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 52 def delete_list(list) List.delete(list, client: self) end |
#follow_list(list) ⇒ Boolean
Follow a list as the authenticated user
87 88 89 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 87 def follow_list(list) RelationWrites.relate(self, current_user_id, "followed_lists", {"list_id" => Utils.id_of(list, List)}, "following") end |
#pin_list(list) ⇒ Boolean
Pin a list as the authenticated user
109 110 111 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 109 def pin_list(list) RelationWrites.relate(self, current_user_id, "pinned_lists", {"list_id" => Utils.id_of(list, List)}, "pinned") end |
#remove_list_member(list, user) ⇒ Boolean
Remove a member from a list as the authenticated user
76 77 78 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 76 def remove_list_member(list, user) List.from_id(list, client: self).remove_member(user) end |
#unfollow_list(list) ⇒ Boolean
Unfollow a list as the authenticated user
98 99 100 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 98 def unfollow_list(list) RelationWrites.unrelate(self, current_user_id, "followed_lists", Utils.id_of(list, List), "following") end |
#unpin_list(list) ⇒ Boolean
Unpin a list as the authenticated user
120 121 122 |
# File 'x-resources/lib/x/resources/actions/lists.rb', line 120 def unpin_list(list) RelationWrites.unrelate(self, current_user_id, "pinned_lists", Utils.id_of(list, List), "pinned") end |