Sha256: 2741ad49050bcf6892703e745f6e919e52441ce27b0ee2719218e9f0b99c8d10

Contents?: true

Size: 405 Bytes

Versions: 6

Compression:

Stored size: 405 Bytes

Contents

module TrackerApi
  class FileUtility
    class << self
      def get_file_upload(file)
        mime_type = MimeMagic.by_path(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

6 entries across 6 versions & 1 rubygems

Version Path
tracker_api-1.12.0 lib/tracker_api/file_utility.rb
tracker_api-1.11.0 lib/tracker_api/file_utility.rb
tracker_api-1.10.0 lib/tracker_api/file_utility.rb
tracker_api-1.9.1 lib/tracker_api/file_utility.rb
tracker_api-1.9.0 lib/tracker_api/file_utility.rb
tracker_api-1.8.0 lib/tracker_api/file_utility.rb