Class: Clova::IntentRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/clova-speech/request/intent_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#context, #session, #version

Instance Method Summary collapse

Methods inherited from Request

#session_attributes

Constructor Details

#initialize(session:, context:, request:, version:) ⇒ IntentRequest

Returns a new instance of IntentRequest.



4
5
6
7
8
9
10
11
# File 'lib/clova-speech/request/intent_request.rb', line 4

def initialize(session:, context:, request:, version:)
  super
  @intent = request[:intent]
  @name = @intent[:name]
  @slots = @intent[:slots]

  @type = 'IntentRequest'
end

Instance Attribute Details

#intentObject

Returns the value of attribute intent.



3
4
5
# File 'lib/clova-speech/request/intent_request.rb', line 3

def intent
  @intent
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/clova-speech/request/intent_request.rb', line 3

def name
  @name
end

#slotsObject

Returns the value of attribute slots.



3
4
5
# File 'lib/clova-speech/request/intent_request.rb', line 3

def slots
  @slots
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/clova-speech/request/intent_request.rb', line 3

def type
  @type
end

Instance Method Details

#find_slot_value_by(slot_name) ⇒ Object



13
14
15
16
17
# File 'lib/clova-speech/request/intent_request.rb', line 13

def find_slot_value_by(slot_name)
  name = slot_name
  name = name.to_sym if name.is_a?(String)
  @slots[name][:value]
end