# frozen_string_literal: true # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'json' module TencentCloud module Sms module V20210111 class Client < TencentCloud::Common::AbstractClient def initialize(credential, region, profile = nil) api_version = '2021-01-11' api_endpoint = 'sms.tencentcloudapi.com' sdk_version = 'SMS_' + File.read(File.expand_path('../VERSION', __dir__)).strip super(credential, region, api_version, api_endpoint, sdk_version, profile) end # 1. 添加短信签名,申请之前请先认真参阅 [腾讯云短信签名审核标准](https://cloud.tencent.com/document/product/382/39022)。 # 2. ⚠️注意:个人认证用户不支持使用 API 申请短信签名,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),如果为个人认证请登录控制台申请短信签名。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for AddSmsSign. # @type request: :class:`Tencentcloud::sms::V20210111::AddSmsSignRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::AddSmsSignResponse` def AddSmsSign(request) body = send_request('AddSmsSign', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = AddSmsSignResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 1. 添加短信模板,申请之前请先认真参阅 [腾讯云短信正文模板审核标准](https://cloud.tencent.com/document/product/382/39023)。 # 2. ⚠️注意:个人认证用户不支持使用 API 申请短信正文模板,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),如果为个人认证请登录 [控制台](https://console.cloud.tencent.com/smsv2) 申请短信正文模板。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for AddSmsTemplate. # @type request: :class:`Tencentcloud::sms::V20210111::AddSmsTemplateRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::AddSmsTemplateResponse` def AddSmsTemplate(request) body = send_request('AddSmsTemplate', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = AddSmsTemplateResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 统计用户回执的数据。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for CallbackStatusStatistics. # @type request: :class:`Tencentcloud::sms::V20210111::CallbackStatusStatisticsRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::CallbackStatusStatisticsResponse` def CallbackStatusStatistics(request) body = send_request('CallbackStatusStatistics', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CallbackStatusStatisticsResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # ⚠️注意:个人认证用户不支持使用 API 删除短信签名,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),请登录 [控制台](https://console.cloud.tencent.com/smsv2) 删除短信签名。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for DeleteSmsSign. # @type request: :class:`Tencentcloud::sms::V20210111::DeleteSmsSignRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::DeleteSmsSignResponse` def DeleteSmsSign(request) body = send_request('DeleteSmsSign', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteSmsSignResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # ⚠️注意:个人认证用户不支持使用 API 删除短信正文模板,请登录 [控制台](https://console.cloud.tencent.com/smsv2) 删除短信正文模板,如需了解请参阅 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629)。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for DeleteSmsTemplate. # @type request: :class:`Tencentcloud::sms::V20210111::DeleteSmsTemplateRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::DeleteSmsTemplateResponse` def DeleteSmsTemplate(request) body = send_request('DeleteSmsTemplate', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteSmsTemplateResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 提供电话号码的信息查询,包括国家(或地区)码、规范的 E.164 格式号码等。 # >- 例如:查询号码 +86018845720123,可以得到国家码 86、规范的 E.164 号码 +8618845720123 等信息。 # @param request: Request instance for DescribePhoneNumberInfo. # @type request: :class:`Tencentcloud::sms::V20210111::DescribePhoneNumberInfoRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::DescribePhoneNumberInfoResponse` def DescribePhoneNumberInfo(request) body = send_request('DescribePhoneNumberInfo', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribePhoneNumberInfoResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # ⚠️注意:个人认证用户不支持使用 API 查询短信签名,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),如果为个人认证请登录 [控制台](https://console.cloud.tencent.com/smsv2) 查询短信签名。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for DescribeSmsSignList. # @type request: :class:`Tencentcloud::sms::V20210111::DescribeSmsSignListRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::DescribeSmsSignListResponse` def DescribeSmsSignList(request) body = send_request('DescribeSmsSignList', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeSmsSignListResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # ⚠️注意:个人认证用户不支持使用 API 查询短信正文模板,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629)。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for DescribeSmsTemplateList. # @type request: :class:`Tencentcloud::sms::V20210111::DescribeSmsTemplateListRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::DescribeSmsTemplateListResponse` def DescribeSmsTemplateList(request) body = send_request('DescribeSmsTemplateList', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeSmsTemplateListResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 1. 修改短信签名,修改之前请先认真参阅 [腾讯云短信签名审核标准](https://cloud.tencent.com/document/product/382/39022)。 # 2. ⚠️注意:个人认证用户不支持使用 API 修改短信签名,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),如果为个人认证请登录 [控制台](https://console.cloud.tencent.com/smsv2) 修改短信签名。 # 3. 修改短信签名,仅当签名为**待审核**或**已拒绝**状态时,才能进行修改,**已审核通过**的签名不支持修改。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for ModifySmsSign. # @type request: :class:`Tencentcloud::sms::V20210111::ModifySmsSignRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::ModifySmsSignResponse` def ModifySmsSign(request) body = send_request('ModifySmsSign', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ModifySmsSignResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 1. 修改短信正文模板,修改之前请先认真参阅 [腾讯云短信正文模板审核标准](https://cloud.tencent.com/document/product/382/39023)。 # 2. ⚠️注意:个人认证用户不支持使用 API 修改短信正文模板,请参阅了解 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629),如果为个人认证请登录 [控制台](https://console.cloud.tencent.com/smsv2) 修改短信正文模板。 # 3. 修改短信模板,仅当正文模板为**待审核**或**已拒绝**状态时,才能进行修改,**已审核通过**的正文模板不支持修改。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2019-07-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for ModifySmsTemplate. # @type request: :class:`Tencentcloud::sms::V20210111::ModifySmsTemplateRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::ModifySmsTemplateResponse` def ModifySmsTemplate(request) body = send_request('ModifySmsTemplate', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ModifySmsTemplateResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 拉取短信回复状态。 # 目前也支持 [配置回复回调](https://cloud.tencent.com/document/product/382/42907) 的方式来获取上行回复。 # >- 注:此接口需要联系 [腾讯云短信小助手](https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81) 开通。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for PullSmsReplyStatus. # @type request: :class:`Tencentcloud::sms::V20210111::PullSmsReplyStatusRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::PullSmsReplyStatusResponse` def PullSmsReplyStatus(request) body = send_request('PullSmsReplyStatus', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = PullSmsReplyStatusResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 拉取单个号码短信回复状态。 # 目前也支持 [配置回复回调](https://cloud.tencent.com/document/product/382/42907) 的方式来获取上行回复。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for PullSmsReplyStatusByPhoneNumber. # @type request: :class:`Tencentcloud::sms::V20210111::PullSmsReplyStatusByPhoneNumberRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::PullSmsReplyStatusByPhoneNumberResponse` def PullSmsReplyStatusByPhoneNumber(request) body = send_request('PullSmsReplyStatusByPhoneNumber', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = PullSmsReplyStatusByPhoneNumberResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 拉取短信下发状态。 # 目前也支持 [配置回调](https://cloud.tencent.com/document/product/382/37809#.E8.AE.BE.E7.BD.AE.E4.BA.8B.E4.BB.B6.E5.9B.9E.E8.B0.83.E9.85.8D.E7.BD.AE) 的方式来获取下发状态。 # >- 注:此接口需要联系 [腾讯云短信小助手](https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81) 开通。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for PullSmsSendStatus. # @type request: :class:`Tencentcloud::sms::V20210111::PullSmsSendStatusRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::PullSmsSendStatusResponse` def PullSmsSendStatus(request) body = send_request('PullSmsSendStatus', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = PullSmsSendStatusResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 拉取单个号码短信下发状态。 # 目前也支持 [配置回调](https://cloud.tencent.com/document/product/382/37809#.E8.AE.BE.E7.BD.AE.E4.BA.8B.E4.BB.B6.E5.9B.9E.E8.B0.83.E9.85.8D.E7.BD.AE) 的方式来获取下发状态。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for PullSmsSendStatusByPhoneNumber. # @type request: :class:`Tencentcloud::sms::V20210111::PullSmsSendStatusByPhoneNumberRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::PullSmsSendStatusByPhoneNumberResponse` def PullSmsSendStatusByPhoneNumber(request) body = send_request('PullSmsSendStatusByPhoneNumber', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = PullSmsSendStatusByPhoneNumberResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 短信转化率上报。将已接收到短信的流水号上报到腾讯云短信服务。 # >- 注:当前接口以白名单方式对外开放,如有需要请联系 [腾讯云短信小助手](https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81) 开通。 # @param request: Request instance for ReportConversion. # @type request: :class:`Tencentcloud::sms::V20210111::ReportConversionRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::ReportConversionResponse` def ReportConversion(request) body = send_request('ReportConversion', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ReportConversionResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 短信发送接口,用于给用户发短信验证码、通知类短信或营销短信。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 [SDK](https://cloud.tencent.com/document/product/382/43193) 来使用云短信服务。 # >- 注:您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # >- 注:当前接口属于 2021-01-11 版本,如果您仍在使用 [2019-07-11 版本](https://cloud.tencent.com/document/product/382/38778),建议您使用当前最新版本的接口,版本差异可参考[版本描述](https://cloud.tencent.com/document/product/382/63195#.E7.89.88.E6.9C.AC.E6.8F.8F.E8.BF.B0)。 # @param request: Request instance for SendSms. # @type request: :class:`Tencentcloud::sms::V20210111::SendSmsRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::SendSmsResponse` def SendSms(request) body = send_request('SendSms', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = SendSmsResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 统计用户发送短信的数据。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for SendStatusStatistics. # @type request: :class:`Tencentcloud::sms::V20210111::SendStatusStatisticsRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::SendStatusStatisticsResponse` def SendStatusStatistics(request) body = send_request('SendStatusStatistics', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = SendStatusStatisticsResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 用户套餐包信息统计。 # >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 SDK 来使用云短信服务。 # >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2021-01-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 # @param request: Request instance for SmsPackagesStatistics. # @type request: :class:`Tencentcloud::sms::V20210111::SmsPackagesStatisticsRequest` # @rtype: :class:`Tencentcloud::sms::V20210111::SmsPackagesStatisticsResponse` def SmsPackagesStatistics(request) body = send_request('SmsPackagesStatistics', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = SmsPackagesStatisticsResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end end end end end