Sha256: b4eaed09093c10006a50969803fc27f286feb2bd15657a275bd77103d3f254e4
Contents?: true
Size: 597 Bytes
Versions: 1
Compression:
Stored size: 597 Bytes
Contents
require 'json' require 'net/http' module Smscru class Client attr_reader :config def initialize(options) @config = Smscru.config.dup @config.update(options) end def send_message(text, phones, options={}) params = { mes: text, phones: Array(phones), login: config.login, psw: config.password, charset: 'utf-8', fmt: 3 } uri = URI.parse('http://smsc.ru/sys/send.php') response = Net::HTTP.post_form(uri, params.merge(options)) JSON.parse(response.body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smscru-0.0.2 | lib/smscru/client.rb |