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 def self.start_time_entry(description:, project_id:) HTTParty.post( "http://localhost:3005/start_time_entry", body: { "created_with": "Attendance Tracker", "description": description, "start": Time.now.utc.iso8601, "duration": -1, "project_id": project_id, }.to_json, headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' } ) end end