Class: Posthubify::CommentAutomationsResource

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

Overview

PHASE D4 — IG/FB comment→DM automations (per-post/story, buttons, click-tracking).

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ CommentAutomationsResource

Returns a new instance of CommentAutomationsResource.



223
224
225
# File 'lib/posthubify/resources/messaging.rb', line 223

def initialize(http)
  @http = http
end

Instance Method Details

#create(input) ⇒ Object

Create a comment→DM automation. input: platform, accountId, triggerType?, targeting?, ….



239
240
241
# File 'lib/posthubify/resources/messaging.rb', line 239

def create(input)
  @http.data('POST', '/comment-automations', body: input)
end

#delete(id) ⇒ Object

Delete a comment-automation.



249
250
251
# File 'lib/posthubify/resources/messaging.rb', line 249

def delete(id)
  @http.data('DELETE', "/comment-automations/#{id}")
end

#get(id) ⇒ Object

A single comment-automation (including funnel stats).



234
235
236
# File 'lib/posthubify/resources/messaging.rb', line 234

def get(id)
  @http.data('GET', "/comment-automations/#{id}")
end

#list(account_id: nil, platform: nil, enabled: nil) ⇒ Object

List comment-automations (filter: account_id/platform/enabled).



228
229
230
231
# File 'lib/posthubify/resources/messaging.rb', line 228

def list(account_id: nil, platform: nil, enabled: nil)
  @http.data('GET', '/comment-automations',
             query: { 'accountId' => , 'platform' => platform, 'enabled' => enabled })
end

#logs(id, limit: nil, cursor: nil) ⇒ Object

Per-comment trigger audit ledger (paginated).



254
255
256
# File 'lib/posthubify/resources/messaging.rb', line 254

def logs(id, limit: nil, cursor: nil)
  @http.req('GET', "/comment-automations/#{id}/logs", query: { 'limit' => limit, 'cursor' => cursor })
end

#update(id, input) ⇒ Object

Update a comment-automation (partial; platform/account cannot change).



244
245
246
# File 'lib/posthubify/resources/messaging.rb', line 244

def update(id, input)
  @http.data('PATCH', "/comment-automations/#{id}", body: input)
end