Module: Mailblastr::Automations
- Defined in:
- lib/mailblastr/automations.rb
Overview
Automations are DOMAIN-FIRST: domain is required on create, and only
Events.send calls naming the same domain trigger them.
Class Method Summary collapse
-
.add_step(automation_id, params) ⇒ Object
Append a step.
-
.create(params) ⇒ Object
POST /automations Mailblastr::Automations.create({ name: "Welcome series", domain: "yourdomain.com", trigger: "contact.created" }).
-
.delete(automation_id) ⇒ Object
DELETE /automations/:id.
-
.delete_step(automation_id, step_id) ⇒ Object
Delete a step.
-
.get(automation_id) ⇒ Object
GET /automations/:id.
-
.get_run(automation_id, run_id) ⇒ Object
Retrieve a single run with its step trace.
-
.list(params = {}) ⇒ Object
GET /automations.
-
.runs(automation_id, params = {}) ⇒ Object
List an automation's runs.
-
.stop(automation_id) ⇒ Object
Stop an automation — no new runs; in-progress runs finish.
-
.update(automation_id, params) ⇒ Object
PATCH /automations/:id — params: { name:, status: "enabled"|"disabled", ... }.
Class Method Details
.add_step(automation_id, params) ⇒ Object
Append a step. POST /automations/:id/steps — params: { type:, config:, key: }
32 33 34 |
# File 'lib/mailblastr/automations.rb', line 32 def add_step(automation_id, params) Client.request(:post, "/automations/#{Client.path_escape(automation_id)}/steps", body: params) end |
.create(params) ⇒ Object
POST /automations Mailblastr::Automations.create({ name: "Welcome series", domain: "yourdomain.com", trigger: "contact.created" })
11 12 13 14 |
# File 'lib/mailblastr/automations.rb', line 11 def create(params) Client.require_domain!(params, "Automations.create") Client.request(:post, "/automations", body: params) end |
.delete(automation_id) ⇒ Object
DELETE /automations/:id
57 58 59 |
# File 'lib/mailblastr/automations.rb', line 57 def delete(automation_id) Client.request(:delete, "/automations/#{Client.path_escape(automation_id)}") end |
.delete_step(automation_id, step_id) ⇒ Object
Delete a step. DELETE /automations/:id/steps/:step_id
37 38 39 |
# File 'lib/mailblastr/automations.rb', line 37 def delete_step(automation_id, step_id) Client.request(:delete, "/automations/#{Client.path_escape(automation_id)}/steps/#{Client.path_escape(step_id)}") end |
.get(automation_id) ⇒ Object
GET /automations/:id
17 18 19 |
# File 'lib/mailblastr/automations.rb', line 17 def get(automation_id) Client.request(:get, "/automations/#{Client.path_escape(automation_id)}") end |
.get_run(automation_id, run_id) ⇒ Object
Retrieve a single run with its step trace. GET /automations/:id/runs/:run_id
47 48 49 |
# File 'lib/mailblastr/automations.rb', line 47 def get_run(automation_id, run_id) Client.request(:get, "/automations/#{Client.path_escape(automation_id)}/runs/#{Client.path_escape(run_id)}") end |
.list(params = {}) ⇒ Object
GET /automations
22 23 24 |
# File 'lib/mailblastr/automations.rb', line 22 def list(params = {}) Client.request(:get, "/automations", query: Client.pagination(params)) end |
.runs(automation_id, params = {}) ⇒ Object
List an automation's runs. GET /automations/:id/runs
42 43 44 |
# File 'lib/mailblastr/automations.rb', line 42 def runs(automation_id, params = {}) Client.request(:get, "/automations/#{Client.path_escape(automation_id)}/runs", query: Client.pagination(params)) end |
.stop(automation_id) ⇒ Object
Stop an automation — no new runs; in-progress runs finish. POST /automations/:id/stop
52 53 54 |
# File 'lib/mailblastr/automations.rb', line 52 def stop(automation_id) Client.request(:post, "/automations/#{Client.path_escape(automation_id)}/stop") end |
.update(automation_id, params) ⇒ Object
PATCH /automations/:id — params: { name:, status: "enabled"|"disabled", ... }
27 28 29 |
# File 'lib/mailblastr/automations.rb', line 27 def update(automation_id, params) Client.request(:patch, "/automations/#{Client.path_escape(automation_id)}", body: params) end |