Sha256: 6a7d76ebd52ad8b62f19d399c60b8e270e151209e2b4235a71908371e48f992a
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
require 'digest/md5' require 'faraday' module Smsc class Sms 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 def message(message, phones, options = {}) params = { login: @login, psw: @password, phones: phones.join(','), mes: message, charset: @charset, sender: options[:sender] } @connection.post '/sys/send.php', params end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smsc-0.0.6 | lib/smsc.rb |
smsc-0.0.5 | lib/smsc.rb |