5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/github/s3_uploader.rb', line 5
def upload(path, metadata)
response = RestClient.post(metadata["s3_url"], [
["key", "#{metadata["path"]}"],
["acl", metadata["acl"]],
["success_action_status", 201],
["Filename", metadata["name"]],
["AWSAccessKeyId", metadata["accesskeyid"]],
["Policy", metadata["policy"]],
["Signature", metadata["signature"]],
["Content-Type", metadata["mime_type"]],
["file", File.open(path)]
])
if response.code == 201
metadata["url"]
else
false
end
end
|