Module: Coolsms

Defined in:
lib/coolsms.rb,
lib/coolsms/base.rb,
lib/coolsms/group.rb,
lib/coolsms/errors.rb,
lib/coolsms/finder.rb,
lib/coolsms/message.rb,
lib/coolsms/version.rb,
lib/coolsms/rest_api.rb,
lib/coolsms/rest_api/send.rb,
lib/coolsms/rest_api/sent.rb,
lib/coolsms/rest_api/errors.rb,
lib/coolsms/rest_api/faraday_error_handler.rb

Defined Under Namespace

Classes: Base, Error, Finder, Group, Message, RestApi, Uninitialized

Constant Summary collapse

NUMBER_STRIP_REGEX =
/[^\d]/
TIMEZONE =
ActiveSupport::TimeZone.new('Seoul')
VERSION =
'0.2.0'
@@url =
'https://api.coolsms.co.kr'
@@logger =
Logger.new('log/sms.log')

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Coolsms)

    the object that the method was called on



34
35
36
# File 'lib/coolsms.rb', line 34

def configure
  yield(self)
end

.message(text, *to) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/coolsms.rb', line 38

def message(text, *to)
  options = to.extract_options!
  options[:text] = text
  options[:from] ||= default_from
  msg = Coolsms::Message.new(options)
  if block_given?
    yield(msg)
  else
    msg.send(*to)
  end
  msg
end

.number_strip(str) ⇒ Object



30
31
32
# File 'lib/coolsms.rb', line 30

def number_strip(str)
  str.gsub(NUMBER_STRIP_REGEX, '')
end