Module: Drip::Client::Workflows

Included in:
Drip::Client
Defined in:
lib/drip/client/workflows.rb

Instance Method Summary collapse

Instance Method Details

#activate_workflow(id) ⇒ Object

Public: Activate a workflow. id - Required. The String id of the workflow

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



34
35
36
# File 'lib/drip/client/workflows.rb', line 34

def activate_workflow(id)
  make_json_api_request :post, "v2/#{}/workflows/#{id}/activate"
end

#pause_workflow(id) ⇒ Object

Public: Pause a workflow. id - Required. The String id of the workflow

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



43
44
45
# File 'lib/drip/client/workflows.rb', line 43

def pause_workflow(id)
  make_json_api_request :post, "v2/#{}/workflows/#{id}/pause"
end

#remove_subscriber_workflow(workflow_id, id_or_email) ⇒ Object

Public: Remove someone from a workflow. id - Required. The String id of the workflow id_or_email - Required. The String id or email address of the subscriber.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



77
78
79
# File 'lib/drip/client/workflows.rb', line 77

def remove_subscriber_workflow(workflow_id, id_or_email)
  make_json_api_request :delete, "v2/#{}/workflows/#{workflow_id}/subscribers/#{CGI.escape id_or_email}"
end

#start_subscriber_workflow(id, options = {}) ⇒ Object

Public: Start someone on a workflow. id - Required. The String id of the workflow

options - A Hash of options.

- email         - Optional. A new email address for the subscriber.
                  If provided and a subscriber with the email above
                  does not exist, this address will be used to
                  create a new subscriber.
- id            - Optional. The subscriber's Drip id. Either email or id must be included.
- user_id       - Optional. A unique identifier for the user in your database,
                  such as a primary key.
- time_zone     - Optional. The subscriber's time zone (in Olson
                  format). Defaults to Etc/UTC.
- custom_fields - Optional. A Hash of custom field data.
- tags          - Optional. An Array of tags.
- prospect      - Optional. A Boolean specifiying whether we should attach a lead
                  score to the subscriber (when lead scoring is enabled). Defaults to true

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



67
68
69
# File 'lib/drip/client/workflows.rb', line 67

def start_subscriber_workflow(id, options = {})
  make_json_api_request :post, "v2/#{}/workflows/#{id}/subscribers", private_generate_resource("subscribers", options)
end

#workflow(id) ⇒ Object

Public: Fetch a workflow. id - Required. The String id of the workflow

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



25
26
27
# File 'lib/drip/client/workflows.rb', line 25

def workflow(id)
  make_json_api_request :get, "v2/#{}/workflows/#{id}"
end

#workflows(options = {}) ⇒ Object

Public: List all workflows.

options - A Hash of options

- status - Optional. Filter by one of the following statuses:
           draft, active, or paused. Defaults to all.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#workflows



16
17
18
# File 'lib/drip/client/workflows.rb', line 16

def workflows(options = {})
  make_json_api_request :get, "v2/#{}/workflows", options
end