Class: AlexaRuby::IntentRequest

Inherits:
BaseRequest show all
Defined in:
lib/alexa_ruby/request/intent_request.rb

Overview

IntentRequest class implements Alexa “IntentRequest” request type

Instance Attribute Summary collapse

Attributes inherited from BaseRequest

#certificates_chain_url, #context, #id, #locale, #session, #signature, #timestamp, #type, #version

Instance Method Summary collapse

Methods inherited from BaseRequest

#json, #valid?

Constructor Details

#initialize(request) ⇒ IntentRequest

Initialize new Intent request


9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/alexa_ruby/request/intent_request.rb', line 9

def initialize(request)
  @type = :intent
  super
  if @req[:request][:intent].nil?
    raise ArgumentError, 'Intent must be defined'
  end
  @intent = @req[:request][:intent]
  @dialog_state = define_dialog_state
  @intent_name = @intent[:name]
  @confirmation_status = define_confirmation_status
  parse_slots unless @intent[:slots].nil?
end

Instance Attribute Details

#confirmation_statusObject (readonly)

Returns the value of attribute confirmation_status


4
5
6
# File 'lib/alexa_ruby/request/intent_request.rb', line 4

def confirmation_status
  @confirmation_status
end

#dialog_stateObject (readonly)

Returns the value of attribute dialog_state


4
5
6
# File 'lib/alexa_ruby/request/intent_request.rb', line 4

def dialog_state
  @dialog_state
end

#intent_nameObject (readonly)

Returns the value of attribute intent_name


4
5
6
# File 'lib/alexa_ruby/request/intent_request.rb', line 4

def intent_name
  @intent_name
end

#slotsObject (readonly)

Returns the value of attribute slots


4
5
6
# File 'lib/alexa_ruby/request/intent_request.rb', line 4

def slots
  @slots
end