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 https://www.getdrip.com/docs/rest-api#campaigns



40
41
42
# File 'lib/drip/client/campaigns.rb', line 40

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

#campaign(id) ⇒ Object

Public: Fetch a campaign.

id - Required. The String id of the campaign.

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



30
31
32
# File 'lib/drip/client/campaigns.rb', line 30

def campaign(id)
  make_json_api_request :get, "v2/#{}/campaigns/#{CGI.escape id.to_s}"
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 https://www.getdrip.com/docs/rest-api#campaigns



74
75
76
# File 'lib/drip/client/campaigns.rb', line 74

def campaign_subscribers(id, options = {})
  make_json_api_request :get, "v2/#{}/campaigns/#{CGI.escape id.to_s}/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 https://www.getdrip.com/docs.rest-api#campaigns



20
21
22
# File 'lib/drip/client/campaigns.rb', line 20

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 https://www.getdrip.com/docs/rest-api#campaigns



50
51
52
# File 'lib/drip/client/campaigns.rb', line 50

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