Class: Unitpost::Resources::Topics

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

#create(body) ⇒ Object



224
225
226
# File 'lib/unitpost/resources.rb', line 224

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

#delete(id) ⇒ Object



236
237
238
# File 'lib/unitpost/resources.rb', line 236

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

#get(id) ⇒ Object



228
229
230
# File 'lib/unitpost/resources.rb', line 228

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

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



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

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

#list_all(**params) ⇒ Object



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

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

#list_topics(contact_id, limit: nil, after: nil, before: nil) ⇒ Object



240
241
242
# File 'lib/unitpost/resources.rb', line 240

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

#set_topic(contact_id, body) ⇒ Object



244
245
246
# File 'lib/unitpost/resources.rb', line 244

def set_topic(contact_id, body)
  @http.request("POST", "/contacts/#{enc(contact_id)}/topics", body: body)
end

#update(id, body) ⇒ Object



232
233
234
# File 'lib/unitpost/resources.rb', line 232

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