class TogglIntegrator::TimeEntory

class TimeEntory

Constants

STATUS

Public Class Methods

create_with_toggl(args) click to toggle source
# File lib/toggl_integrator/time_entory.rb, line 18
def create_with_toggl(args)
  time_entory = args[:time_entory]
  TimeEntory.create({
                      id: time_entory['id'],
                      project_name: project_name(args),
                      description: time_entory['description'],
                      start: time_entory['start'],
                      stop: time_entory['stop'],
                      at: time_entory['at'],
                      status: STATUS[:NOT_YET]
                    })
end
delete_all_not_between(start_date, end_date) click to toggle source
# File lib/toggl_integrator/time_entory.rb, line 13
def delete_all_not_between(start_date, end_date)
  TimeEntory.where('DATE(at) NOT BETWEEN ? AND ?',
                   start_date, end_date).delete_all
end

Private Class Methods

project_name(args) click to toggle source
# File lib/toggl_integrator/time_entory.rb, line 33
def project_name(args)
  args[:projects].find { |i| i['id'] == args[:time_entory]['pid'] }['name']
end