Class: TencentCloud::Common::AbstractClient
- Inherits:
-
Object
- Object
- TencentCloud::Common::AbstractClient
- Includes:
- Log
- Defined in:
- lib/tencentcloud-sdk-common/client.rb
Overview
common client
Instance Method Summary collapse
-
#initialize(credential, region, api_version, api_endpoint, sdk_version, profile = nil) ⇒ AbstractClient
constructor
A new instance of AbstractClient.
- #send_request(action, params, options = {}) ⇒ Object
Methods included from Log
Constructor Details
#initialize(credential, region, api_version, api_endpoint, sdk_version, profile = nil) ⇒ AbstractClient
15 16 17 18 19 20 21 22 23 |
# File 'lib/tencentcloud-sdk-common/client.rb', line 15 def initialize(credential, region, api_version, api_endpoint, sdk_version, profile = nil) @credential = credential @region = region @api_version = api_version @endpoint = api_endpoint @sdk_version = sdk_version @profile = profile || ClientProfile.new @request = ApiRequset.new(@profile.http_profile.scheme, endpoint, nil, @profile.http_profile.req_timeout, @profile.http_profile.proxy) end |
Instance Method Details
#send_request(action, params, options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tencentcloud-sdk-common/client.rb', line 25 def send_request(action, params, = {}) request_data = BaseRequest.new(@profile.http_profile.scheme, endpoint, @profile.http_profile.req_method, REQUEST_PATH) build_req(action, params, request_data, ) logger.debug("Request: [\n#{request_data.to_s}]") if @profile.debug resp = @request.send_request(request_data) logger.debug("Response: [\n#{resp.to_s}]") if @profile.debug raise TencentCloudSDKException.new('ServerNetworkError', resp.data) if resp.code != '200' resp.data end |