Sha256: 32670bb15595126602f1df7b6c26d8fe2d2a586f6d340e89d8f2283047f6257e
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
module IqSMS class Message def self.message_to_hash(message) hash = { clientId: message.client_id, phone: message.phone, text: message.text } hash[:wap_url] = message.wap_url if message.respond_to?(:wap_url) && message.wap_url.present? hash[:sender] = message.sender if message.sender.present? hash[:flash] = '1' if message.respond_to?(:flash) && message.flash.present? hash end def self.message_to_hash_for_status(message) { clientId: message.client_id, smscId: message.smsc_id } end attr_reader :client_id, :smsc_id, :phone, :text, :wap_url, :sender, :flash, :status def initialize(client_id:, phone:, text:, wap_url: nil, sender: nil, smsc_id: nil, status: nil, flash: false) @client_id = client_id @phone = phone @text = text @wap_url = wap_url @sender = sender @smsc_id = smsc_id @status = MessageStatus.new(status: status, client_id: client_id, smsc_id: smsc_id) @flash = flash end def flash? @flash end def to_hash self.class.message_to_hash(self) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
iqsms-0.2.2 | lib/iqsms/message.rb |
iqsms-0.2.1 | lib/iqsms/message.rb |
iqsms-0.2.0 | lib/iqsms/message.rb |