Created
July 3, 2013 07:12
-
-
Save pi3r/5916014 to your computer and use it in GitHub Desktop.
Extract attachments from a given ticket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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