Sha256: 21c71fc7b18fc944a8fee60c940a8e04484fdf3f1241f4987515692e7a5bff46
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
module ActiveSMS::Backend # Base class for any sms provider service. # Provides basic structure and helper methods. # While not necessary to be subclassed now, may be necessary later. class Base # In initializer you may # accept secrets which were defined in initializer # or other configuration options if any. # # @param params [Hash] List of arguments received from configure code. def initialize(params = {}) end # Interface for sending sms. # Every subclass should implement method itself. # Raises error in default implementation. # # @param _phone [String] Phone number to send sms (not used in this implementation) # @param _text [String] Sms text (not used in this implementation) def send_sms(_phone, _text) raise NotImplementedError, "You should create your own class for every sms service you use" end protected # Returns ActiveSMS::Reponse object with status and meta # # @param status [Symbol] # Query status, any other than :success considered as failure # @param meta [Hash] # Optional metadata you can return from api or implementation # @return [ActiveSMS::Reponse] Response object with meta and status def respond_with_status(status, meta: nil) ActiveSMS::Response.new(status: status, meta: meta) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_sms-0.2.1 | lib/active_sms/backend/base.rb |