class Send
Attributes
app_version[RW]
Application version
charset[RW]
Charset encoding default: utf8
country[RW]
Country Korea : +82 (default)
datetime[RW]
Schedule datetime. Format: YYYYMMDDHHMISS
delay[RW]
Delay value : 0 ~ 20
dev_lang[RW]
Development language
extension[RW]
Extension JSON data
force_sms[RW]
Force SMS true or false
image[RW]
Image JPEG, PNG, GIF < 300KB, 2048x2048 px
image_encoding[RW]
Image encoding binary(default), base64
mode[RW]
Mode if 'test'
from_num : '010000000' datetime is ignore return_value : 60 recharge
os_platform[RW]
Client OS and platform
refname[RW]
Reference name
sdk_version[RW]
SDK version
sender_key[RW]
AlarmTalk sender Key
srk[RW]
Srk
subject[RW]
MMS, LMS subject
template_code[RW]
AlarmTalk template code
type[RW]
Message Type : SMS(default), LMS, MMS, ATA If not +82, force SMS
Public Class Methods
new(options = {})
click to toggle source
# File lib/coolsms/send.rb, line 74 def initialize(options = {}) self.set_fields(options) end
Public Instance Methods
send(from, to, text)
click to toggle source
# File lib/coolsms/send.rb, line 78 def send(from, to, text) fields = self.fields( :type, :image, :image_encoding, :refname, :country, :datetime, :subject, :charset, :srk, :mode, :extension, :delay, :force_sms, :os_platform, :dev_lang, :sdk_version, :app_version, :sender_key, :template_code ) fields = fields.merge( from: from, to: to, text: text, type: self.type ) res = Request.new.post( "send", fields ) if res.code == "200" body = JSON.parse(res.body) { ret: body['result_code'] == "00", message: body['result_message'], code: res.code, gid: body['group_id'] } else { ret: false, code: res.code } end end