Class: Smsc::Sms
- Inherits:
-
Object
- Object
- Smsc::Sms
- Defined in:
- lib/smsc.rb
Instance Method Summary collapse
-
#initialize(login, password, charset = 'utf-8') ⇒ Sms
constructor
A new instance of Sms.
- #message(message, phones, options = {}) ⇒ Object
Constructor Details
#initialize(login, password, charset = 'utf-8') ⇒ Sms
Returns a new instance of Sms.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/smsc.rb', line 7 def initialize(login, password, charset = 'utf-8') @login = login @password = Digest::MD5.hexdigest(password.to_s) @charset = charset @connection = Faraday.new(url: 'https://smsc.ru') do |i| i.request :url_encoded i.response :logger i.adapter Faraday.default_adapter end end |
Instance Method Details
#message(message, phones, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/smsc.rb', line 18 def (, phones, = {}) params = { login: @login, psw: @password, phones: phones.join(','), mes: , charset: @charset, sender: [:sender] } @connection.post '/sys/send.php', params end |