class Smser::Base

Attributes

smser_name[W]

Allows to set the name of current mailer.

Public Class Methods

controller_path()
Alias for: sms_path
default(value = nil) click to toggle source
# File lib/smser/base.rb, line 14
def default(value = nil)
  self.default_params = default_params.merge(value).freeze if value
  default_params
end
Also aliased as: default_options=
default_options=(value = nil)
Alias for: default
sms_path() click to toggle source
# File lib/smser/base.rb, line 20
def sms_path
  @sms_path ||= name.underscore
end
Also aliased as: controller_path

Public Instance Methods

sms(to:, body: nil, from: nil, callback: nil) click to toggle source
# File lib/smser/base.rb, line 39
def sms(to:, body: nil, from: nil, callback: nil)
  @_message ||= Message.new(
    to: to,
    from: from || default_params[:from],
    body: body || default_i18n_body,
    status_callback: callback || default_params[:status_callback]
  )
end

Private Instance Methods

default_i18n_body(interpolations = {}) click to toggle source
# File lib/smser/base.rb, line 55
def default_i18n_body(interpolations = {})
  mailer_scope = self.class.sms_path.tr('/', '.')
  I18n.t!(action_name, interpolations.merge(scope: [mailer_scope]))
end