Class: NetGSM::XmlBody

Inherits:
Object
  • Object
show all
Defined in:
lib/netgsm_sms/xml_body.rb

Class Method Summary collapse

Class Method Details

.send_mass_sms_body(message_array, valid_options) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/netgsm_sms/xml_body.rb', line 22

def self.send_mass_sms_body(message_array, valid_options)
	result = "<?xml version='1.0'?>
 	<mainbody>
 	<header>
 	 	<company #{"dil='TR'" if valid_options[:turkish] == true}>NETGSM</company>
 	 	<usercode>#{NetGSM.configuration.usercode}</usercode>
 	 	<password>#{NetGSM.configuration.password}</password>
 	 	<startdate>#{valid_options[:start_date]}</startdate>
 	 	<stopdate>#{valid_options[:stop_date]}</stopdate>
 	 	<type>n:n</type>
 	 	<msgheader>#{valid_options[:from]}</msgheader>
 	</header>	 
 	<body>
 		" + message_array.map {|message| "<mp><msg><![CDATA[#{message[1]}]]></msg><no>#{message[0]}</no></mp>" }.join("\n") + "
 	</body>	 
 	</mainbody>"

 	#puts result
 	return result
end

.send_sms_body(recipient, message_text, valid_options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/netgsm_sms/xml_body.rb', line 3

def self.send_sms_body(recipient, message_text, valid_options)
	"<?xml version='1.0'?>
 	<mainbody>
 	<header>
 	 	<company #{"dil='TR'" if valid_options[:turkish] == true}>NETGSM</company>
 	 	<usercode>#{NetGSM.configuration.usercode}</usercode>
 	 	<password>#{NetGSM.configuration.password}</password>
 	 	<startdate>#{valid_options[:start_date]}</startdate>
 	 	<stopdate>#{valid_options[:stop_date]}</stopdate>
 	 	<type>1:n</type>
 	 	<msgheader>#{valid_options[:from]}</msgheader>
 	</header>	 
 	<body>
 	 	<msg><![CDATA[#{message_text}]]></msg>
 	 	<no>#{recipient}</no>
 	</body>	 
 	</mainbody>"
end