Module: Baiwang
- Defined in:
- lib/baiwang.rb,
lib/baiwang/api.rb,
lib/baiwang/config.rb,
lib/baiwang/helper.rb,
lib/baiwang/apis/ec.rb,
lib/baiwang/request.rb,
lib/baiwang/version.rb,
lib/baiwang/apis/ocr.rb,
lib/baiwang/apis/scc.rb,
lib/baiwang/apis/input.rb,
lib/baiwang/apis/output.rb,
lib/baiwang/apis/user_center.rb,
lib/baiwang/token_store/base.rb,
lib/baiwang/apis/layoutservice.rb,
lib/baiwang/token_store/app_token.rb
Defined Under Namespace
Modules: Apis, Helper, TokenStore
Classes: AccessTokenExpiredError, Api, AppNotConfigException, Config, RedisNotConfigException, Request, ResponseError, Result, ResultErrorException
Constant Summary
collapse
- VERSION =
"1.0.1"
Class Method Summary
collapse
Class Method Details
.api_base_url ⇒ Object
29
30
31
32
33
|
# File 'lib/baiwang/config.rb', line 29
def api_base_url
return @api_base_url if defined?(@api_base_url)
@api_base_url = config.api_base_url
end
|
.config ⇒ Object
9
10
11
|
# File 'lib/baiwang/config.rb', line 9
def config
@config ||= Config.new
end
|
5
6
7
|
# File 'lib/baiwang/config.rb', line 5
def configure
yield config
end
|
.http_timeout_options ⇒ Object
25
26
27
|
# File 'lib/baiwang/config.rb', line 25
def http_timeout_options
config.http_timeout_options || { write: 2, connect: 5, read: 10 }
end
|
.logger ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/baiwang/config.rb', line 17
def logger
@logger ||= if config.logger.nil?
defined?(Rails) && Rails.logger ? Rails.logger : Logger.new(STDOUT)
else
config.logger
end
end
|
.redis ⇒ Object
13
14
15
|
# File 'lib/baiwang/config.rb', line 13
def redis
config.redis
end
|