Module: Msg91sms

Defined in:
lib/msg91sms.rb,
lib/msg91sms/otp.rb,
lib/msg91sms/version.rb,
lib/errors/configuration.rb,
lib/msg91sms/configuration.rb,
lib/msg91sms/transactional.rb

Defined Under Namespace

Modules: Errors Classes: Configuration, Otp, OtpSms, Transactional, TransactionalSms

Constant Summary collapse

VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Writing and reading the configuration



15
16
17
# File 'lib/msg91sms.rb', line 15

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Passing a block to our class When we call Msg91sms.configure, we pass it a block that actually creates a new instance of the Msg91sms::Configuration class using whatever we’ve set inside of the block.

Yields:



27
28
29
# File 'lib/msg91sms.rb', line 27

def self.configure
  yield(configuration)
end

.resetObject

Resetting This will reset the @configuration settings to nil if needed in future



21
22
23
# File 'lib/msg91sms.rb', line 21

def self.reset
  @configuration = Configuration.new
end

.verify_mobile?(mobile) ⇒ Boolean

Helper method checking mobile number contains only numbers

Returns:

  • (Boolean)


60
61
62
# File 'lib/msg91sms.rb', line 60

def self.verify_mobile?(mobile)
  mobile.scan(/\D/).empty?
end