class Paymo::Entries
Public Instance Methods
options - hash of added_manually (boolean), billed (boolean), description (string)
# File lib/paymo/resources/entries.rb, line 84 def add(start_date, end_date, task_id, options = {}) end
 options - hash of billed (boolean) and description
# File lib/paymo/resources/entries.rb, line 88 def add_bulk(date, duration, task_id, options = {}) end
# File lib/paymo/resources/entries.rb, line 96 def delete(entry_id) end
Find entries for all tasks from the specified project matching the optional time criteria. options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 41 def find_by_project(project_id, options = {}) options.merge!({project_id: project_id }) result = Paymo::API.get :entries, :find_by_project, options if result['status'] == 'ok' result['entries']['entry'].map! do |entry| Paymo::Entry.new(entry) end end end
Find entries for a specified task matching the optional time criteria. options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 34 def find_by_task(task_id, options = {}) options.merge!({task_id: task_id }) Paymo::API.get :entries, :find_by_task, options end
Find entries for a specified user matching the optional time criteria. options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 14 def find_by_user(user_id, options = {}) options.merge!({user_id: user_id }) if options[:start] options[:start] = options[:start].strftime('%Y-%m-%d %H:%M:%S') end if options[:end] options[:end] = options[:end].strftime('%Y-%m-%d %H:%M:%S') end result = Paymo::API.get :entries, :find_by_user, options if result['status'] == 'ok' if result['entries'].any? result['entries']['entry'].map! do |entry| Paymo::Entry.new(entry) end end end end
Get detailed information about an entry.
# File lib/paymo/resources/entries.rb, line 5 def get_info(entry_id) result = Paymo::API.get :entries, :get_info, entry_id: entry_id if result['status'] == 'ok' Paymo::Entry.new(result['entry']) end end
options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 76 def get_tracked_time_by_project(project_id, options = {}) options.merge!({project_id: project_id }) result = Paymo::API.get :entries, :get_tracked_time_by_project, options { time: result['time']['_content'] } end
Returns the total amount of time tracked (in seconds) in all the entries for the given task matching the optional time criteria. options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 69 def get_tracked_time_by_task(task_id, options = {}) options.merge!({task_id: task_id }) result = Paymo::API.get :entries, :get_tracked_time_by_task, options { time: result['time']['_content'] } end
Returns the total amount of time tracked (in seconds) in all the entries for the given user matching the optional time criteria. options - start_date, end_date
# File lib/paymo/resources/entries.rb, line 54 def get_tracked_time_by_user(user_id, options = {}) options.merge!({user_id: user_id }) if options[:start] options[:start] = options[:start].strftime('%Y-%m-%d %H:%M:%S') end if options[:end] options[:end] = options[:end].strftime('%Y-%m-%d %H:%M:%S') end result = Paymo::API.get :entries, :get_tracked_time_by_user, options { time: result['time']['_content'] } end
options - task_id, added_manually = true, billed = false, description
# File lib/paymo/resources/entries.rb, line 92 def update(entry_id, start_date, end_date, options = {}) end