Class: Wrike3::Timelog

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

Instance Attribute Summary

Attributes included from Common

#wrike

Instance Method Summary collapse

Constructor Details

#initialize(wrike) ⇒ Timelog

Returns a new instance of Timelog.



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

def initialize(wrike)
  @wrike = wrike
end

Instance Method Details

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

Add a new time log



18
19
20
# File 'lib/wrike3/timelog.rb', line 18

def add(task_id, data = {}, options = {})
  wrike.execute(:get, api_url("tasks/#{task_id}/timelogs"), options.merge(data))
end

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

Delete timelog



28
29
30
# File 'lib/wrike3/timelog.rb', line 28

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

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



13
14
15
# File 'lib/wrike3/timelog.rb', line 13

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

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



9
10
11
# File 'lib/wrike3/timelog.rb', line 9

def list(logable_type = nil, logable_id = nil, options={})
  wrike.execute(:get, api_url(nested_path('timelogs', logable_type, logable_id)), options)
end

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

Update time log



23
24
25
# File 'lib/wrike3/timelog.rb', line 23

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