class NluAdapter::Adapters::Lex::IntentCollection

Class represents a collection of Intents

Attributes

extra[RW]

Public Class Methods

new(options = {}) click to toggle source

Constructor

# File lib/nlu_adapter/lex.rb, line 176
def initialize(options = {})
        @name = options[:name]
        @checksum = options[:checksum]
        @intents = options[:intents]
end

Public Instance Methods

to_h() click to toggle source

Convert self to Hash @return [Hash] ruby hash

# File lib/nlu_adapter/lex.rb, line 185
def to_h
        intents = []
        @intents.each do |i|
                intents << {
                        intent_name: i.name,
                        intent_version: '$LATEST'
                }
        end

        {
                name: @name,
                intents: intents,
                locale: "en-US",
                child_directed: false,
                voice_id: "0",
                clarification_prompt: {
                        max_attempts: 1,
                        messages: [
                                {
                                        content: "I'm sorry, Can you please repeat that?",
                                        content_type: "PlainText"
                                },
                                {
                                        content: "Can you say that again?",
                                        content_type: "PlainText"
                                }
                        ]
                },
                abort_statement: {
                        messages: [
                                {
                                        content: "I don't understand. Can you try again?",
                                        content_type: "PlainText"
                                },
                                {
                                        content: "I'm sorry, I don't understand.",
                                        content_type: "PlainText"
                                }
                        ]
                },
                checksum: @checksum
        }
end
to_json() click to toggle source

Convert self to Json @return [Json] json

# File lib/nlu_adapter/lex.rb, line 232
def to_json
        to_h.to_json
end