Class: AnySMS::Backend::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/any_sms/backend/base.rb

Overview

Base class for any sms provider service. Provides basic structure and helper methods. While not necessary to be subclassed now, may be necessary later.

Direct Known Subclasses

Logger, NullSender

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Base

In initializer you may accept secrets which were defined in initializer or other configuration options if any.

Parameters:

  • params (Hash) (defaults to: {})

    List of arguments received from configure code.



11
# File 'lib/any_sms/backend/base.rb', line 11

def initialize(params = {}); end

Instance Method Details

#send_sms(_phone, _text, _args = {}) ⇒ Object

Interface for sending sms. Every subclass should implement method itself. Raises error in default implementation.

Parameters:

  • _phone (String)

    Phone number to send sms (not used in this implementation)

  • _text (String)

    Sms text (not used in this implementation)

Raises:

  • (NotImplementedError)


19
20
21
22
# File 'lib/any_sms/backend/base.rb', line 19

def send_sms(_phone, _text, _args = {})
  raise NotImplementedError,
        "You should create your own class for every sms service you use"
end