diff --git a/app/models/toggl_service.rb b/app/models/toggl_service.rb index 9234374..9f7e982 100644 --- a/app/models/toggl_service.rb +++ b/app/models/toggl_service.rb @@ -33,17 +33,17 @@ class TogglService raise ArgumentError, 'Workspace ID must be a valid integer' end - raw_entries = get('/api/v8/time_entries', { start_date: start_date.iso8601, end_date: end_date.iso8601 }) + raw_entries = get('/api/v9/me/time_entries', { start_date: start_date.iso8601, end_date: end_date.iso8601 }) # The workspace filter is only supported on certain versions of the # Toggl API. Thus, it is easier to filter out such records ourselves. - raw_entries = raw_entries.keep_if { |r| workspace_id == r['wid'] } if workspace_id + raw_entries = raw_entries.keep_if { |r| workspace_id == r['wid'] } if workspace_id > 0 raw_entries.map { |e| TogglTimeEntry.new(e.symbolize_keys) } end # Loads workspaces from Toggl. def load_workspaces - get('/api/v8/workspaces') + get('/api/v9/workspaces') .map { |w| TogglWorkspace.new(w.symbolize_keys) } end