Class: SmsAuth::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/sms_auth/engine.rb

Class Method Summary collapse

Class Method Details

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sms_auth/engine.rb', line 28

def self.setup
  yield self

  # Raise exception if required values are not set
  [:twilio_auth_token, :twilio_account_sid, :twilio_from_number].each do |field|
    if send(field).nil?
      raise Exception, "Missing `#{field}` in initialization"
    end
  end

  # Setup Twilio
  Twilio.configure do |config|
    config. = 
    config.auth_token = twilio_auth_token
  end
end