Class: Unfuzzle::Comment

Inherits:
Object
  • Object
show all
Includes:
Graft
Defined in:
lib/unfuzzle/lib/unfuzzle/comment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Graft

included

Class Method Details

.all_by_project_and_ticket(project_id, ticket_id) ⇒ Object

Return a list of all tickets for an individual project



23
24
25
26
# File 'lib/unfuzzle/lib/unfuzzle/comment.rb', line 23

def self.all_by_project_and_ticket(project_id, ticket_id)
  response = Request.get("/projects/{id}/tickets/{id}/comments")
  collection_from(response.body, 'comments/comment')
end

Instance Method Details

#create(project_id, ticket_id) ⇒ Object

Create a comment



29
30
31
32
# File 'lib/unfuzzle/lib/unfuzzle/comment.rb', line 29

def create(project_id, ticket_id)
  resource_path = "/projects/#{project_id}/tickets/#{ticket_id}/comments"
  Request.post(resource_path, self.to_xml('comment'))
end

#to_hashObject

Hash representation of this ticket’s data (for updating)



14
15
16
17
18
19
20
# File 'lib/unfuzzle/lib/unfuzzle/comment.rb', line 14

def to_hash
  {
    'id'           => id,
    'body'         => body,
    'author-id'    => author_id
  }
end