Class: Gem::Commands::SboxCommand::Multipart::MultipartPost

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/commands/sbox_command.rb

Constant Summary collapse

BOUNDARY =
'tarsiers-rule0000'
HEADER =
{"Content-type" => "multipart/form-data, boundary=" + BOUNDARY + " "}

Instance Method Summary collapse

Instance Method Details

#prepare_query(params) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/rubygems/commands/sbox_command.rb', line 149

def prepare_query(params)
  fp = []
  params.each {|k,v|
    if v.respond_to?(:read)
      fp.push(FileParam.new(k, v.path, v.read))
    else
      fp.push(Param.new(k,v))
    end
  }
  query = fp.collect {|p| "--" + BOUNDARY + "\r\n" + p.to_multipart }.join("") + "--" + BOUNDARY + "--"
  return query, HEADER
end