Module: AnySMS

Defined in:
lib/any_sms.rb,
lib/any_sms/sending.rb,
lib/any_sms/version.rb,
lib/any_sms/configuration.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Backend Classes: Configuration, Response

Constant Summary collapse

VERSION =
"0.4.0".freeze

Class Method Summary collapse

Class Method Details

.configAnySMS::Configuration

Returns object with configuration options.

Returns:



4
5
6
# File 'lib/any_sms/configuration.rb', line 4

def self.config
  @@config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Allows to configure AnySMS options and register backends

Yields:



9
10
11
# File 'lib/any_sms/configuration.rb', line 9

def self.configure
  yield(config)
end

.reset!Object

resets AnySMS configuration to default



14
15
16
# File 'lib/any_sms/configuration.rb', line 14

def self.reset!
  @@config = nil
end

.send_sms(phone, text, args = {}) ⇒ Object

Core of the gem, method responsible for sending sms

Parameters:

  • phone (String)

    Phone number for sms

  • text (String)

    Text for sms

  • backend (Symbol)

    Keyword argument to specify non-default backend

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

    Additional options for delivery bypassed to final backend



10
11
12
13
14
# File 'lib/any_sms/sending.rb', line 10

def send_sms(phone, text, args = {})
  backend_name = args.delete(:backend)
  backend_class(backend_name).new(backend_params(backend_name))
                             .send_sms(phone, text, args)
end