Class: NG
- Inherits:
-
Object
- Object
- NG
- Defined in:
- lib/voip.rb
Overview
Simple way to make and receive telephone calls through a VoIP PBX, such as Ozeki Phone System XE.
Class Method Summary collapse
-
.send_sms(ng_ip_address, username, password, to, message, port = 9501, from = nil) ⇒ Object
Class method to send an SMS message.
Instance Method Summary collapse
-
#initialize(ng_ip_address, username, password, port = 9501) ⇒ NG
constructor
Creates a new NG object.
-
#send_sms(to, message, from = nil) ⇒ Object
Instance method to send an SMS message.
Constructor Details
#initialize(ng_ip_address, username, password, port = 9501) ⇒ NG
Creates a new NG object.
9 10 11 12 13 14 |
# File 'lib/voip.rb', line 9 def initialize ng_ip_address, username, password, port=9501 @ng_ip_address = ng_ip_address @username = username @password = password @port = port end |
Class Method Details
.send_sms(ng_ip_address, username, password, to, message, port = 9501, from = nil) ⇒ Object
Class method to send an SMS message.
22 23 24 25 26 27 28 |
# File 'lib/voip.rb', line 22 def self.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 |