class AliyunSDK::OSS::Config

A place to store various configurations: credentials, api timeout, retry mechanism, etc

Public Class Methods

new(opts = {}) click to toggle source
Calls superclass method AliyunSDK::Common::Struct::Base::new
# File lib/aliyun_sdk/oss/config.rb, line 15
def initialize(opts = {})
  super(opts)

  @access_key_id = @access_key_id.strip if @access_key_id
  @access_key_secret = @access_key_secret.strip if @access_key_secret
  normalize_endpoint if endpoint
end

Private Instance Methods

normalize_endpoint() click to toggle source
# File lib/aliyun_sdk/oss/config.rb, line 25
def normalize_endpoint
  uri = URI.parse(endpoint)
  uri = URI.parse("http://#{endpoint}") unless uri.scheme

  if uri.scheme != 'http' and uri.scheme != 'https'
    fail ClientError, "Only HTTP and HTTPS endpoint are accepted."
  end

  @endpoint = uri
end