Class: TrackerApi::FileUtility

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_api/file_utility.rb

Class Method Summary collapse

Class Method Details

.check_files_exist(files) ⇒ Object



9
10
11
12
13
# File 'lib/tracker_api/file_utility.rb', line 9

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

.get_file_upload(file) ⇒ Object



4
5
6
7
# File 'lib/tracker_api/file_utility.rb', line 4

def get_file_upload(file)
  mime_type = MiniMime.lookup_by_filename(file)
  { :file => Faraday::UploadIO.new(file, mime_type) }
end