Module: Magti
- Defined in:
- lib/magti.rb,
lib/magti/sms.rb,
lib/magti/config.rb,
lib/magti/version.rb
Defined Under Namespace
Constant Summary collapse
- SMS_SEND_URL =
URL for sending SMS.
'http://81.95.160.47/mt/oneway'
- SMS_TRACK_URL =
URL for tracking SMS status.
'http://81.95.160.47/bi/track.php'
- MAX_SIZE =
Maximum size of individual SMS message.
160
- VERSION =
"0.1.1"
Class Method Summary collapse
- .config(params = {}) ⇒ Object
-
.send_sms(mobile, text) ⇒ Object
Sending SMS.
-
.track_sms(msg_id) ⇒ Object
Tracking SMS.
Class Method Details
.config(params = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/magti/config.rb', line 35 def self.config(params = {}) params.each do |k, v| Magti::Config.instance.send "#{k}=".to_sym, v end Magti::Config.instance end |
.send_sms(mobile, text) ⇒ Object
Sending SMS.
30 31 32 33 34 35 36 37 38 |
# File 'lib/magti/sms.rb', line 30 def self.send_sms(mobile, text) = Magti.config. Magti.() = .merge(:to => "995#{mobile}", :text => text, :coding => 2) http_resp = HTTParty.post(Magti::SMS_SEND_URL, {:body => }).body resp = Response.new resp.code, resp.id = http_resp.split(' - ') resp end |
.track_sms(msg_id) ⇒ Object
Tracking SMS.
41 42 43 44 45 46 47 |
# File 'lib/magti/sms.rb', line 41 def self.track_sms(msg_id) = Magti.config. Magti.() = .merge(:message_id => msg_id) http_resp = HTTParty.get(Magti::SMS_TRACK_URL, {:query => }).body http_resp.to_i end |