Module: X::Resources::UserCollections
- Included in:
- User
- Defined in:
- x-resources/lib/x/resources/user_collections.rb
Overview
The collections of a user: the users they follow and are followed by, their posts, timelines, bookmarks, and lists, included into User
Internal to x-resources: the methods it gives a user, such as followers, are public API, but the module is only how they are shared, and which classes extend or include it can change within 1.x.
Instance Method Summary collapse
-
#affiliates(**params) ⇒ Cursor
The users affiliated with this user, such as the people of an organization.
-
#blocking(**params) ⇒ Cursor
The users this user blocks, which must be the authenticated user.
-
#bookmark_folders(**params) ⇒ Cursor
The bookmark folders of the authenticated user.
-
#bookmarks(folder: nil, **params) ⇒ Cursor
The posts bookmarked by the authenticated user, or those of one of their folders.
-
#followed_lists(**params) ⇒ Cursor
The lists this user follows.
-
#followers(**params) ⇒ Cursor
The users following this user.
-
#following(**params) ⇒ Cursor
The users this user follows.
-
#home_timeline(**params) ⇒ Cursor
The home timeline of this user, which must be the authenticated user.
-
#liked_posts(**params) ⇒ Cursor
(also: #liked_tweets)
The posts liked by this user.
-
#list_memberships(**params) ⇒ Cursor
The lists this user is a member of.
-
#mentions(**params) ⇒ Cursor
The posts mentioning this user.
-
#muting(**params) ⇒ Cursor
The users this user mutes, which must be the authenticated user.
-
#owned_lists(**params) ⇒ Cursor
The lists owned by this user.
-
#pinned_lists(**params) ⇒ Cursor
The lists this user has pinned.
-
#posts(**params) ⇒ Cursor
(also: #tweets)
The posts by this user.
Instance Method Details
#affiliates(**params) ⇒ Cursor
The users affiliated with this user, such as the people of an organization
They are the accounts whose affiliation names this user, which affiliated_with reads of each of them, so they point the other way from the affiliated_with of this user.
56 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 56 def affiliates(**params) = cursor(User, "users/#{id}/affiliates", max_results: MAX_FOLLOW_RESULTS, **params) |
#blocking(**params) ⇒ Cursor
The users this user blocks, which must be the authenticated user
65 66 67 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 65 def blocking(**params) cursor(User, "users/#{id}/blocking", max_results: MAX_FOLLOW_RESULTS, **params) end |
#bookmark_folders(**params) ⇒ Cursor
The bookmark folders of the authenticated user
158 159 160 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 158 def bookmark_folders(**params) cursor(BookmarkFolder, "users/#{id}/bookmarks/folders", max_results: MAX_RESULTS, **params) end |
#bookmarks(folder: nil, **params) ⇒ Cursor
The posts bookmarked by the authenticated user, or those of one of their folders
The API gives the posts of a folder by their identifiers alone, and takes no fields for them, so they are stubs, which hydrate together, a lookup's worth at a time, as the stubs of any cursor do.
The bookmark endpoints take only the authentication of a user, OAuth 2.0 user context or OAuth 1.0a, so an app-only client is refused them; only bookmarking and unbookmarking a post refuse OAuth 1.0a too.
145 146 147 148 149 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 145 def bookmarks(folder: nil, **params) return cursor(Post, "users/#{id}/bookmarks", max_results: MAX_RESULTS, **params) if folder.nil? cursor(Post, "users/#{id}/bookmarks/folders/#{Utils.id_of(folder, BookmarkFolder)}", max_results: MAX_RESULTS, ids_only: true, **params) end |
#followed_lists(**params) ⇒ Cursor
The lists this user follows
191 192 193 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 191 def followed_lists(**params) cursor(List, "users/#{id}/followed_lists", max_results: MAX_RESULTS, **params) end |
#followers(**params) ⇒ Cursor
The users following this user
31 32 33 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 31 def followers(**params) cursor(User, "users/#{id}/followers", max_results: MAX_FOLLOW_RESULTS, total: :followers_count, **params) end |
#following(**params) ⇒ Cursor
The users this user follows
42 43 44 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 42 def following(**params) cursor(User, "users/#{id}/following", max_results: MAX_FOLLOW_RESULTS, total: :following_count, **params) end |
#home_timeline(**params) ⇒ Cursor
The home timeline of this user, which must be the authenticated user
98 99 100 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 98 def home_timeline(**params) cursor(Post, "users/#{id}/timelines/reverse_chronological", max_results: MAX_RESULTS, **params) end |
#liked_posts(**params) ⇒ Cursor Also known as: liked_tweets
The posts liked by this user
120 121 122 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 120 def liked_posts(**params) cursor(Post, "users/#{id}/liked_tweets", max_results: MAX_RESULTS, min_results: 5, **params) end |
#list_memberships(**params) ⇒ Cursor
The lists this user is a member of
180 181 182 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 180 def list_memberships(**params) cursor(List, "users/#{id}/list_memberships", max_results: MAX_RESULTS, total: :listed_count, **params) end |
#mentions(**params) ⇒ Cursor
The posts mentioning this user
109 110 111 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 109 def mentions(**params) cursor(Post, "users/#{id}/mentions", max_results: MAX_RESULTS, min_results: 5, **params) end |
#muting(**params) ⇒ Cursor
The users this user mutes, which must be the authenticated user
76 77 78 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 76 def muting(**params) cursor(User, "users/#{id}/muting", max_results: MAX_FOLLOW_RESULTS, **params) end |
#owned_lists(**params) ⇒ Cursor
The lists owned by this user
169 170 171 |
# File 'x-resources/lib/x/resources/user_collections.rb', line 169 def owned_lists(**params) cursor(List, "users/#{id}/owned_lists", max_results: MAX_RESULTS, **params) end |