Module: Teamwork::Client::Comment

Included in:
Teamwork::Client
Defined in:
lib/teamwork/client/comment.rb

Instance Method Summary collapse

Instance Method Details

#delete_comment(id) ⇒ Object

DELETE a comment params:

id: UnsignedInt (the comment id to delete)

return Int (status code)



59
60
61
# File 'lib/teamwork/client/comment.rb', line 59

def delete_comment(id)
  send(:delete, "coments/#{id}")
end

#get_comment(id) ⇒ Object

GET a single comment by ID params:

id: UnsignedInt

return Teamwork::Thing



23
24
25
# File 'lib/teamwork/client/comment.rb', line 23

def get_comment(id)
  object_from_response(:get, "comments/#{id}", "comment")
end

#get_comments(resource, id, options = {}) ⇒ Object

GET comments for a given resource params:

resource: String (links, milestones, files, notebooks, tasks)
id: UnsignedInt (the id of the resource that you want to get comments on)

options:

page: UnsignedInt
pageSize: UnsignedInt (default 50)

return: [Teamwork::Thing]



14
15
16
17
# File 'lib/teamwork/client/comment.rb', line 14

def get_comments(resource, id, options = {})
  validate_resource(resource)
  objects_from_response(:get, "#{resource}/#{id}/comments", "comments", options)
end

#post_comment(resource, id, options) ⇒ Object

POST a new comment params:

resource: String (links, milestones, files, notebooks, tasks)
id: UnsignedInt (the id of the resource that you want to post comments to)

options:

body: String
notify: String (who should we notify of this comment?)
ispprivate: Boolean (default false)
pendingFileAttachments: String (see http://developer.teamwork.com/uploadingfiles for more info)

return Teamwork::Thing



37
38
39
40
# File 'lib/teamwork/client/comment.rb', line 37

def post_comment(resource, id, options)
  validate_resource(resource)
  get_comment(send(:post, "#{resource}/#{id}/comments.json", comment: options).body["commentId"])
end

#update_comment(id, options) ⇒ Object

PUT an update to a comment params:

id: UnsignedInt (the id of the comment that you want update)

options:

body: String
notify: String (who should we notify of this comment?)
ispprivate: Boolean (default false)
pendingFileAttachments: String (see http://developer.teamwork.com/uploadingfiles for more info)

return Integer (status code)



51
52
53
# File 'lib/teamwork/client/comment.rb', line 51

def update_comment(id, options)
  send(:put, "comments/#{id}.json", comment: options).status
end