Module: Millionsend::Broadcasts

Defined in:
lib/millionsend/broadcasts.rb

Overview

Broadcasts — one email sent to a segment, a topic's subscribers, or every contact (pass neither segment_id nor topic_id).

Class Method Summary collapse

Class Method Details

.cancel(id) ⇒ Object

POST /broadcasts/:id/cancel — scheduled only.



41
42
43
# File 'lib/millionsend/broadcasts.rb', line 41

def cancel(id)
  Millionsend::Request.new(method: :post, path: "/broadcasts/#{Millionsend::Util.encode(id)}/cancel").perform
end

.create(params) ⇒ Object

POST /broadcasts



9
10
11
# File 'lib/millionsend/broadcasts.rb', line 9

def create(params)
  Millionsend::Request.new(method: :post, path: "/broadcasts", body: params).perform
end

.get(id) ⇒ Object

GET /broadcasts/:id



14
15
16
# File 'lib/millionsend/broadcasts.rb', line 14

def get(id)
  Millionsend::Request.new(method: :get, path: "/broadcasts/#{Millionsend::Util.encode(id)}").perform
end

.list(options = {}) ⇒ Object

GET /broadcasts — accepts limit:/after:/before:.



19
20
21
22
23
# File 'lib/millionsend/broadcasts.rb', line 19

def list(options = {})
  Millionsend::Request.new(
    method: :get, path: "/broadcasts", query: Millionsend::Util.list_query(options)
  ).perform
end

.remove(id) ⇒ Object

DELETE /broadcasts/:id — draft only.



31
32
33
# File 'lib/millionsend/broadcasts.rb', line 31

def remove(id)
  Millionsend::Request.new(method: :delete, path: "/broadcasts/#{Millionsend::Util.encode(id)}").perform
end

.send(id, params = {}) ⇒ Object

POST /broadcasts/:id/send — pass scheduled_at: to schedule, omit to send now.



36
37
38
# File 'lib/millionsend/broadcasts.rb', line 36

def send(id, params = {})
  Millionsend::Request.new(method: :post, path: "/broadcasts/#{Millionsend::Util.encode(id)}/send", body: params).perform
end

.update(id, params) ⇒ Object

PATCH /broadcasts/:id — draft only.



26
27
28
# File 'lib/millionsend/broadcasts.rb', line 26

def update(id, params)
  Millionsend::Request.new(method: :patch, path: "/broadcasts/#{Millionsend::Util.encode(id)}", body: params).perform
end