Class: Posthubify::SequencesResource
- Inherits:
-
Object
- Object
- Posthubify::SequencesResource
- Defined in:
- lib/posthubify/resources/messaging.rb
Overview
Message sequence — CRUD + activate/pause + enroll/unenroll (Node sdk .sequences).
Instance Method Summary collapse
-
#activate(id) ⇒ Object
Activate a sequence.
-
#create(input) ⇒ Object
Create a sequence (steps + status/platform/account_id/exit_on_reply/exit_on_unsubscribe).
-
#delete(id) ⇒ Object
Delete a sequence.
-
#enroll(id, contact_ids) ⇒ Object
Enroll contacts into a sequence.
-
#enrollments(id) ⇒ Object
Sequence enrollments.
-
#get(id) ⇒ Object
A single sequence.
-
#initialize(http) ⇒ SequencesResource
constructor
A new instance of SequencesResource.
-
#list(status: nil, limit: nil, cursor: nil) ⇒ Object
Sequence list (paginated envelope).
-
#pause(id) ⇒ Object
Pause a sequence.
-
#unenroll(id, contact_id) ⇒ Object
Remove a contact from a sequence.
-
#update(id, input) ⇒ Object
Update a sequence (partial).
Constructor Details
#initialize(http) ⇒ SequencesResource
Returns a new instance of SequencesResource.
395 396 397 |
# File 'lib/posthubify/resources/messaging.rb', line 395 def initialize(http) @http = http end |
Instance Method Details
#activate(id) ⇒ Object
Activate a sequence.
425 426 427 |
# File 'lib/posthubify/resources/messaging.rb', line 425 def activate(id) @http.data('POST', "/sequences/#{id}/activate") end |
#create(input) ⇒ Object
Create a sequence (steps + status/platform/account_id/exit_on_reply/exit_on_unsubscribe).
410 411 412 |
# File 'lib/posthubify/resources/messaging.rb', line 410 def create(input) @http.data('POST', '/sequences', body: input) end |
#delete(id) ⇒ Object
Delete a sequence.
420 421 422 |
# File 'lib/posthubify/resources/messaging.rb', line 420 def delete(id) @http.data('DELETE', "/sequences/#{id}") end |
#enroll(id, contact_ids) ⇒ Object
Enroll contacts into a sequence.
435 436 437 |
# File 'lib/posthubify/resources/messaging.rb', line 435 def enroll(id, contact_ids) @http.data('POST', "/sequences/#{id}/enroll", body: { 'contactIds' => contact_ids }) end |
#enrollments(id) ⇒ Object
Sequence enrollments.
440 441 442 |
# File 'lib/posthubify/resources/messaging.rb', line 440 def enrollments(id) @http.data('GET', "/sequences/#{id}/enrollments") end |
#get(id) ⇒ Object
A single sequence.
405 406 407 |
# File 'lib/posthubify/resources/messaging.rb', line 405 def get(id) @http.data('GET', "/sequences/#{id}") end |
#list(status: nil, limit: nil, cursor: nil) ⇒ Object
Sequence list (paginated envelope).
400 401 402 |
# File 'lib/posthubify/resources/messaging.rb', line 400 def list(status: nil, limit: nil, cursor: nil) @http.req('GET', '/sequences', query: { 'status' => status, 'limit' => limit, 'cursor' => cursor }) end |
#pause(id) ⇒ Object
Pause a sequence.
430 431 432 |
# File 'lib/posthubify/resources/messaging.rb', line 430 def pause(id) @http.data('POST', "/sequences/#{id}/pause") end |
#unenroll(id, contact_id) ⇒ Object
Remove a contact from a sequence.
445 446 447 |
# File 'lib/posthubify/resources/messaging.rb', line 445 def unenroll(id, contact_id) @http.data('POST', "/sequences/#{id}/unenroll", body: { 'contactId' => contact_id }) end |
#update(id, input) ⇒ Object
Update a sequence (partial).
415 416 417 |
# File 'lib/posthubify/resources/messaging.rb', line 415 def update(id, input) @http.data('PATCH', "/sequences/#{id}", body: input) end |