tencentcloud-sdk-ruby 0.2.1 → 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 +5 -5
- data/README.md +9 -11
- data/examples/ocr/v20181119/bussiness_card.rb +1 -1
- data/examples/tms/v20190722/text_moderation.rb +19 -0
- data/examples/trtc/v20190722/describe_room_information.rb +1 -1
- data/examples/trtc/v20190722/start_mcu_mix_transcode.rb +1 -1
- data/lib/tencent_cloud/common/http/sign.rb +2 -1
- data/lib/tencent_cloud/tms/v20200713/tms_client.rb +28 -0
- 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 +9 -6
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.
|
4
|
+
tencentcloud-sdk-ruby (0.3.4)
|
5
5
|
typhoeus (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,9 +9,9 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
coderay (1.1.3)
|
11
11
|
diff-lcs (1.3)
|
12
|
-
ethon (0.
|
13
|
-
ffi (>= 1.
|
14
|
-
ffi (1.
|
12
|
+
ethon (0.14.0)
|
13
|
+
ffi (>= 1.15.0)
|
14
|
+
ffi (1.15.3)
|
15
15
|
method_source (1.0.0)
|
16
16
|
pry (0.13.1)
|
17
17
|
coderay (~> 1.1)
|
@@ -44,4 +44,4 @@ DEPENDENCIES
|
|
44
44
|
tencentcloud-sdk-ruby!
|
45
45
|
|
46
46
|
BUNDLED WITH
|
47
|
-
2.
|
47
|
+
2.2.16
|
data/README.md
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
# TencentCloud
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tencent_cloud`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
2
|
## Installation
|
8
3
|
|
9
4
|
Add this line to your application's Gemfile:
|
@@ -22,18 +17,21 @@ Or install it yourself as:
|
|
22
17
|
|
23
18
|
## Usage
|
24
19
|
|
25
|
-
|
26
|
-
|
20
|
+
```ruby
|
21
|
+
require 'tencent_cloud/ocr/v20181119/ocr_client'
|
22
|
+
credential = TencentCloud::Common::Credential.new(SECRET_ID, SECRET_KEY)
|
23
|
+
payload = {
|
24
|
+
'ImageUrl' => 'IMAGE URL'
|
25
|
+
}
|
26
|
+
resp = TencentCloud::OcrClient.new(credential, 'ap-beijing').business_card_ocr(payload)
|
27
|
+
pp JSON.parse(resp.body)
|
28
|
+
```
|
27
29
|
## Development
|
28
30
|
|
29
31
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
32
|
|
31
33
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
34
|
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tencent_cloud. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
35
|
## License
|
38
36
|
|
39
37
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'tencent_cloud'
|
5
|
+
require 'tencent_cloud/tms/v20200713/tms_client'
|
6
|
+
require 'base64'
|
7
|
+
# replace secret_id secret_key
|
8
|
+
secret_id = 'SECRET_ID'
|
9
|
+
secret_key = 'SECRET_KEY'
|
10
|
+
credential = TencentCloud::Common::Credential.new(secret_id, secret_key)
|
11
|
+
str = Base64.encode64('
|
12
|
+
北京时间12月16日,在马刺对阵火箭的比赛中,马刺遗憾输掉比赛。不过马刺也不是没有惊喜,他们的首轮秀瓦塞尔继续有精彩表现,全场打了31分钟,拿到了11分4板4抢断,8投4中的命中率。虽然球队输球,但是瓦塞尔的表现不错,不仅进攻端表现出色,面对哈登也不胆怯,哈登全场10投3中,被成功防死,瓦塞尔功不可没。
|
13
|
+
')
|
14
|
+
|
15
|
+
payload = {
|
16
|
+
'Content': str
|
17
|
+
}
|
18
|
+
resp = TencentCloud::TmsClient.new(credential, 'ap-hongkong').text_moderation(payload)
|
19
|
+
pp JSON.parse(resp.body)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'openssl'
|
4
4
|
require 'typhoeus'
|
5
5
|
require 'uri'
|
6
|
+
require 'cgi'
|
6
7
|
require 'json'
|
7
8
|
module TencentCloud
|
8
9
|
module Common
|
@@ -78,7 +79,7 @@ module TencentCloud
|
|
78
79
|
|
79
80
|
def canonical_uri
|
80
81
|
uri = URI(request.base_url)
|
81
|
-
url_path =
|
82
|
+
url_path = CGI.escape(uri.path)
|
82
83
|
url_path == '' ? '/' : url_path
|
83
84
|
end
|
84
85
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tencent_cloud/common/base_client'
|
4
|
+
module TencentCloud
|
5
|
+
class TmsClient < Common::BaseClient
|
6
|
+
API_VERSION = '2020-07-13'
|
7
|
+
ENDPOINT = 'tms.tencentcloudapi.com'
|
8
|
+
SERVICE_NAME = 'tms'
|
9
|
+
APIS = {
|
10
|
+
#################### 文本内容审核相关接口
|
11
|
+
## 账号举报接口
|
12
|
+
## https://cloud.tencent.com/document/api/1124/47690
|
13
|
+
account_tipoff_access: 'AccountTipoffAccess',
|
14
|
+
|
15
|
+
## 识别统计
|
16
|
+
## https://cloud.tencent.com/document/api/1124/51003
|
17
|
+
describe_text_stat: 'DescribeTextStat',
|
18
|
+
|
19
|
+
## 获取用户词库列表
|
20
|
+
## https://cloud.tencent.com/document/api/1124/51004
|
21
|
+
describe_text_lib: 'DescribeTextLib',
|
22
|
+
|
23
|
+
## 文本内容安全
|
24
|
+
## https://cloud.tencent.com/document/api/1124/46976
|
25
|
+
text_moderation: 'TextModeration',
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
@@ -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.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FengCe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- bin/console
|
101
101
|
- bin/setup
|
102
102
|
- examples/ocr/v20181119/bussiness_card.rb
|
103
|
+
- examples/tms/v20190722/text_moderation.rb
|
103
104
|
- examples/trtc/v20190722/describe_room_information.rb
|
104
105
|
- examples/trtc/v20190722/start_mcu_mix_transcode.rb
|
105
106
|
- lib/tencent_cloud.rb
|
@@ -109,6 +110,8 @@ files:
|
|
109
110
|
- lib/tencent_cloud/common/http/request.rb
|
110
111
|
- lib/tencent_cloud/common/http/sign.rb
|
111
112
|
- lib/tencent_cloud/ocr/v20181119/ocr_client.rb
|
113
|
+
- lib/tencent_cloud/tms/v20200713/tms_client.rb
|
114
|
+
- lib/tencent_cloud/tpns/v20210422/tpns_client.rb
|
112
115
|
- lib/tencent_cloud/trtc/v20190722/trtc_client.rb
|
113
116
|
- lib/tencent_cloud/version.rb
|
114
117
|
- tencent_cloud.gemspec
|
@@ -119,7 +122,7 @@ metadata:
|
|
119
122
|
homepage_uri: https://github.com/acecamp/tencentcloud-sdk-ruby
|
120
123
|
source_code_uri: https://github.com/acecamp/tencentcloud-sdk-ruby
|
121
124
|
changelog_uri: https://github.com/acecamp/agora-education-web-demo/blob/master/CHANGELOG.txt
|
122
|
-
post_install_message:
|
125
|
+
post_install_message:
|
123
126
|
rdoc_options: []
|
124
127
|
require_paths:
|
125
128
|
- lib
|
@@ -134,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
137
|
- !ruby/object:Gem::Version
|
135
138
|
version: '0'
|
136
139
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
140
|
+
rubygems_version: 3.2.15
|
141
|
+
signing_key:
|
139
142
|
specification_version: 4
|
140
143
|
summary: 腾讯云开发者工具套件(SDK)3.0,SDK3.0是云 API3.0 平台的配套工具
|
141
144
|
test_files: []
|