tencentcloud-sdk-ruby 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +2 -2
- data/lib/tencent_cloud/tpns/v20210422/tpns_client.rb +42 -0
- data/lib/tencent_cloud/trtc/v20190722/trtc_client.rb +1 -1
- data/lib/tencent_cloud/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f169c93d2c71967f4fef2b1278c60887acbc4228dd015af3abc8d7eca0cde3b7
|
4
|
+
data.tar.gz: 21122698511bbc18f6161b818a216f9194f43e0680825f8e40bd4967eead2ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a6452e0c87da7069004458a69a1ba55490d6338c175e472bdc3c0c2e54bcc74b3ddb4e0ecd29de035ff48120f64b1709f00f762abdad9eb3d4d09a8a70b7ff1
|
7
|
+
data.tar.gz: b5523fe9a6cacf1d1740ab5379e1a8d37f1d937a924df3e8c92da156c8280dd71ea3aef51bf78d47faecf3bb957640578d02c79272499f1a5f2b7650d7d9bfef
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tencentcloud-sdk-ruby (0.3.
|
4
|
+
tencentcloud-sdk-ruby (0.3.4)
|
5
5
|
typhoeus (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
diff-lcs (1.3)
|
12
12
|
ethon (0.14.0)
|
13
13
|
ffi (>= 1.15.0)
|
14
|
-
ffi (1.15.
|
14
|
+
ffi (1.15.3)
|
15
15
|
method_source (1.0.0)
|
16
16
|
pry (0.13.1)
|
17
17
|
coderay (~> 1.1)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'base64'
|
3
|
+
require 'openssl'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
require 'cgi'
|
7
|
+
require 'json'
|
8
|
+
module TencentCloud
|
9
|
+
class TpnsClient
|
10
|
+
API_VERSION = '2021-04-22'
|
11
|
+
ENDPOINTS = {
|
12
|
+
'gz' => 'https://api.tpns.tencent.com',
|
13
|
+
'sh' => 'https://api.tpns.sh.tencent.com',
|
14
|
+
'hk' => 'https://api.tpns.hk.tencent.com',
|
15
|
+
'sg' => 'https://api.tpns.sgp.tencent.com'
|
16
|
+
}
|
17
|
+
|
18
|
+
def initialize(access_id, secret_key, region)
|
19
|
+
@access_id = access_id
|
20
|
+
@secret_key = secret_key
|
21
|
+
@end_point = ENDPOINTS[region.to_s]
|
22
|
+
end
|
23
|
+
|
24
|
+
def http_request(api_path, data)
|
25
|
+
current_timestamp = Time.current.to_i.to_s
|
26
|
+
uri = URI.parse("#{@end_point}#{api_path}")
|
27
|
+
|
28
|
+
request = Net::HTTP::Post.new(uri.to_s)
|
29
|
+
request.body = data.to_json
|
30
|
+
request.initialize_http_header({AccessId: @access_id, TimeStamp: current_timestamp, Sign: sign(current_timestamp, request.body)})
|
31
|
+
request.set_content_type 'application/json'
|
32
|
+
|
33
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
34
|
+
http.request request
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def sign(current_timestamp, body)
|
39
|
+
Base64.strict_encode64(OpenSSL::HMAC.hexdigest('sha256', @secret_key, "#{current_timestamp}#{@access_id}#{body}"))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -56,7 +56,7 @@ module TencentCloud
|
|
56
56
|
#################### 房间管理相关接口
|
57
57
|
## 解散房间
|
58
58
|
## https://cloud.tencent.com/document/api/647/37088
|
59
|
-
dissmiss_room: '
|
59
|
+
dissmiss_room: 'DismissRoom',
|
60
60
|
## 移出用户
|
61
61
|
## https://cloud.tencent.com/document/api/647/40496
|
62
62
|
remove_user: 'RemoveUser',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tencentcloud-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FengCe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/tencent_cloud/common/http/sign.rb
|
112
112
|
- lib/tencent_cloud/ocr/v20181119/ocr_client.rb
|
113
113
|
- lib/tencent_cloud/tms/v20200713/tms_client.rb
|
114
|
+
- lib/tencent_cloud/tpns/v20210422/tpns_client.rb
|
114
115
|
- lib/tencent_cloud/trtc/v20190722/trtc_client.rb
|
115
116
|
- lib/tencent_cloud/version.rb
|
116
117
|
- tencent_cloud.gemspec
|