Class: Posthubify::CommentsResource
- Inherits:
-
Object
- Object
- Posthubify::CommentsResource
- Defined in:
- lib/posthubify/resources/messaging.rb
Overview
Comment management — list/reply/hide/like/delete (Node sdk .comments).
Instance Method Summary collapse
-
#create_on_post(post_id, input) ⇒ Object
Write a top-level comment on a post.
-
#delete(comment_id, account_id) ⇒ Object
Delete a comment.
-
#for_post(post_id, account_id) ⇒ Object
A post’s comments.
-
#hide(comment_id, input) ⇒ Object
Hide/show a comment.
-
#initialize(http) ⇒ CommentsResource
constructor
A new instance of CommentsResource.
-
#like(comment_id, input) ⇒ Object
Like a comment.
-
#list(platform: nil, account_id: nil, limit: nil, cursor: nil) ⇒ Object
Comment list (paginated envelope).
-
#private_reply(comment_id, input) ⇒ Object
Private reply to a commenter (IG/FB) — opens a DM without requiring an open window.
-
#reply(comment_id, input) ⇒ Object
Reply to a comment (text or media; the user provides camelCase keys).
Constructor Details
#initialize(http) ⇒ CommentsResource
Returns a new instance of CommentsResource.
36 37 38 |
# File 'lib/posthubify/resources/messaging.rb', line 36 def initialize(http) @http = http end |
Instance Method Details
#create_on_post(post_id, input) ⇒ Object
Write a top-level comment on a post.
63 64 65 |
# File 'lib/posthubify/resources/messaging.rb', line 63 def create_on_post(post_id, input) @http.data('POST', "/inbox/posts/#{post_id}/comments", body: input) end |
#delete(comment_id, account_id) ⇒ Object
Delete a comment.
78 79 80 |
# File 'lib/posthubify/resources/messaging.rb', line 78 def delete(comment_id, account_id) @http.data('DELETE', "/inbox/comments/#{comment_id}", query: { 'accountId' => account_id }) end |
#for_post(post_id, account_id) ⇒ Object
A post’s comments.
48 49 50 |
# File 'lib/posthubify/resources/messaging.rb', line 48 def for_post(post_id, account_id) @http.data('GET', "/inbox/posts/#{post_id}/comments", query: { 'accountId' => account_id }) end |
#hide(comment_id, input) ⇒ Object
Hide/show a comment.
68 69 70 |
# File 'lib/posthubify/resources/messaging.rb', line 68 def hide(comment_id, input) @http.data('POST', "/inbox/comments/#{comment_id}/hide", body: input) end |
#like(comment_id, input) ⇒ Object
Like a comment.
73 74 75 |
# File 'lib/posthubify/resources/messaging.rb', line 73 def like(comment_id, input) @http.data('POST', "/inbox/comments/#{comment_id}/like", body: input) end |
#list(platform: nil, account_id: nil, limit: nil, cursor: nil) ⇒ Object
Comment list (paginated envelope).
41 42 43 44 45 |
# File 'lib/posthubify/resources/messaging.rb', line 41 def list(platform: nil, account_id: nil, limit: nil, cursor: nil) @http.req('GET', '/inbox/comments', query: { 'platform' => platform, 'accountId' => account_id, 'limit' => limit, 'cursor' => cursor }) end |
#private_reply(comment_id, input) ⇒ Object
Private reply to a commenter (IG/FB) — opens a DM without requiring an open window.
58 59 60 |
# File 'lib/posthubify/resources/messaging.rb', line 58 def private_reply(comment_id, input) @http.data('POST', "/inbox/comments/#{comment_id}/private-reply", body: input) end |
#reply(comment_id, input) ⇒ Object
Reply to a comment (text or media; the user provides camelCase keys).
53 54 55 |
# File 'lib/posthubify/resources/messaging.rb', line 53 def reply(comment_id, input) @http.data('POST', "/inbox/comments/#{comment_id}/reply", body: input) end |