Module: DeviseSmsVerifiable::Provider

Defined in:
lib/devise_sms_verifiable/provider.rb

Overview

This implementation only for “STREAM-TELECOM”

Constant Summary collapse

MAIN_URL =
"http://web.szk-info.ru/sendsms.php"
SENT_SMS_URL =
"#{MAIN_URL}?user=%s&pwd=%s&sadr=%s&dadr=%s&text=%s"
CHECK_SMS_URL =
"#{MAIN_URL}?user=%s&pwd=%s&smsid=%s"

Class Method Summary collapse

Class Method Details

.check_status(sms_id) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/devise_sms_verifiable/provider.rb', line 21

def self.check_status(sms_id)
  url = CHECK_SMS_URL % [Devise::,
                         Devise::provider_password,
                         sms_id]
  response = case RestClient.get(url)
             when /Send/ then :send
             when /deliver/ then :deliver
             end
  response
end

.send_sms(number, message) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/devise_sms_verifiable/provider.rb', line 10

def self.send_sms(number, message)
  return 'test' if Devise::provider_silent
  number = number.gsub(/\+/, '')
  url = URI.escape(SENT_SMS_URL % [Devise::,
                                   Devise::provider_password,
                                   Devise::provider_from,
                                   number,
                                   message])
  RestClient.get(url)
end