module TencentCloudCos::Api

Public Instance Methods

put(file, filename) click to toggle source
# File lib/tencent_cloud_cos/api.rb, line 5
def put(file, filename)
  config.method = 'put'
  config.uri    = filename
  content_type  = config.content_type

  authorization = Authorization.new(config)
  
  begin
    response = RestClient.put("#{config.host}#{config.uri}", file, 
                              Authorization: authorization.auth_header, 
                              host: config.host, 
                              content_length: file.size,
                              content_type: content_type)
  rescue RestClient::ExceptionWithResponse => e
    return e.response
  else
    return response
  end
end