Method: Aliyun::OSS::Protocol#put_object
- Defined in:
- lib/aliyun/oss/protocol.rb
#put_object(bucket_name, object_name, opts = {}) {|HTTP::StreamWriter| ... } ⇒ Object
Put an object to the specified bucket, a block is required to provide the object data.
514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/aliyun/oss/protocol.rb', line 514 def put_object(bucket_name, object_name, opts = {}, &block) logger.debug("Begin put object, bucket: #{bucket_name}, object: "\ "#{object_name}, options: #{opts}") headers = {'Content-Type' => opts[:content_type]} (opts[:metas] || {}) .each { |k, v| headers["x-oss-meta-#{k.to_s}"] = v.to_s } @http.put( {:bucket => bucket_name, :object => object_name}, {:headers => headers, :body => HTTP::StreamPayload.new(&block)}) logger.debug('Done put object') end |