Class: CnSms::Adapter::Base
- Inherits:
-
Object
- Object
- CnSms::Adapter::Base
- Defined in:
- lib/cn_sms/adapter/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
- #send(phone, msg) ⇒ Object
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 |