Module: Millionsend::Segments

Defined in:
lib/millionsend/segments.rb

Overview

Dynamic segments — a saved filter over the team's contacts. A MillionSend extension with no Resend equivalent.

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

POST /segments



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

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

.get(id) ⇒ Object

GET /segments/:id — also returns a live contact_count.



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

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

.list(options = {}) ⇒ Object

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



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

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

.remove(id) ⇒ Object

DELETE /segments/:id



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

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

.update(id, params) ⇒ Object

PATCH /segments/:id



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

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