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



38
39
40
# File 'lib/drip/client/campaigns.rb', line 38

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



28
29
30
# File 'lib/drip/client/campaigns.rb', line 28

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



72
73
74
# File 'lib/drip/client/campaigns.rb', line 72

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



18
19
20
# File 'lib/drip/client/campaigns.rb', line 18

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



48
49
50
# File 'lib/drip/client/campaigns.rb', line 48

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