From 509405cb346f90cd22df6c521850f0ef4af35fea Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 4 Oct 2023 13:08:29 -0500 Subject: [PATCH] Let Harvest API -> Harvest cache importer fetch single host object for one-off imports via web app --- rattail_harvest/importing/harvest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rattail_harvest/importing/harvest.py b/rattail_harvest/importing/harvest.py index 1e706a2..1da4cd2 100644 --- a/rattail_harvest/importing/harvest.py +++ b/rattail_harvest/importing/harvest.py @@ -233,6 +233,11 @@ class HarvestTimeEntryImporter(FromHarvest, rattail_harvest_importing.model.Harv kw['to'] = self.end_date return self.webapi.get_time_entries(**kw) + def get_single_host_object(self, key): + assert len(self.key) == 1 and self.key[0] == 'id' + entry_id = key[0] + return self.webapi.get_time_entry(entry_id) + def normalize_host_object(self, entry): data = super(HarvestTimeEntryImporter, self).normalize_host_object(entry) if not data: