Module: Baidu::Configure

Included in:
Baidu
Defined in:
lib/baidu/pcs.rb,
lib/baidu/configure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#client_idString

申请创建应用后获取的 API Key

Returns:

  • (String)


5
6
7
# File 'lib/baidu/configure.rb', line 5

def client_id
  @client_id
end

#client_secretString

申请创建应用后获取的 Secret Key

Returns:

  • (String)


9
10
11
# File 'lib/baidu/configure.rb', line 9

def client_secret
  @client_secret
end

#debugBoolean

Note:

请勿在生产环境中打开

用来控制是否在终端输出调试信息,主要涉及网络请求部分(Net::HTTP)

Returns:

  • (Boolean)

    默认为 false



14
15
16
# File 'lib/baidu/configure.rb', line 14

def debug
  @debug
end

#pcs_dir_nameString

全局配置 PCS 的文件目录

Returns:

  • (String)


17
18
19
# File 'lib/baidu/pcs.rb', line 17

def pcs_dir_name
  @pcs_dir_name
end

Instance Method Details

#config {|c| ... } ⇒ Configure

通过 block 进行 API 配置

Yields:

  • (c)

Yield Parameters:

Returns:



21
22
23
24
25
# File 'lib/baidu/configure.rb', line 21

def config
  self.debug = false  # 默认 false
  yield self
  self
end