Class: SMS
- Inherits:
-
Object
- Object
- SMS
- Defined in:
- lib/ozeki_sms.rb
Overview
Simple way to send sms through Ozeki Phone System XE or Ozeki NG SMS Gateway.
Class Method Summary collapse
-
.ng_send_sms(ng_ip_address, username, password, to, message, port = 9501, from = nil) ⇒ Object
Class method to send an SMS message through Ozeki NG SMS Gateway.
-
.ops_send_sms(ops_ip_address, api_extension, to, message, http_api_service_port = 7780, from = nil, delivery_report_url = nil, username = nil, password = nil) ⇒ Object
Class method to send an SMS message through Ozeki Phone System XE.
Class Method Details
.ng_send_sms(ng_ip_address, username, password, to, message, port = 9501, from = nil) ⇒ Object
Class method to send an SMS message through Ozeki NG SMS Gateway
9 10 11 12 13 14 15 |
# File 'lib/ozeki_sms.rb', line 9 def self.ng_send_sms ng_ip_address, username, password, to, , port=9501, from=nil to = URI::encode(to) = URI::encode() from ||= "" uri = URI "http://#{ng_ip_address}:#{port}/api?action=sendmessage&username=#{username}&password=#{password}&originator=#{from}&recipient=#{to}&messagetype=SMS:TEXT&messagedata=#{}" Response.create Net::HTTP.get uri end |
.ops_send_sms(ops_ip_address, api_extension, to, message, http_api_service_port = 7780, from = nil, delivery_report_url = nil, username = nil, password = nil) ⇒ Object
Class method to send an SMS message through Ozeki Phone System XE
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ozeki_sms.rb', line 18 def self.ops_send_sms ops_ip_address, api_extension, to, , http_api_service_port=7780, from=nil, delivery_report_url=nil, username=nil, password=nil to = URI::encode(to) = URI::encode() from ||= "" from = URI::encode(from) delivery_report_url ||= "" delivery_report_url = URI::encode(delivery_report_url) http_api_service_port ||= 7780 SMS.execute_query "http://#{ops_ip_address}:#{http_api_service_port}/?Command=SendSms&ApiExtension=#{api_extension}&Sender=#{from}&Recipient=#{to}&Message=#{}&DeliveryReportURL=#{delivery_report_url}", username, password end |