Module: X::Objects::Actions::Engagement
- Included in:
- X::Objects::API
- Defined in:
- x-objects/lib/x/objects/actions/engagement.rb
Overview
Like, repost, and bookmark posts as the authenticated user
Internal to x-objects: X::Objects::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
-
#bookmark(post) ⇒ Boolean
Bookmark a post as the authenticated user.
-
#like(post) ⇒ Boolean
Like a post as the authenticated user.
-
#repost(post) ⇒ Boolean
(also: #retweet)
Repost a post as the authenticated user.
-
#unbookmark(post) ⇒ Boolean
Remove a bookmark as the authenticated user.
-
#unlike(post) ⇒ Boolean
Unlike a post as the authenticated user.
-
#unrepost(post) ⇒ Boolean
(also: #unretweet)
Undo a repost as the authenticated user.
Instance Method Details
#bookmark(post) ⇒ Boolean
Bookmark a post as the authenticated user
The bookmark endpoints take only OAuth 2.0 user context, which the object layer cannot route around, so a client that signs with OAuth 1.0a is refused.
70 71 72 |
# File 'x-objects/lib/x/objects/actions/engagement.rb', line 70 def bookmark(post) User.from_id(current_user_id, client: self).bookmark(post) end |
#like(post) ⇒ Boolean
Like a post as the authenticated user
23 24 25 |
# File 'x-objects/lib/x/objects/actions/engagement.rb', line 23 def like(post) User.from_id(current_user_id, client: self).like(post) end |
#repost(post) ⇒ Boolean Also known as: retweet
Repost a post as the authenticated user
45 46 47 |
# File 'x-objects/lib/x/objects/actions/engagement.rb', line 45 def repost(post) User.from_id(current_user_id, client: self).repost(post) end |
#unbookmark(post) ⇒ Boolean
Remove a bookmark as the authenticated user
The bookmark endpoints take only OAuth 2.0 user context, which the object layer cannot route around, so a client that signs with OAuth 1.0a is refused.
84 85 86 |
# File 'x-objects/lib/x/objects/actions/engagement.rb', line 84 def unbookmark(post) User.from_id(current_user_id, client: self).unbookmark(post) end |