Class: Zendesk2::TicketComments

Inherits:
Object
  • Object
show all
Includes:
Collection, PagedCollection
Defined in:
lib/zendesk2/ticket_comments.rb

Instance Method Summary collapse

Methods included from PagedCollection

#all_entries, #collection_method, #collection_root, #create, #create!, #each_entry, #each_page, #get, #get!, included, #model_method, #model_root, #new_page, #next_page, #previous_page

Methods included from Collection

cistern_included, #collection_method, #collection_root, #create, #create!, #get, #get!, included, #model_method, #model_root, #namespace, #new

Instance Method Details

#all(params = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/zendesk2/ticket_comments.rb', line 18

def all(params = {})
  requires :ticket_id

  body = cistern.send(collection_method, { 'ticket_id' => ticket_id }.merge(params)).body

  collection = clone.load(body[collection_root])
  collection.merge_attributes(Cistern::Hash.slice(body, 'count', 'next_page', 'previous_page'))
  collection
end

#ticketObject



14
15
16
# File 'lib/zendesk2/ticket_comments.rb', line 14

def ticket
  cistern.tickets.get(ticket_id)
end