class MailchimpAPI::Campaign

Public Instance Methods

schedule(time, use_timewarp = false, batch_delivery = false) click to toggle source
# File lib/mailchimp_api/resources/campaign.rb, line 34
def schedule(time, use_timewarp = false, batch_delivery = false)
  path = element_path(prefix_options) + '/actions/schedule'
  connection.post path, { schedule_time: time.iso8601, timewarp: use_timewarp, batch_delivery: batch_delivery }.to_json, self.class.headers
end
send_campaign() click to toggle source

Calls the '/send' endpoint, but we obviously can't override the Ruby 'send' method.

# File lib/mailchimp_api/resources/campaign.rb, line 29
def send_campaign
  path = element_path(prefix_options) + '/actions/send'
  connection.post path, nil, self.class.headers
end
test(emails = [], type = 'html') click to toggle source

type: String. 'html' or 'plaintext'

# File lib/mailchimp_api/resources/campaign.rb, line 40
def test(emails = [], type = 'html')
  return unless emails.present?

  path = element_path(prefix_options) + '/actions/test'
  connection.post path, { test_emails: emails, send_type: type }.to_json, self.class.headers
end