Sha256: 445b28335ec08f2b09d195266da21c2b080358d21a747cf0f1938fba9dd2d81a

Contents?: true

Size: 903 Bytes

Versions: 2

Compression:

Stored size: 903 Bytes

Contents

require 'aliyun/cloud_sms/request/base'

module Aliyun
  module CloudSms
    module Request
      class MessageSend < Base

        attr_accessor :mobile, :template_code, :template_param, :optional_params

        def initialize(mobile, template_code, template_param, optional_params = nil)
          self.mobile = mobile
          self.template_code = template_code
          self.template_param = template_param
          self.optional_params = optional_params || {}
        end

        def action
          "SendSms".freeze
        end

        def custom_params
          self.template_param = self.template_param.to_json if self.template_param.is_a?(Hash)

          {
            :PhoneNumbers => self.mobile,
            :TemplateCode => self.template_code,
            :TemplateParam => self.template_param.to_s,
          }.merge!(self.optional_params)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aliyun-cloud_sms-0.2.3 lib/aliyun/cloud_sms/request/message_send.rb
aliyun-cloud_sms-0.2.2 lib/aliyun/cloud_sms/request/message_send.rb