Class: Posthubify::XEngagementResource
- Inherits:
-
Object
- Object
- Posthubify::XEngagementResource
- Defined in:
- lib/posthubify/resources/platform.rb
Overview
X engagements (Node sdk .engagement.x) — repost/bookmark/follow + undo.
Instance Method Summary collapse
-
#bookmark(account_id, tweet_id) ⇒ Object
Bookmark a tweet.
-
#follow(account_id, target) ⇒ Object
Follow a target.
-
#initialize(http) ⇒ XEngagementResource
constructor
A new instance of XEngagementResource.
-
#repost(account_id, tweet_id) ⇒ Object
Repost a tweet.
-
#undo_bookmark(account_id, tweet_id) ⇒ Object
Remove a bookmark.
-
#undo_repost(account_id, tweet_id) ⇒ Object
Undo a repost.
-
#unfollow(account_id, target) ⇒ Object
Unfollow.
Constructor Details
#initialize(http) ⇒ XEngagementResource
Returns a new instance of XEngagementResource.
144 145 146 |
# File 'lib/posthubify/resources/platform.rb', line 144 def initialize(http) @http = http end |
Instance Method Details
#bookmark(account_id, tweet_id) ⇒ Object
Bookmark a tweet.
159 160 161 |
# File 'lib/posthubify/resources/platform.rb', line 159 def bookmark(account_id, tweet_id) @http.data('POST', '/engagement/x/bookmarks', body: { 'accountId' => account_id, 'tweetId' => tweet_id }) end |
#follow(account_id, target) ⇒ Object
Follow a target.
169 170 171 |
# File 'lib/posthubify/resources/platform.rb', line 169 def follow(account_id, target) @http.data('POST', '/engagement/x/follows', body: { 'accountId' => account_id, 'target' => target }) end |
#repost(account_id, tweet_id) ⇒ Object
Repost a tweet.
149 150 151 |
# File 'lib/posthubify/resources/platform.rb', line 149 def repost(account_id, tweet_id) @http.data('POST', '/engagement/x/retweets', body: { 'accountId' => account_id, 'tweetId' => tweet_id }) end |
#undo_bookmark(account_id, tweet_id) ⇒ Object
Remove a bookmark.
164 165 166 |
# File 'lib/posthubify/resources/platform.rb', line 164 def undo_bookmark(account_id, tweet_id) @http.data('DELETE', '/engagement/x/bookmarks', query: { 'accountId' => account_id, 'tweetId' => tweet_id }) end |
#undo_repost(account_id, tweet_id) ⇒ Object
Undo a repost.
154 155 156 |
# File 'lib/posthubify/resources/platform.rb', line 154 def undo_repost(account_id, tweet_id) @http.data('DELETE', '/engagement/x/retweets', query: { 'accountId' => account_id, 'tweetId' => tweet_id }) end |
#unfollow(account_id, target) ⇒ Object
Unfollow.
174 175 176 |
# File 'lib/posthubify/resources/platform.rb', line 174 def unfollow(account_id, target) @http.data('DELETE', '/engagement/x/follows', query: { 'accountId' => account_id, 'target' => target }) end |