class Paymo::Entries

Public Instance Methods

add(start_date, end_date, task_id, options = {}) click to toggle source

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
add_bulk(date, duration, task_id, options = {}) click to toggle source

 options - hash of billed (boolean) and description

# File lib/paymo/resources/entries.rb, line 88
def add_bulk(date, duration, task_id, options = {})
end
delete(entry_id) click to toggle source
# File lib/paymo/resources/entries.rb, line 96
def delete(entry_id)
end
find_by_project(project_id, options = {}) click to toggle source

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_by_task(task_id, options = {}) click to toggle source

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_by_user(user_id, options = {}) click to toggle source

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_info(entry_id) click to toggle source

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
get_tracked_time_by_project(project_id, options = {}) click to toggle source

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
get_tracked_time_by_task(task_id, options = {}) click to toggle source

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
get_tracked_time_by_user(user_id, options = {}) click to toggle source

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
update(entry_id, start_date, end_date, options = {}) click to toggle source

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