Class: Wrike3::Comment

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/wrike3/comment.rb

Instance Attribute Summary

Attributes included from Common

#wrike

Instance Method Summary collapse

Constructor Details

#initialize(wrike) ⇒ Comment

Returns a new instance of Comment.



5
6
7
# File 'lib/wrike3/comment.rb', line 5

def initialize(wrike)
  @wrike = wrike
end

Instance Method Details

#add(commentable_type, commentable_id, data = {}, options = {}) ⇒ Object

Add a new comment to a task



22
23
24
# File 'lib/wrike3/comment.rb', line 22

def add(commentable_type, commentable_id, data = {}, options={})
  wrike.execute(:post, api_url(nested_path('comments', commentable_type, commentable_id)), options.merge(data))
end

#delete(id) ⇒ Object

Delete a comment



32
33
34
# File 'lib/wrike3/comment.rb', line 32

def delete(id)
  wrike.execute(:delete, api_url("comments/#{id}"), options)
end

#details(id, options = {}) ⇒ Object

Returns list of comments



17
18
19
# File 'lib/wrike3/comment.rb', line 17

def details(id, options={})
  wrike.execute(:get, api_url("comments/#{id}"), options)
end

#list(account_id = nil, options = {}) ⇒ Object

Returns list of comments



10
11
12
13
14
# File 'lib/wrike3/comment.rb', line 10

def list( = nil, options={})
  path = 'comments'
  path = "accounts/#{account_id}/#{path}" if .present?
  wrike.execute(:get, api_url(path), options)
end

#update(id, data = {}, options = {}) ⇒ Object

Update a comment



27
28
29
# File 'lib/wrike3/comment.rb', line 27

def update(id, data = {}, options={})
  wrike.execute(:put, api_url("comments/#{id}"), options.merge(data))
end