Module: TwilioConfiguration

Extended by:
ActiveSupport::Concern
Defined in:
lib/app/models/concerns/twilio_configuration.rb

Overview

Twilio configuration, both fields and methods to determine configuration

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

The Twilio Configuration



11
12
13
14
15
16
17
# File 'lib/app/models/concerns/twilio_configuration.rb', line 11

def self.included(base)
  base.class_eval do
    field :twilio_account_id, type: String
    field :twilio_auth_token, type: String
    field :twilio_phone_number, type: String
  end
end

Instance Method Details

#secure_fieldsObject

Make sure the password doesn’t get blanked out on an update



22
23
24
# File 'lib/app/models/concerns/twilio_configuration.rb', line 22

def secure_fields
  super + %i[twilio_auth_token]
end

#twilio_configured?Boolean

Determine if twilio is configured at a system configuration

Examples

twilio_configured??
# => true || false

Returns:

  • (Boolean)


34
35
36
# File 'lib/app/models/concerns/twilio_configuration.rb', line 34

def twilio_configured?
  [.present?, twilio_auth_token.present?, twilio_phone_number.present?].all?
end