Class: Unitpost::Resources::Segments

Inherits:
Base
  • Object
show all
Defined in:
lib/unitpost/resources.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Unitpost::Resources::Base

Instance Method Details

#add_member(id, body) ⇒ Object



216
217
218
# File 'lib/unitpost/resources.rb', line 216

def add_member(id, body)
  @http.request("POST", "/segments/#{enc(id)}/contacts", body: body)
end

#create(body) ⇒ Object



196
197
198
# File 'lib/unitpost/resources.rb', line 196

def create(body)
  @http.request("POST", "/segments", body: body)
end

#delete(id) ⇒ Object



208
209
210
# File 'lib/unitpost/resources.rb', line 208

def delete(id)
  @http.request("DELETE", "/segments/#{enc(id)}")
end

#get(id) ⇒ Object



200
201
202
# File 'lib/unitpost/resources.rb', line 200

def get(id)
  @http.request("GET", "/segments/#{enc(id)}")
end

#list(limit: nil, after: nil, before: nil) ⇒ Object



188
189
190
# File 'lib/unitpost/resources.rb', line 188

def list(limit: nil, after: nil, before: nil)
  @http.request("GET", "/segments", query: list_params(limit: limit, after: after, before: before))
end

#list_all(**params) ⇒ Object



192
193
194
# File 'lib/unitpost/resources.rb', line 192

def list_all(**params)
  paginate("/segments", params)
end

#list_members(id, limit: nil, after: nil, before: nil) ⇒ Object



212
213
214
# File 'lib/unitpost/resources.rb', line 212

def list_members(id, limit: nil, after: nil, before: nil)
  @http.request("GET", "/segments/#{enc(id)}/contacts", query: list_params(limit: limit, after: after, before: before))
end

#remove_member(id, contact) ⇒ Object



220
221
222
# File 'lib/unitpost/resources.rb', line 220

def remove_member(id, contact)
  @http.request("DELETE", "/segments/#{enc(id)}/contacts/#{enc(contact)}")
end

#update(id, body) ⇒ Object



204
205
206
# File 'lib/unitpost/resources.rb', line 204

def update(id, body)
  @http.request("PATCH", "/segments/#{enc(id)}", body: body)
end