ruby/box_api.rb
def request_put(file, content_type)
	uri = URI($amazon_upload_url)

	request = Net::HTTP::Put.new(uri)
	request.body_stream = File.open(file)
	request.add_field("Content-Type", content_type)
	request.add_field('Content-Length', File.size(file))

	response = Net::HTTP.start(uri.host, uri.port,
		:use_ssl => uri.scheme == 'https',
		:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
		http.request(request)
	end

	return response
end
# HTTP PUT request
#
# Param: 
#   file - local file to upload
#   content_type - MIME type of the local file (should match amazon upload urls)
HTTP PUT request
Param:
file - local file to upload
content_type - MIME type of the local file (should match amazon upload urls)
HTTP PUT request Param : file - local file to upload content_type - MIME type of the local file ( should match amazon upload urls )
def request_put(file, content_type)
	uri = URI($amazon_upload_url)
	request = Net::HTTP::Put.new(uri)
	request.body_stream = File.open(file)
	request.add_field("Content-Type", content_type)
	request.add_field('Content-Length', File.size(file))
	response = Net::HTTP.start(uri.host, uri.port,
		:use_ssl => uri.scheme == 'https',
		:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
		http.request(request)
	end
	return response
end
def request_put ( file , content_type ) uri = URI ( $amazon_upload_url ) request = Net :: HTTP :: Put . new ( uri ) request . body_stream = File . open ( file ) request . add_field ( "Content-Type" , content_type ) request . add_field ( 'Content-Length' , File . size ( file ) ) response = Net :: HTTP . start ( uri . host , uri . port , :use_ssl => uri . scheme == 'https' , :verify_mode => OpenSSL :: SSL :: VERIFY_NONE ) do | http | http . request ( request ) end return response end
HTTP PUT request
Param:
file - local file to upload
content_type - MIME type of the local file (should match amazon upload urls)
HTTP PUT request Param : file - local file to upload content_type - MIME type of the local file ( should match amazon upload urls )
file
content_type