Class: RemoveBg::Upload

Inherits:
Object
  • Object
show all
Defined in:
lib/remove_bg/upload.rb

Class Method Summary collapse

Class Method Details

.for_file(file_path) ⇒ Object



9
10
11
12
13
14
# File 'lib/remove_bg/upload.rb', line 9

def self.for_file(file_path)
  raise RemoveBg::FileMissingError.new(file_path) unless File.exist?(file_path)

  content_type = determine_content_type(file_path)
  Faraday::Multipart::FilePart.new(file_path, content_type)
end