Class: Posthubify::XEngagementResource

Inherits:
Object
  • Object
show all
Defined in:
lib/posthubify/resources/platform.rb

Overview

X engagements (Node sdk .engagement.x) — repost/bookmark/follow + undo.

Instance Method Summary collapse

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(, tweet_id)
  @http.data('POST', '/engagement/x/bookmarks', body: { 'accountId' => , '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(, target)
  @http.data('POST', '/engagement/x/follows', body: { 'accountId' => , '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(, tweet_id)
  @http.data('POST', '/engagement/x/retweets', body: { 'accountId' => , '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(, tweet_id)
  @http.data('DELETE', '/engagement/x/bookmarks', query: { 'accountId' => , '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(, tweet_id)
  @http.data('DELETE', '/engagement/x/retweets', query: { 'accountId' => , 'tweetId' => tweet_id })
end

#unfollow(account_id, target) ⇒ Object

Unfollow.



174
175
176
# File 'lib/posthubify/resources/platform.rb', line 174

def unfollow(, target)
  @http.data('DELETE', '/engagement/x/follows', query: { 'accountId' => , 'target' => target })
end