Module: BosClient

Defined in:
lib/bos_client.rb,
lib/bos_client/auth.rb,
lib/bos_client/error.rb,
lib/bos_client/bucket.rb,
lib/bos_client/config.rb,
lib/bos_client/helper.rb,
lib/bos_client/object.rb,
lib/bos_client/request.rb,
lib/bos_client/service.rb,
lib/bos_client/version.rb

Defined Under Namespace

Modules: Helper Classes: Authable, Bucket, Error, Object, Request

Constant Summary collapse

DEFAULTS =
{
  scheme: 'http',
  url: 'bcebos.com',
  location: 'bj',
  expiration_in_seconds: 1800,
  access_key_id: '*****',
  secret_access_key: '*****'
}
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.bucketsObject



5
6
7
8
# File 'lib/bos_client/service.rb', line 5

def buckets
  list_buckets unless @result
  @result[:buckets].map { |bk| Bucket.new bk }
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (BosClient)

    the object that the method was called on



22
23
24
# File 'lib/bos_client/config.rb', line 22

def configure
  yield self
end

.hostObject



26
27
28
# File 'lib/bos_client/config.rb', line 26

def host
  "#{options[:scheme]}://#{options[:location]}.#{options[:url]}"
end

.optionsObject



14
15
16
# File 'lib/bos_client/config.rb', line 14

def options
  @options ||= DEFAULTS.dup
end

.options=(opts) ⇒ Object



18
19
20
# File 'lib/bos_client/config.rb', line 18

def options=(opts)
  @options = opts
end

.ownerObject



10
11
12
13
# File 'lib/bos_client/service.rb', line 10

def owner
  list_buckets unless @result
  @result[:owner]
end