Module: Drip::Client::Campaigns

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

Instance Method Summary collapse

Instance Method Details

#activate_campaign(id) ⇒ Object

Public: Activate a campaign.

id - Required. The String id of the campaign.

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



36
37
38
# File 'lib/drip/client/campaigns.rb', line 36

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

#campaign(id) ⇒ Object

Public: Fetch a campaign.

id - Required. The String id of the campaign.

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



26
27
28
# File 'lib/drip/client/campaigns.rb', line 26

def campaign(id)
  make_json_api_request :get, "v2/#{}/campaigns/#{id}"
end

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

Public: List everyone subscribed to a campaign.

id - Required. The String id of the campaign.

options - A Hash of options

- status    - Optional. Filter by one of the following statuses:
              active, unsubscribed or removed. Defaults to active.
- page      - Optional. Use this parameter to paginate through
              your list of campaign subscribers. Each response contains a
              a `meta` object that includes `total_count` and
              `total_pages` attributes.
- sort      - Optional. Sort results by one of these fields:
              `id`, `created_at`. Default sorting is `created_at`
- direction - Optional. The direction to sort the results:
              `asc`, `desc`. Defaults to `desc`
- per_page  - Optional. The number of records to be returned
              on each page. Defaults to 100. Maximum 1000

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



70
71
72
# File 'lib/drip/client/campaigns.rb', line 70

def campaign_subscribers(id, options = {})
  make_json_api_request :get, "v2/#{}/campaigns/#{id}/subscribers", options
end

#campaigns(options = {}) ⇒ Object

Public: Fetch campaigns for this account

options - A Hash of options

- status - Optional. Filter by one of the following statuses:
           draft, active, or paused. Defaults to all.
- page   - Optional. Use this parameter to paginate through
           your list of campaigns. Each response contains a
           a `meta` object that includes `total_count` and
           `total_pages` attributes.

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



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

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

#pause_campaign(id) ⇒ Object

Public: Pause a campaign.

id - Required. The String id of the campaign.

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



46
47
48
# File 'lib/drip/client/campaigns.rb', line 46

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