Class: Aws::Lex::Conversation::Handler::Echo

Inherits:
Base
  • Object
show all
Defined in:
lib/aws/lex/conversation/handler/echo.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #successor

Instance Method Summary collapse

Methods inherited from Base

#handle, #initialize, #will_respond?

Constructor Details

This class inherits a constructor from Aws::Lex::Conversation::Handler::Base

Instance Method Details

#response(conversation) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/aws/lex/conversation/handler/echo.rb', line 8

def response(conversation)
  content = options.fetch(:content) { conversation.lex.input_transcript }
  content_type = options.fetch(:content_type) { Type::Message::ContentType.new('PlainText') }
  fulfillment_state = options.fetch(:fulfillment_state) { Type::FulfillmentState.new('Fulfilled') }
  conversation.close(
    fulfillment_state: fulfillment_state,
    messages: [
      Type::Message.new(
        content: content,
        content_type: content_type
      )
    ]
  )
end