Class: KannelClient
- Inherits:
-
Object
- Object
- KannelClient
- Defined in:
- lib/kannel_client.rb
Instance Attribute Summary collapse
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#coding ⇒ Object
Returns the value of attribute coding.
-
#dlr_callback_url ⇒ Object
Returns the value of attribute dlr_callback_url.
-
#dlr_mask ⇒ Object
Returns the value of attribute dlr_mask.
-
#password ⇒ Object
Returns the value of attribute password.
-
#smsc ⇒ Object
Returns the value of attribute smsc.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
-
#validity ⇒ Object
Returns the value of attribute validity.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ KannelClient
constructor
A new instance of KannelClient.
- #send_quiet_sms(from, to, text) ⇒ Object
- #send_sms(from, to, text) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ KannelClient
Returns a new instance of KannelClient.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/kannel_client.rb', line 8 def initialize(attributes={}) self.username = attributes[:username] self.password = attributes[:password] self.url = attributes[:url] self.dlr_callback_url = attributes[:dlr_callback_url] self.dlr_mask = attributes[:dlr_mask] self.smsc = attributes[:smsc] self.coding = attributes[:coding] self.charset = attributes[:charset] self.validity = attributes[:validity] end |
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def charset @charset end |
#coding ⇒ Object
Returns the value of attribute coding.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def coding @coding end |
#dlr_callback_url ⇒ Object
Returns the value of attribute dlr_callback_url.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def dlr_callback_url @dlr_callback_url end |
#dlr_mask ⇒ Object
Returns the value of attribute dlr_mask.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def dlr_mask @dlr_mask end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def password @password end |
#smsc ⇒ Object
Returns the value of attribute smsc.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def smsc @smsc end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def username @username end |
#validity ⇒ Object
Returns the value of attribute validity.
6 7 8 |
# File 'lib/kannel_client.rb', line 6 def validity @validity end |
Instance Method Details
#send_quiet_sms(from, to, text) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kannel_client.rb', line 39 def send_quiet_sms(from,to,text) uri = URI(self.url) params = { smsc: self.smsc, username: self.username, password: self.password, from: from, to: to, text: text, coding: 2, mclass: 0, pid: 64, charset: self.charset, validity: self.validity } uri.query = URI.encode_www_form(params) response = Net::HTTP.get_response(uri) return response end |
#send_sms(from, to, text) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kannel_client.rb', line 20 def send_sms(from,to,text) uri = URI(self.url) params = { smsc: self.smsc, username: self.username, password: self.password, from: from, to: to, text: text, coding: self.coding, charset: self.charset, validity: self.validity } uri.query = URI.encode_www_form(params) response = Net::HTTP.get_response(uri) return response end |