Module: Aliyun::Dysms
- Defined in:
- lib/aliyun/dysms.rb,
lib/aliyun/dysms/version.rb
Defined Under Namespace
Classes: Configuration
Constant Summary collapse
- VERSION =
"0.0.1"
Class Attribute Summary collapse
Class Method Summary collapse
- .client ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .response ⇒ Object
- .send(phone_numbers, template_code, template_param, out_id = "") ⇒ Object
Class Attribute Details
.configuration ⇒ Object
23 24 25 |
# File 'lib/aliyun/dysms.rb', line 23 def configuration @configuration ||= Configuration.new end |
Class Method Details
.client ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/aliyun/dysms.rb', line 48 def client @client ||= RPCClient.new( access_key_id: configuration.access_key_id, access_key_secret: configuration.access_key_secret, api_version: configuration.api_version, endpoint: "https://dysmsapi.aliyuncs.com" ) end |
.configure {|configuration| ... } ⇒ Object
27 28 29 |
# File 'lib/aliyun/dysms.rb', line 27 def configure yield(configuration) end |
.response ⇒ Object
57 58 59 |
# File 'lib/aliyun/dysms.rb', line 57 def response @response end |
.send(phone_numbers, template_code, template_param, out_id = "") ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/aliyun/dysms.rb', line 31 def send(phone_numbers, template_code, template_param, out_id = "") @response = client.request( action: configuration.action, params: { "RegionId": configuration.region_id, "SignName": configuration.sign_name, "PhoneNumbers": phone_numbers, "TemplateCode": template_code, "TemplateParam": template_param, "OutId": out_id }, opts: { method: "POST" } ) end |