class ActionAlexa::Configuration

Configuration class to support application code hooks within the ActionAlexa gem. Configurations below that do not have hooks should be set within the Rails initializers (app/config/initializers/*.rb). This class should be used as a singleton instance through the ActionAlexa module

Constants

MISSING_CURRENT_USER_HOOK_ERROR
MISSING_DEFAULT_INTENT_ERROR

Attributes

current_user_hook[W]
default_intent_response_class[W]
logger[W]
root[W]

Public Instance Methods

current_user_hook(&block) click to toggle source

Consumers can either pass a block into current_user_hook or explicitly

create a lambda/proc and assign it via the writer #current_user_hook=
# File lib/action_alexa/configuration.rb, line 17
def current_user_hook(&block)
  return @current_user_hook if current_user_hook?

  if block_given?
    @current_user_hook = block
    return
  end

  raise ActionAlexa::MissingConfiguration, MISSING_CURRENT_USER_HOOK_ERROR
end
current_user_hook?() click to toggle source
# File lib/action_alexa/configuration.rb, line 28
def current_user_hook?
  !@current_user_hook.nil?
end
default_intent_response_class() click to toggle source

rubocop:disable Style/IfUnlessModifier - rubocop is having issues with

the code below but its fairly succicient, so disabling the check here
# File lib/action_alexa/configuration.rb, line 42
def default_intent_response_class
  if @default_intent_response_class.nil?
    raise ActionAlexa::MissingConfiguration, MISSING_DEFAULT_INTENT_ERROR
  end

  @default_intent_response_class
end
logger() click to toggle source
# File lib/action_alexa/configuration.rb, line 36
def logger
  @logger ||= Rails.logger
end
root() click to toggle source
# File lib/action_alexa/configuration.rb, line 32
def root
  @root ||= Rails.root
end