Add basic support for updating a Harvest Time Entry via API
This commit is contained in:
parent
d84cc7a9d9
commit
03066f1135
2 changed files with 27 additions and 5 deletions
|
@ -128,13 +128,23 @@ class TimeEntryImporter(ToHarvest):
|
|||
entry = self.webapi.put_time_entry(**kwargs)
|
||||
return entry
|
||||
|
||||
def update_object(self, obj, host_data, local_data=None, all_fields=False):
|
||||
def update_object(self, entry, host_data, local_data=None, all_fields=False):
|
||||
if self.dry_run:
|
||||
return obj
|
||||
return entry
|
||||
|
||||
raise NotImplementedError
|
||||
kwargs = {
|
||||
'project_id': host_data['project_id'],
|
||||
'task_id': host_data['task_id'],
|
||||
'spent_date': host_data['spent_date'],
|
||||
# 'started_time': host_data['started_time'],
|
||||
# 'ended_time': host_data['ended_time'],
|
||||
'hours': host_data['hours'],
|
||||
'notes': host_data['notes'],
|
||||
}
|
||||
|
||||
def delete_object(self, obj):
|
||||
return self.webapi.update_time_entry(entry['id'], **kwargs)
|
||||
|
||||
def delete_object(self, entry):
|
||||
if self.dry_run:
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue