dashofcode/tracker_api

View on GitHub
lib/tracker_api/endpoints/attachments.rb

Summary

Maintainability
A
0 mins
Test Coverage
module TrackerApi
  module Endpoints
    class Attachments
      attr_accessor :client

      def initialize(client)
        @client = client
      end


      def create(comment, files)
        return [] if files.to_a.empty?
        #Check files before upload to make it all or none.
        FileUtility.check_files_exist(files)
        attachment = Endpoints::Attachment.new(client)
        files.map do | file |
          attachment.create(comment, file)
        end  
      end
    end
  end
end