class Unisms::Adapter::Kotsms
Public Class Methods
new(username, password, options = {})
click to toggle source
# File lib/unisms/adapter/kotsms.rb, line 6 def initialize(username, password, options = {}) @kotsms = ::Kotsms.new username, password @kotsms_options = options end
Public Instance Methods
deliver(message, to: nil, from: nil)
click to toggle source
# File lib/unisms/adapter/kotsms.rb, line 11 def deliver(message, to: nil, from: nil) raise ArgumentError.new("phone number should start with '+'") unless /\A\+.*\z/ === to @kotsms.deliver to[1..-1], message, @kotsms_options true rescue ArgumentError => e Unisms.logger.error "ArgumentError: #{e}" rescue SocketError => e Unisms.logger.error "Failed to send message to #{to}" false end