Class: Baidubce::BceBaseClient
- Inherits:
-
Object
- Object
- Baidubce::BceBaseClient
- Defined in:
- lib/baidubce/bce_base_client.rb
Direct Known Subclasses
Constant Summary
Constants included from Http
Http::AUTHORIZATION, Http::BCE_ACL, Http::BCE_CONTENT_CRC32, Http::BCE_CONTENT_SHA256, Http::BCE_COPY_METADATA_DIRECTIVE, Http::BCE_COPY_SOURCE, Http::BCE_COPY_SOURCE_IF_MATCH, Http::BCE_COPY_SOURCE_IF_MODIFIED_SINCE, Http::BCE_COPY_SOURCE_IF_NONE_MATCH, Http::BCE_COPY_SOURCE_IF_UNMODIFIED_SINCE, Http::BCE_COPY_SOURCE_RANGE, Http::BCE_DATE, Http::BCE_PREFIX, Http::BCE_REQUEST_ID, Http::BCE_USER_METADATA_PREFIX, Http::BOS_DEBUG_ID, Http::BOS_STORAGE_CLASS, Http::CACHE_CONTROL, Http::CONTENT_DISPOSITION, Http::CONTENT_ENCODING, Http::CONTENT_LENGTH, Http::CONTENT_MD5, Http::CONTENT_RANGE, Http::CONTENT_TYPE, Http::DATE, Http::DELETE, Http::ETAG, Http::EXPIRES, Http::GET, Http::HEAD, Http::HOST, Http::JSON_TYPE, Http::LAST_MODIFIED, Http::OCTET_STREAM_TYPE, Http::POST, Http::PUT, Http::RANGE, Http::SERVER, Http::STS_SECURITY_TOKEN, Http::USER_AGENT
Instance Method Summary collapse
- #compute_endpoint ⇒ Object
-
#initialize(config, service_id = "", region_supported = true) ⇒ BceBaseClient
constructor
A new instance of BceBaseClient.
Constructor Details
#initialize(config, service_id = "", region_supported = true) ⇒ BceBaseClient
Returns a new instance of BceBaseClient.
27 28 29 30 31 32 33 34 |
# File 'lib/baidubce/bce_base_client.rb', line 27 def initialize(config, service_id="", region_supported=true) @config = config @service_id = service_id @region_supported = region_supported @config.endpoint = compute_endpoint if @config.endpoint.to_s.empty? @http_client = BaseHttpClient.new() @signer = BceV1Signer.new() end |
Instance Method Details
#compute_endpoint ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/baidubce/bce_base_client.rb', line 36 def compute_endpoint if @region_supported return sprintf('%s://%s.%s.%s', @config.protocol, @service_id, @config.region, DEFAULT_SERVICE_DOMAIN) else return sprintf('%s://%s.%s', @config.protocol, @service_id, DEFAULT_SERVICE_DOMAIN) end end |