Class: SendpulseClient::Campaign

Inherits:
Object
  • Object
show all
Defined in:
lib/sendpulse_client/campaign.rb

Constant Summary collapse

URL =
'/campaigns'.freeze

Class Method Summary collapse

Class Method Details

.allObject



8
9
10
# File 'lib/sendpulse_client/campaign.rb', line 8

def all
  Connection.get_request(URL)
end

.create(sender_name, sender_email, subject, body, list_id, name = '', attachments = false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sendpulse_client/campaign.rb', line 12

def create(sender_name, sender_email, subject, body, list_id, name = '', attachments = false)
  data = {
    sender_name: sender_name,
    sender_email: sender_email,
    subject: subject,
    body: Base64.encode64(body),
    list_id: list_id,
    name: name,
    attachments: attachments ? JSON.serialize(attachments) : ''
  }

  Connection.post_request(URL, data)
end