如何为Clickatells 2路短信设置可选的mo值

时间:2014-03-13 13:31:40

标签: ruby-on-rails ruby clickatell

我试图通过clickatell发送2路短信。

我必须使用以下内容发送短信。

send_message(recipient, message_text, opts={})

我必须将可选的mo变量设置为1。

其他选项:

:from - the from number/name
:set_mobile_originated - mobile originated flag

以下是clickatel的源代码。

def send_message(recipient, message_text, opts={})
 valid_options = opts.only(:from, :mo, :callback)
 valid_options.merge!(:req_feat => '48') if valid_options[:from]
 valid_options.merge!(:mo => '1') if opts[:set_mobile_originated]
 recipient = recipient.join(",")if recipient.is_a?(Array)
 response = execute_command('sendmsg', 'http',
 {:to => recipient, :text => message_text}.merge(valid_options)
 ) 
 response = parse_response(response)
 response.is_a?(Array) ? response.map { |r| r['ID'] } : response['ID']
end

我的大脑被炸了,我无法弄清楚如何设置这个mo变量,因为这不起作用:

send_message(from, message, mo: '1')

有关如何设置此可选值的任何帮助吗?

1 个答案:

答案 0 :(得分:2)

改为:

send_message(from, message, set_mobile_originated: true)