class Multipart::MultipartPost

Constants

BOUNDARY

Public Instance Methods

prepare_query(params) click to toggle source
# File lib/spout/helpers/send_file.rb, line 89
def prepare_query(params)
  fp = []
  params.each do |k, v|
    if v.respond_to?(:read)
      fp.push(FileParam.new(k, v.path, v.read))
    else
      fp.push(Param.new(k, v))
    end
  end
  query = fp.collect { |p| "--#{BOUNDARY}\r\n" + p.to_multipart }.join("") + "--#{BOUNDARY}--"
  return query, HEADER
end