Module: RestClient::Payload

Extended by:
Payload
Included in:
Payload
Defined in:
lib/vendor/rest-client/lib/rest_client/payload.rb

Defined Under Namespace

Classes: Base, Multipart, UrlEncoded

Constant Summary collapse

MIME_TYPES =

:stopdoc: From WEBrick.

{
	"ai"    => "application/postscript",
	"asc"   => "text/plain",
	"avi"   => "video/x-msvideo",
	"bin"   => "application/octet-stream",
	"bmp"   => "image/bmp",
	"class" => "application/octet-stream",
	"cer"   => "application/pkix-cert",
	"crl"   => "application/pkix-crl",
	"crt"   => "application/x-x509-ca-cert",
	"css"   => "text/css",
	"dms"   => "application/octet-stream",
	"doc"   => "application/msword",
	"dvi"   => "application/x-dvi",
	"eps"   => "application/postscript",
	"etx"   => "text/x-setext",
	"exe"   => "application/octet-stream",
	"gif"   => "image/gif",
	"gz"   => "application/x-gzip",
	"htm"   => "text/html",
	"html"  => "text/html",
	"jpe"   => "image/jpeg",
	"jpeg"  => "image/jpeg",
	"jpg"   => "image/jpeg",
	"js"    => "text/javascript",
	"lha"   => "application/octet-stream",
	"lzh"   => "application/octet-stream",
	"mov"   => "video/quicktime",
	"mpe"   => "video/mpeg",
	"mpeg"  => "video/mpeg",
	"mpg"   => "video/mpeg",
	"pbm"   => "image/x-portable-bitmap",
	"pdf"   => "application/pdf",
	"pgm"   => "image/x-portable-graymap",
	"png"   => "image/png",
	"pnm"   => "image/x-portable-anymap",
	"ppm"   => "image/x-portable-pixmap",
	"ppt"   => "application/vnd.ms-powerpoint",
	"ps"    => "application/postscript",
	"qt"    => "video/quicktime",
	"ras"   => "image/x-cmu-raster",
	"rb"    => "text/plain",
	"rd"    => "text/plain",
	"rtf"   => "application/rtf",
	"sgm"   => "text/sgml",
	"sgml"  => "text/sgml",
	"tif"   => "image/tiff",
	"tiff"  => "image/tiff",
	"txt"   => "text/plain",
	"xbm"   => "image/x-xbitmap",
	"xls"   => "application/vnd.ms-excel",
	"xml"   => "text/xml",
	"xpm"   => "image/x-xpixmap",
	"xwd"   => "image/x-xwindowdump",
	"zip"   => "application/zip",
}

Instance Method Summary collapse

Instance Method Details

#generate(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/vendor/rest-client/lib/rest_client/payload.rb', line 8

def generate(params)
	if params.is_a?(String)
		Base.new(params)
	elsif params.delete(:multipart) == true || 
		params.any? { |_,v| v.respond_to?(:path) && v.respond_to?(:read) }
		Multipart.new(params)
	else
		UrlEncoded.new(params)
	end
end