Class: TxAsr::Sign
- Inherits:
-
Object
- Object
- TxAsr::Sign
- Defined in:
- lib/tx_asr/sign.rb
Constant Summary collapse
- SERVICE =
'asr'
- HOST =
"asr.tencentcloudapi.com"
- ALGORITHM =
加密算法
'TC3-HMAC-SHA256'
- ENGINE_MODEL =
场景模型
"16k_zh_video"
- CHANNEL_NUM =
声道数
1
- CALLBACK_URL =
结果回调地址
"https://demo.mini-geek.com/speech_to_text/callback"
- AUDIO_SOURCE_FROM_URL =
声音文件来源: url
0
- AUDIO_SOURCE_FROM_BODY =
声音文件来源: 请求体
1
- FILTER_INTERJECTION_PART =
过滤语气词: 部分
1
- FILTER_INTERJECTION_ALL =
过滤语气词: 所有
2
- RESULT_FORMAT_WORDS_WITH_PUNC =
翻译的结果具体到单词时间,并返回语速
2
Instance Attribute Summary collapse
-
#file_url ⇒ Object
Returns the value of attribute file_url.
Instance Method Summary collapse
- #authorization ⇒ Object
-
#initialize(payload) ⇒ Sign
constructor
def initialize(file_url) @file_url = file_url end.
Constructor Details
#initialize(payload) ⇒ Sign
def initialize(file_url)
@file_url = file_url
end
47 48 49 |
# File 'lib/tx_asr/sign.rb', line 47 def initialize(payload) @payload = payload end |
Instance Attribute Details
#file_url ⇒ Object
Returns the value of attribute file_url.
10 11 12 |
# File 'lib/tx_asr/sign.rb', line 10 def file_url @file_url end |
Instance Method Details
#authorization ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/tx_asr/sign.rb', line 51 def signature = sign(@payload) date = Time.at().utc.strftime('%Y-%m-%d') credential_scope = date + '/' + SERVICE + "/tc3_request" signed_headers = 'content-type;host' "#{ALGORITHM} Credential=#{TxAsr.secret_id}/#{credential_scope}, SignedHeaders=#{signed_headers}, Signature=#{signature}" end |