Module: COS

Defined in:
lib/cos.rb,
lib/cos/dir.rb,
lib/cos/api.rb,
lib/cos/file.rb,
lib/cos/tree.rb,
lib/cos/util.rb,
lib/cos/http.rb,
lib/cos/slice.rb,
lib/cos/struct.rb,
lib/cos/config.rb,
lib/cos/client.rb,
lib/cos/bucket.rb,
lib/cos/version.rb,
lib/cos/logging.rb,
lib/cos/download.rb,
lib/cos/resource.rb,
lib/cos/exception.rb,
lib/cos/signature.rb,
lib/cos/checkpoint.rb

Defined Under Namespace

Modules: Logging, Struct, Util Classes: API, AttrError, Bucket, COSDir, COSFile, Checkpoint, CheckpointBrokenError, Client, ClientError, Config, Download, DownloadError, Exception, FileInconsistentError, FileUploadNotComplete, HTTP, LocalPathNotExist, Resource, ResourceOperator, ServerError, Signature, Slice, Tree

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.client(options = {}) ⇒ Object

初始化实例方法


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cos.rb', line 25

def self.client(options = {})
  unless @client

    # Rails配置
    if defined? Rails
      COS::Logging.set_logger(Rails.root.join('log/cos-sdk.log'), Logger::INFO)
      configs = options.merge(config: Rails.root.join('config/cos.yml'))
      @client = COS::Client.new(configs)
    else
      @client = COS::Client.new(options)
    end

  end

  @client
end