Module: ConvertApi::FileParam

Defined in:
lib/convert_api/file_param.rb

Class Method Summary collapse

Class Method Details

.build(value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/convert_api/file_param.rb', line 5

def build(value)
  case value
  when UploadIO, URI_REGEXP
    value
  when Result
    value.file.url
  when ResultFile
    value.url
  when IO
    UploadIO.new(value)
  else
    UploadIO.new(File.open(value))
  end
end