Class: Gem::Commands::InaboxCommand::Multipart::MultipartPost

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/commands/inabox_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



147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/rubygems/commands/inabox_command.rb', line 147

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