Class: Clova::Skill

Inherits:
Object
  • Object
show all
Defined in:
lib/clova-speech/skill.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Skill

Returns a new instance of Skill.



4
5
6
7
# File 'lib/clova-speech/skill.rb', line 4

def initialize(request)
  @request = request
  @response = response
end

Instance Attribute Details

#requestObject

Returns the value of attribute request.



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

def request
  @request
end

#response=(value) ⇒ Object

Sets the attribute response

Parameters:

  • value

    the value to set the attribute response to.



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

def response=(value)
  @response = value
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
# File 'lib/clova-speech/skill.rb', line 9

def call
  case request.type
  when 'LaunchRequest' then launch_request
  when 'IntentRequest' then intent_request
  when 'EventRequest' then event_request
  when 'SessionEndedRequest' then session_ended_request
  end
  @response.as_json.to_json
end