lecture-attendance-manager/app/lib/toggl.rb

14 lines
433 B
Ruby

module Toggl
def self.entries_for_project(toggl_project_id, start_time:, end_time:)
JSON.parse(HTTParty.post(
"http://localhost:3005/report",
body: {
"start_date": start_time.to_date.to_fs(),
"end_date": end_time.to_date.to_fs(),
"project_ids": [toggl_project_id]
}.to_json,
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
).body)
end
end