joyent/ruby-manta — pull request #7 by chmhofer (2013-10-23 15:12:34+00:00)
Title: Support URL signing for multiple methods

Motivation: CORS file upload (http://www.w3.org/TR/cors/)

Joyent Manta supports CORS file uploads via the PUT request when the directory has the required CORS headers. The browser will send it as a preflighted request, i.e., it will first send an OPTIONS, then a PUT request. In order for this to work, we have to generate a signed URL that is valid for both requests.

node-manta has support for generating such a signature, but ruby-manta so far doesn't. This pull-request adds this functionality to ruby-manta. Now, a list of methods can be passed to the "method" parameter of gen_signed_url, and :options is regarded an allowed method.

I have adapted the test, too. It demonstrates how it is supposed to be used.