Freshdesk: fix erroring on unknown statuses by hardcoding FlightCar's.

(imported from commit 0a4b8ccaa883048fdc7a7d7712cc528194775d89)
This commit is contained in:
Jessica McKellar 2013-11-15 16:39:17 -05:00
parent a363b7185d
commit 30e4de6767

View File

@ -594,14 +594,19 @@ class TicketDict(dict):
return self.get("ticket_" + field)
def property_name(property, index):
# The Freshdesk API is currently pretty broken: statuses are customizable
# but the API will only tell you the number associated with the status, not
# the name. While we engage the Freshdesk developers about exposing this
# information through the API, since only FlightCar uses this integration,
# hardcode their statuses.
statuses = ["", "", "Open", "Pending", "Resolved", "Closed",
"Waiting on Customer", "Waiting on Third Party"]
"Waiting on Customer", "Job Application", "Monthly"]
priorities = ["", "Low", "Medium", "High", "Urgent"]
if property == "status":
return statuses[index]
return statuses[index] if index < len(statuses) else str(index)
elif property == "priority":
return priorities[index]
return priorities[index] if index < len(priorities) else str(index)
else:
raise ValueError("Unknown property")