Class: CnSms::Adapter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cn_sms/adapter/base.rb

Direct Known Subclasses

Mock, Routo, Smsxchange

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/cn_sms/adapter/base.rb', line 4

def initialize(config)
  raise RuntimeError("must implement")
end

Instance Method Details

#send(phone, msg) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/cn_sms/adapter/base.rb', line 8

def send(phone,msg)
  if (msg.size > 160)
    raise SMSError, "text to long"
  end
  match_phone = phone.to_s =~ /55[0-9]{10}/
  if (match_phone.nil?)
    raise SMSError, "phone number incorrect format (#{phone})"
  end
end