lib/tracker_api/endpoints/attachment.rb in tracker_api-1.12.0 vs lib/tracker_api/endpoints/attachment.rb in tracker_api-1.13.0

- old
+ new

@@ -17,10 +17,12 @@ # def delete(comment, file_attachment_id) # client.delete("/projects/#{comment.project_id}/stories/#{comment.story_id}/comments/#{comment.id}/file_attachments/#{file_attachment_id}").body # end def get(comment) - data = client.get("/projects/#{comment.project_id}/stories/#{comment.story_id}/comments/#{comment.id}?fields=file_attachments").body["file_attachments"] + comment_target_slug = !comment.story_id.nil? ? "stories/#{comment.story_id}" : "epics/#{comment.epic_id}" + + data = client.get("/projects/#{comment.project_id}/#{comment_target_slug}/comments/#{comment.id}?fields=file_attachments").body["file_attachments"] raise Errors::UnexpectedData, 'Array of file attachments expected' unless data.is_a? Array data.map do |file_attachment| Resources::FileAttachment.new({ comment: comment }.merge(file_attachment)) end