Skip to content

Instantly share code, notes, and snippets.

@pi3r
Created July 3, 2013 07:12
Show Gist options
  • Save pi3r/5916014 to your computer and use it in GitHub Desktop.
Save pi3r/5916014 to your computer and use it in GitHub Desktop.
Extract attachments from a given ticket
// Api url to fetch audits "/api/v2/tickets/42/audits.json", you'll need to handle the pagination.
extractAttachmentsFromTicketAudits: function(audits){
var attachments = [];
_.each(audits, function(audit){
_.each(audit.events, function(event){
if (event.attachments && event.attachments.length > 0){
attachments.push(event.attachments);
}
});
});
return(_.flatten(attachments));
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment