tencentcloud-sdk-ruby 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d63ec07ed2b45baf521ea387b146fed61dc9037a60d19d74f3284a54b7bde460
4
+ data.tar.gz: e5de90b02ef31434fbcc568f54963da72f7968cdbfd48e78637e2cdcbf16deb2
5
+ SHA512:
6
+ metadata.gz: 593c0b31872972abbdc86f0e8c295bd31eceafc87431c95b50a71d5ecd42876a223f3fac6d3aaf50a8a52fbdb11191506b115d2feb6bed5f54850d8e40f092ad
7
+ data.tar.gz: 4719e82eb00bc1009416af0b4678bef17cdf804832abe15f3ddd064480fdf067895353791a77c4a1276281d6df78b83e88288e73e8d60b90d2b5d4635a7f8fb1
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.5
7
+ before_install: gem install bundler -v 2.0.2
@@ -0,0 +1,9 @@
1
+ tencentcloud-sdk-ruby '0.2.0', 2020-10-20
2
+ -----------------------------------------
3
+
4
+ - ADD ocr Support
5
+
6
+ tencentcloud-sdk-ruby '0.1.0', 2020-09-17
7
+ -----------------------------------------
8
+
9
+ - ADD trtc Support
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at kalelfc@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in tencent_cloud.gemspec
6
+ gemspec
@@ -0,0 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tencentcloud-sdk-ruby (0.2.0)
5
+ typhoeus (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coderay (1.1.3)
11
+ diff-lcs (1.3)
12
+ ethon (0.12.0)
13
+ ffi (>= 1.3.0)
14
+ ffi (1.13.1)
15
+ method_source (1.0.0)
16
+ pry (0.13.1)
17
+ coderay (~> 1.1)
18
+ method_source (~> 1.0)
19
+ rake (13.0.1)
20
+ rspec (3.5.0)
21
+ rspec-core (~> 3.5.0)
22
+ rspec-expectations (~> 3.5.0)
23
+ rspec-mocks (~> 3.5.0)
24
+ rspec-core (3.5.4)
25
+ rspec-support (~> 3.5.0)
26
+ rspec-expectations (3.5.0)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.5.0)
29
+ rspec-mocks (3.5.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.5.0)
32
+ rspec-support (3.5.0)
33
+ typhoeus (1.4.0)
34
+ ethon (>= 0.9.0)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ bundler (~> 2.0)
41
+ pry (~> 0.1)
42
+ rake (>= 12.3.3)
43
+ rspec (~> 3.0)
44
+ tencentcloud-sdk-ruby!
45
+
46
+ BUNDLED WITH
47
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 FengCe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
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
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'tencentcloud-sdk-ruby'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install tencentcloud-sdk-ruby
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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
+
31
+ 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
+
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
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the TencentCloud project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tencent_cloud/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'tencent_cloud'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'tencent_cloud'
5
+ require 'tencent_cloud/ocr/v20181119/ocr_client'
6
+ # replace secret_id secret_key
7
+ secret_id = 'SECRET_ID'
8
+ secret_key = 'SECRET_KEY'
9
+ credential = TencentCloud::Common::Credential.new(secret_id, secret_key)
10
+ payload = {
11
+ 'ImageUrl' => 'IMAGE URL'
12
+ }
13
+ resp = TencentCloud::OcrClient.new(credential, 'ap-beijing').business_card_ocr(payload)
14
+ puts resp.body
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'tencent_cloud'
5
+ require 'tencent_cloud/trtc/v20190722/trtc_client'
6
+ # replace secret_id secret_key
7
+ secret_id = 'SECRET_ID'
8
+ secret_key = 'SECRET_KEY'
9
+ credential = TencentCloud::Common::Credential.new(secret_id, secret_key)
10
+ payload = {
11
+ 'SdkAppId' => 'SDKAPPID',
12
+ 'StartTime' => Time.now.to_i - 24 * 3600,
13
+ 'EndTime' => Time.now.to_i
14
+ }
15
+ resp = TencentCloud::TrtcClient.new(credential, 'ap-guangzhou').describe_room_information(payload)
16
+ puts resp.body
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'tencent_cloud'
5
+ require 'tencent_cloud/trtc/v20190722/trtc_client'
6
+ # replace secret_id secret_key
7
+ secret_id = 'SECRET_ID'
8
+ secret_key = 'SECRET_KEY'
9
+ credential = TencentCloud::Common::Credential.new(secret_id, secret_key)
10
+
11
+ payload = {
12
+ # replace SdkAppId
13
+ "SdkAppId": 'SDKAPPID',
14
+ "RoomId": 1,
15
+ "OutputParams": {
16
+ "StreamId": 's12'
17
+ },
18
+ "EncodeParams": {
19
+ "VideoWidth": 1280,
20
+ "VideoHeight": 720,
21
+ "VideoBitrate": 1560,
22
+ "VideoFramerate": 2,
23
+ "VideoGop": 2,
24
+ "BackgroundColor": 0,
25
+ "AudioSampleRate": 48_000,
26
+ "AudioBitrate": 64,
27
+ "AudioChannels": 2
28
+ },
29
+ "LayoutParams": {
30
+ "Template": 0
31
+ }
32
+ }
33
+ resp = TencentCloud::TrtcClient.new(credential, 'ap-guangzhou').start_mcu_mix_transcode(payload)
34
+ puts resp.body
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencent_cloud/version'
4
+ # require "tencent_cloud/trtc/v20190722/trtc_client"
5
+ # require "tencent_cloud/ocr/v20181119/ocr_client"
6
+ module TencentCloud
7
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencent_cloud/common/exception/tencent_cloud_sdk_exception'
4
+ require 'tencent_cloud/common/credential'
5
+ require 'tencent_cloud/common/http/request'
6
+ require 'tencent_cloud/common/http/sign'
7
+ module TencentCloud
8
+ module Common
9
+ class BaseClient
10
+ def initialize(credential, region)
11
+ @credential = credential
12
+ @region = region
13
+ end
14
+
15
+ def camel_case(str)
16
+ return str if str !~ /_/ && str =~ /[A-Z]+.*/
17
+
18
+ str.split('_').map(&:capitalize).join
19
+ end
20
+
21
+ def get_response(action, body)
22
+ headers = {
23
+ 'X-TC-Action' => action,
24
+ 'X-TC-Version' => self.class::API_VERSION,
25
+ 'X-TC-Region' => @region,
26
+ 'X-TC-Timestamp' => Time.now.to_i
27
+ }
28
+ request = TencentCloud::Common::Http::Request.new @credential, self.class, headers: headers, body: JSON.generate(body, space: ' ')
29
+ request.run
30
+ end
31
+
32
+ def method_missing(m, body)
33
+ unless self.class::APIS.keys.include?(m)
34
+ raise TencentCloud::Common::Exception::TencentCloudSDKException, 'InvalidMethod, method not found'
35
+ end
36
+
37
+ api = self.class::APIS[m]
38
+ unless body.is_a?(Hash)
39
+ raise TencentCloud::Common::Exception::TencentCloudSDKException, 'InvalidPayload, payload must be a hash'
40
+ end
41
+
42
+ get_response(api, body)
43
+ # puts "There's no method called #{m} here -- please try again."
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TencentCloud
4
+ module Common
5
+ class Credential
6
+ attr_accessor :secret_id, :secret_key, :token
7
+
8
+ # Tencent Cloud Credentials.
9
+ # Access https://console.cloud.tencent.com/cam/capi to manage your
10
+ # credentials.
11
+ # :param secret_id: The secret id of your credential.
12
+ # :type secret_id: string
13
+ # :param secret_key: The secret key of your credential.
14
+ # :type secret_key: string
15
+ # :param token: The federation token of your credential, if this field
16
+ # is specified, secret_id and secret_key should be set
17
+ # accordingly, see: https://cloud.tencent.com/document/product/598/13896
18
+ def initialize(secret_id, secret_key, token = nil)
19
+ self.secret_id = secret_id if validate(:secret_id, secret_id)
20
+ self.secret_key = secret_key if validate(:secret_key, secret_key)
21
+ self.token = token
22
+ end
23
+
24
+ private
25
+
26
+ def validate(key, value)
27
+ value = value.to_s
28
+ if value.nil? || value.strip.empty?
29
+ raise Exception::TencentCloudSDKException, "InvalidCredential, #{key} should not be none or empty"
30
+ end
31
+ raise TencentCloudSDKException("InvalidCredential, #{key} should not contain spaces") if value.strip != value
32
+
33
+ true
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TencentCloud
4
+ module Common
5
+ module Exception
6
+ class TencentCloudSDKException < StandardError; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TencentCloud
4
+ module Common
5
+ module Http
6
+ class Request
7
+ attr_accessor :klass, :options, :credential
8
+
9
+ def initialize(credential, klass, options = {})
10
+ @uri = 'https://' + klass::ENDPOINT
11
+ options[:method] ||= :post
12
+ self.options = options
13
+ self.credential = credential
14
+ self.klass = klass
15
+ end
16
+
17
+ def signed_request
18
+ headers = {
19
+ 'content-type' => 'application/json; charset=utf-8',
20
+ 'host' => klass::ENDPOINT
21
+ }
22
+ if options[:headers].nil?
23
+ options[:headers] = headers
24
+ else
25
+ options[:headers].merge! headers
26
+ end
27
+
28
+ request = Typhoeus::Request.new @uri.to_s, options
29
+ authorization = Sign.new(credential, klass, request).sign_tc3
30
+ request.options[:headers]['Authorization'] = authorization
31
+ request
32
+ end
33
+
34
+ def run
35
+ signed_request.run
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'openssl'
4
+ require 'typhoeus'
5
+ require 'uri'
6
+ require 'json'
7
+ module TencentCloud
8
+ module Common
9
+ module Http
10
+ class Sign
11
+ attr_accessor :credential, :request, :klass
12
+
13
+ SIGNED_HEADERS = %w[host content-type].freeze
14
+ ALGORITHM = 'TC3-HMAC-SHA256'
15
+ # TencentCloud::Common::Http::Sign.new(credential, klass, request)
16
+
17
+ def initialize(credential, klass, request)
18
+ unless credential.is_a?(TencentCloud::Common::Credential)
19
+ raise Exception::TencentCloudSDKException, "InvalidCredential, #{credential} is not a TencentCloud::Common::Credential"
20
+ end
21
+
22
+ self.credential = credential
23
+ self.request = request
24
+ self.klass = klass
25
+ end
26
+
27
+ def sign_tc3
28
+ # ************* 步骤 1:拼接规范请求串 *************
29
+ time = Time.now.utc
30
+ timestamp = time.to_i
31
+ date = time.strftime('%F')
32
+ # TODO: DEBUG
33
+ # timestamp = 1551113065
34
+ # date = Time.at(timestamp).utc.strftime('%Y-%m-%d')
35
+
36
+ canonical_request = [
37
+ http_request_method,
38
+ canonical_uri,
39
+ canonical_querystring,
40
+ canonical_headers,
41
+ signed_headers,
42
+ hashed_request_payload
43
+ ].join("\n")
44
+ # ************* 步骤 2:拼接待签名字符串 *************
45
+ credential_scope = "#{date}/#{klass::SERVICE_NAME}/tc3_request"
46
+
47
+ hashed_request = Digest::SHA256.hexdigest(canonical_request)
48
+
49
+ string_to_sign = [
50
+ ALGORITHM,
51
+ timestamp.to_s,
52
+ credential_scope,
53
+ hashed_request
54
+ ].join("\n")
55
+ # ************* 步骤 3:计算签名 *************
56
+ digest = OpenSSL::Digest.new('sha256')
57
+ secret_date = OpenSSL::HMAC.digest(digest, 'TC3' + credential.secret_key, date)
58
+ secret_service = OpenSSL::HMAC.digest(digest, secret_date, klass::SERVICE_NAME)
59
+ secret_signing = OpenSSL::HMAC.digest(digest, secret_service, 'tc3_request')
60
+ signature = OpenSSL::HMAC.hexdigest(digest, secret_signing, string_to_sign)
61
+
62
+ # ************* 步骤 4:拼接 Authorization *************
63
+ authorization = ALGORITHM + ' ' \
64
+ "Credential=#{credential.secret_id}/#{credential_scope}" + ', ' \
65
+ 'SignedHeaders=' + signed_headers + ', ' \
66
+ 'Signature=' + signature
67
+ authorization
68
+ end
69
+
70
+ def hashed_request_payload
71
+ payload = request.options[:body]
72
+ Digest::SHA256.hexdigest payload
73
+ end
74
+
75
+ def http_request_method
76
+ (request.options[:method] || 'get').upcase
77
+ end
78
+
79
+ def canonical_uri
80
+ uri = URI(request.base_url)
81
+ url_path = URI.encode(uri.path)
82
+ url_path == '' ? '/' : url_path
83
+ end
84
+
85
+ def canonical_headers
86
+ headers_to_sign = []
87
+ request.options[:headers].each do |k, v|
88
+ headers_to_sign << "#{k.to_s.downcase}:#{v}\n" if SIGNED_HEADERS.include?(k)
89
+ end
90
+ headers_to_sign.compact.sort.join('')
91
+ end
92
+
93
+ def signed_headers
94
+ SIGNED_HEADERS.map(&:downcase).sort.join(';')
95
+ end
96
+
97
+ # For POST method, this is a fixed value
98
+ def canonical_querystring
99
+ ''
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencent_cloud/common/base_client'
4
+ module TencentCloud
5
+ class OcrClient < Common::BaseClient
6
+ API_VERSION = '2018-11-19'
7
+ ENDPOINT = 'ocr.tencentcloudapi.com'
8
+ SERVICE_NAME = 'ocr'
9
+ APIS = {
10
+ ####################
11
+ ## 通用印刷体识别
12
+ ## https://cloud.tencent.com/document/api/866/33526
13
+ general_basic_ocr: 'GeneralBasicOCR',
14
+
15
+ ## 通用印刷体识别(高精度版)
16
+ ## https://cloud.tencent.com/document/api/866/34937
17
+ general_accurate_ocr: 'GeneralAccurateOCR',
18
+
19
+ ## 通用印刷体识别(精简版)
20
+ ## https://cloud.tencent.com/document/api/866/37831
21
+ general_efficient_ocr: 'GeneralEfficientOCR',
22
+
23
+ ## 通用印刷体识别(高速版)
24
+ ## https://cloud.tencent.com/document/api/866/33525
25
+ general_fast_ocr: 'GeneralFastOCR',
26
+
27
+ ## 英文识别
28
+ ## https://cloud.tencent.com/document/api/866/34938
29
+ english_ocr: 'EnglishOCR',
30
+
31
+ ## 通用手写体识别
32
+ ## https://cloud.tencent.com/document/api/866/36212
33
+ general_handwriting_ocr: 'GeneralHandwritingOCR',
34
+
35
+ ## 快速文本检测
36
+ ## https://cloud.tencent.com/document/api/866/37830
37
+ text_detect: 'TextDetect',
38
+
39
+ #################### 卡证文字识别相关接口
40
+ ## 身份证识别
41
+ ## https://cloud.tencent.com/document/api/866/33524
42
+ id_card_ocr: 'IDCardOCR',
43
+
44
+ ## 中国香港身份证识别
45
+ ## https://cloud.tencent.com/document/api/866/46919
46
+ hk_id_card_ocr: 'HKIDCardOCR',
47
+
48
+ ## 智能卡证分类
49
+ ## https://cloud.tencent.com/document/api/866/46770
50
+ classify_detect_ocr: 'ClassifyDetectOCR',
51
+
52
+ ## 名片识别
53
+ ## https://cloud.tencent.com/document/api/866/36214
54
+ business_card_ocr: 'BusinessCardOCR',
55
+ }.freeze
56
+ end
57
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencent_cloud/common/base_client'
4
+ module TencentCloud
5
+ class TrtcClient < Common::BaseClient
6
+ API_VERSION = '2019-07-22'
7
+ ENDPOINT = 'trtc.tencentcloudapi.com'
8
+ SERVICE_NAME = 'trtc'
9
+ APIS = {
10
+ #################### 混流转码相关接口
11
+ ## 启动云端混流
12
+ ## https://cloud.tencent.com/document/api/647/44270
13
+ start_mcu_mix_transcode: 'StartMCUMixTranscode',
14
+
15
+ ## 结束云端混流
16
+ ## https://cloud.tencent.com/document/api/647/44269
17
+ stop_mcu_mix_transcode: 'StopMCUMixTranscode',
18
+
19
+ #################### 通话质量监控相关接口
20
+ ## 创建异常信息
21
+ ## https://cloud.tencent.com/document/api/647/44683
22
+ create_trouble_info: 'CreateTroubleInfo',
23
+
24
+ ## 查询异常体验事件
25
+ ## https://cloud.tencent.com/document/api/647/45712
26
+ describe_abnormal_event: 'DescribeAbnormalEvent',
27
+
28
+ ## 查询详细事件
29
+ ## https://cloud.tencent.com/document/api/647/44864
30
+ describe_detail_event: 'DescribeDetailEvent',
31
+
32
+ ## DescribeRoomInformation 查询房间列表
33
+ ## https://cloud.tencent.com/document/api/647/44050
34
+ describe_room_information: 'DescribeRoomInformation',
35
+
36
+ ## 查询用户列表与通话指标
37
+ ## https://cloud.tencent.com/document/api/647/44054
38
+ describe_call_detail: 'DescribeCallDetail',
39
+
40
+ ## 查询历史房间和用户数
41
+ ## https://cloud.tencent.com/document/api/647/44165
42
+ describe_history_scale: 'DescribeHistoryScale',
43
+
44
+ ## 查询实时规模
45
+ ## https://cloud.tencent.com/document/api/647/44051
46
+ describe_realtime_scale: 'DescribeRealtimeScale',
47
+
48
+ ## 查询实时质量数据
49
+ ## https://cloud.tencent.com/document/api/647/44052
50
+ describe_realtime_query: 'DescribeRealtimeQuality',
51
+
52
+ ## 查询实时网络状态
53
+ ## https://cloud.tencent.com/document/api/647/44053
54
+ describe_realtime_network: 'DescribeRealtimeNetwork',
55
+
56
+ #################### 房间管理相关接口
57
+ ## 解散房间
58
+ ## https://cloud.tencent.com/document/api/647/37088
59
+ dissmiss_room: 'DissmissRoom',
60
+ ## 移出用户
61
+ ## https://cloud.tencent.com/document/api/647/40496
62
+ remove_user: 'RemoveUser',
63
+ }.freeze
64
+ end
65
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TencentCloud
4
+ VERSION = '0.2.0'
5
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'tencent_cloud/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'tencentcloud-sdk-ruby'
9
+ spec.version = TencentCloud::VERSION
10
+ spec.authors = ['FengCe']
11
+ spec.email = ['kalelfc@gmail.com']
12
+
13
+ spec.summary = '腾讯云开发者工具套件(SDK)3.0,SDK3.0是云 API3.0 平台的配套工具'
14
+ spec.description = '方便 Ruby 开发者调试和接入腾讯云产品 API,并提供首次使用开发工具包的简单示例,快速获取腾讯云 Ruby SDK 并开始调用。'
15
+ spec.homepage = 'https://github.com/acecamp/tencentcloud-sdk-ruby'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/acecamp/tencentcloud-sdk-ruby'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/acecamp/agora-education-web-demo/blob/master/CHANGELOG.txt'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_development_dependency 'bundler', '~> 2.0'
32
+ spec.add_development_dependency 'pry', '~> 0.1'
33
+ spec.add_development_dependency "rake", ">= 12.3.3"
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_runtime_dependency 'typhoeus', '~> 1.0'
36
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tencentcloud-sdk-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - FengCe
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 12.3.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 12.3.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: typhoeus
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ description: 方便 Ruby 开发者调试和接入腾讯云产品 API,并提供首次使用开发工具包的简单示例,快速获取腾讯云 Ruby SDK 并开始调用。
84
+ email:
85
+ - kalelfc@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - CHANGELOG.txt
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
102
+ - examples/ocr/v20181119/bussiness_card.rb
103
+ - examples/trtc/v20190722/describe_room_information.rb
104
+ - examples/trtc/v20190722/start_mcu_mix_transcode.rb
105
+ - lib/tencent_cloud.rb
106
+ - lib/tencent_cloud/common/base_client.rb
107
+ - lib/tencent_cloud/common/credential.rb
108
+ - lib/tencent_cloud/common/exception/tencent_cloud_sdk_exception.rb
109
+ - lib/tencent_cloud/common/http/request.rb
110
+ - lib/tencent_cloud/common/http/sign.rb
111
+ - lib/tencent_cloud/ocr/v20181119/ocr_client.rb
112
+ - lib/tencent_cloud/trtc/v20190722/trtc_client.rb
113
+ - lib/tencent_cloud/version.rb
114
+ - tencent_cloud.gemspec
115
+ homepage: https://github.com/acecamp/tencentcloud-sdk-ruby
116
+ licenses:
117
+ - MIT
118
+ metadata:
119
+ homepage_uri: https://github.com/acecamp/tencentcloud-sdk-ruby
120
+ source_code_uri: https://github.com/acecamp/tencentcloud-sdk-ruby
121
+ changelog_uri: https://github.com/acecamp/agora-education-web-demo/blob/master/CHANGELOG.txt
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubygems_version: 3.1.2
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: 腾讯云开发者工具套件(SDK)3.0,SDK3.0是云 API3.0 平台的配套工具
141
+ test_files: []