Sha256: 4ed14ff8ceeebad83c79fa4ffca7638305d902ece3c0e2336d045cae4e98f229

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

require 'open-uri'

class Bulksms
  def initialize(settings)
    @api_url = 'http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0'
    @username = settings['username']
    @password = settings['password']
    @sender = settings['sender']
  end

  def send(to, message)
    url = URI.join(@api_url, "?username=#{@username}&password=#{@password}" \
                   "&message=#{message}&msisdn=#{to}&sender=#{@sender}")
    result = open(url, options).read
    return true if result.include? 'IN_PROGRESS'
    false
  end

  def options
    opts = {}
    url = ENV['YP_OUTBOUND_PROXY']
    opts[:proxy] = URI.parse(url) unless url.nil?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yopass-3.0.7 lib/yopass/sms_provider/bulksms.rb
yopass-3.0.6 lib/yopass/sms_provider/bulksms.rb
yopass-3.0.5 lib/yopass/sms_provider/bulksms.rb