Class: TencentCloud::Common::Http::Request
- Inherits:
-
Object
- Object
- TencentCloud::Common::Http::Request
- Defined in:
- lib/tencent_cloud/common/http/request.rb
Instance Attribute Summary collapse
-
#credential ⇒ Object
Returns the value of attribute credential.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(credential, klass, options = {}) ⇒ Request
constructor
A new instance of Request.
- #run ⇒ Object
- #signed_request ⇒ Object
Constructor Details
#initialize(credential, klass, options = {}) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 |
# File 'lib/tencent_cloud/common/http/request.rb', line 9 def initialize(credential, klass, = {}) @uri = 'https://' + klass::ENDPOINT [:method] ||= :post self. = self.credential = credential self.klass = klass end |
Instance Attribute Details
#credential ⇒ Object
Returns the value of attribute credential.
7 8 9 |
# File 'lib/tencent_cloud/common/http/request.rb', line 7 def credential @credential end |
#klass ⇒ Object
Returns the value of attribute klass.
7 8 9 |
# File 'lib/tencent_cloud/common/http/request.rb', line 7 def klass @klass end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/tencent_cloud/common/http/request.rb', line 7 def @options end |
Instance Method Details
#run ⇒ Object
34 35 36 |
# File 'lib/tencent_cloud/common/http/request.rb', line 34 def run signed_request.run end |
#signed_request ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tencent_cloud/common/http/request.rb', line 17 def signed_request headers = { 'content-type' => 'application/json; charset=utf-8', 'host' => klass::ENDPOINT } if [:headers].nil? [:headers] = headers else [:headers].merge! headers end request = Typhoeus::Request.new @uri.to_s, = Sign.new(credential, klass, request).sign_tc3 request.[:headers]['Authorization'] = request end |