Class: NluAdapter::Adapters::Lex::Intent

Inherits:
Object
  • Object
show all
Includes:
NluAdapterIntent
Defined in:
lib/nlu_adapter/lex.rb

Overview

Class represents Intent in an IntentCollection

Instance Attribute Summary

Attributes included from NluAdapterIntent

#name, #utterences

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Intent

Constructor



142
143
144
145
146
# File 'lib/nlu_adapter/lex.rb', line 142

def initialize(options = {})
	@name = options[:name]
	@version = options[:version]
	@checksum = options[:checksum]
end

Instance Method Details

#to_hHash

Convert self to Hash

Returns:

  • (Hash)

    ruby hash



151
152
153
154
155
156
157
158
159
160
# File 'lib/nlu_adapter/lex.rb', line 151

def to_h
	{
		name: @name,
		sample_utterances: @utterences,
		fulfillment_activity: {
			type: "ReturnIntent"
		},
		checksum: @checksum
	}
end

#to_jsonjson

convert self to Json

Returns:

  • (json)

    json



165
166
167
# File 'lib/nlu_adapter/lex.rb', line 165

def to_json
	to_h.to_json
end