Sha256: e617bb0f75e005c8d80fa4713aee322502763db0be80101780430aef2cd4a942

Contents?: true

Size: 415 Bytes

Versions: 4

Compression:

Stored size: 415 Bytes

Contents

module TrackerApi
  class FileUtility
    class << self
      def get_file_upload(file)
        mime_type = MiniMime.lookup_by_filename(file)
        { :file => Faraday::UploadIO.new(file, mime_type) }
      end

      def check_files_exist(files)
        files.each do | file |
          raise ArgumentError, 'Attachment file not found.' unless Pathname.new(file).exist?
        end    
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/file_utility.rb
tracker_api-1.15.0 lib/tracker_api/file_utility.rb
tracker_api-1.14.0 lib/tracker_api/file_utility.rb
tracker_api-1.13.0 lib/tracker_api/file_utility.rb