Class: Github::S3Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/github/s3_uploader.rb

Instance Method Summary collapse

Instance Method Details

#upload(path, metadata) ⇒ Object



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, )
  response = RestClient.post(["s3_url"], [
    ["key", "#{["path"]}"],
    ["acl", ["acl"]],
    ["success_action_status", 201],
    ["Filename", ["name"]],
    ["AWSAccessKeyId", ["accesskeyid"]],
    ["Policy", ["policy"]],
    ["Signature", ["signature"]],
    ["Content-Type", ["mime_type"]],
    ["file", File.open(path)]
  ])
  if response.code == 201
    ["url"]
  else 
    false
  end
end