Method: RightAws::S3Interface#put

Defined in:
lib/s3/right_s3_interface.rb

#put(bucket, key, data = nil, headers = {}) ⇒ Object

Saves object to Amazon. Returns true or an exception. Any header starting with AMAZON_METADATA_PREFIX is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.

s3.put('my_awesome_bucket', 'log/curent/1.log', 'Ola-la!', 'x-amz-meta-family'=>'Woho556!') #=> true


361
362
363
364
365
366
# File 'lib/s3/right_s3_interface.rb', line 361

def put(bucket, key, data=nil, headers={})
  req_hash = generate_rest_request('PUT', headers.merge(:url=>"#{bucket}/#{CGI::escape key}", :data=>data))
  request_info(req_hash, S3TrueParser.new)
rescue
  on_exception
end