Class: SmscManager::SmsSendTopic
- Inherits:
-
StompMessage::StompSendTopic
- Object
- StompMessage::StompSendTopic
- SmscManager::SmsSendTopic
- Defined in:
- lib/smsc_manager/sms_send_topic.rb
Constant Summary collapse
- @@TOPIC =
need to define topic, host properly
'/topic/sms'
- @@STOMP_SMS_MESSAGE =
must be defined as method in sms_listener
'stomp_SMS'
Class Method Summary collapse
-
.create_stomp_message(txt, dest, src) ⇒ Object
simple script to show xml message.
- .print_example_xml ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SmsSendTopic
constructor
A new instance of SmsSendTopic.
-
#send_sms(text, destination, source) ⇒ Object
puts “finished initializing” end.
-
#send_topic_sms(sms) ⇒ Object
send_sms.
-
#send_topic_sms_receipt(sms, &r_block) ⇒ Object
send_sms.
Constructor Details
#initialize(options = {}) ⇒ SmsSendTopic
Returns a new instance of SmsSendTopic.
15 16 17 18 19 20 21 22 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 15 def initialize(={}) # set up variables using hash [:topic] = [:topic]==nil ? @@TOPIC : [:topic] super() #puts "finished initializing" end |
Class Method Details
.create_stomp_message(txt, dest, src) ⇒ Object
simple script to show xml message
51 52 53 54 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 51 def self.(txt,dest,src) sms=SmscManager::Sms.new(txt,dest,src) m=StompMessage::Message.new(@@STOMP_SMS_MESSAGE, sms.to_xml) end |
.print_example_xml ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 55 def self.print_example_xml text= "hello there #{Time.now}" destination = "639993130030" #must be valid destination source = '888' sms=SmscManager::Sms.new(text,destination,source) m=SmscManager::SmsSendTopic.( text,destination,source) result = "------------ SMS XML----------------\n" result << "#{sms.to_xml}\n" result << "------------STOMP XML--------------\n" result << "#{m.to_xml}\n" result << "------------END--------------------" result end |
Instance Method Details
#send_sms(text, destination, source) ⇒ Object
puts “finished initializing”
end
28 29 30 31 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 28 def send_sms(text,destination,source) sms=SmscManager::Sms.new(text,destination,source) self.send_topic_sms(sms) end |
#send_topic_sms(sms) ⇒ Object
send_sms
32 33 34 35 36 37 38 39 40 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 32 def send_topic_sms(sms) #sms=SmscManager::Sms.new(text,destination,source) # msgbody=sms.to_xml m=StompMessage::Message.new(@@STOMP_SMS_MESSAGE, sms.to_xml) # puts "message body is #{msgbody}" # headers = {:msisdn =>"#{sms.destination}"} headers = {} send_topic(m, headers) end |
#send_topic_sms_receipt(sms, &r_block) ⇒ Object
send_sms
41 42 43 44 45 46 47 48 49 |
# File 'lib/smsc_manager/sms_send_topic.rb', line 41 def send_topic_sms_receipt(sms, &r_block) #sms=SmscManager::Sms.new(text,destination,source) # msgbody=sms.to_xml m=StompMessage::Message.new(@@STOMP_SMS_MESSAGE, sms.to_xml) # puts "message body is #{msgbody}" # headers = {:msisdn =>"#{sms.destination}"} headers = {} send_topic(m, headers, &r_block) end |