Class: AlexaRuby::SessionEndedRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/alexa_ruby/request/session_ended_request.rb

Overview

Class for Amazon “SessionEndedRequest” request type

Instance Attribute Summary collapse

Attributes inherited from Request

#json, #locale, #request_id, #session, #type, #version

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ SessionEndedRequest

Initialize new SessionEndedRequest

Parameters:

  • json (JSON)

    valid JSON request from Amazon



10
11
12
13
14
# File 'lib/alexa_ruby/request/session_ended_request.rb', line 10

def initialize(json)
  @type = :session_ended
  @reason = json[:request][:reason]
  super
end

Instance Attribute Details

#reasonObject

Returns the value of attribute reason.



5
6
7
# File 'lib/alexa_ruby/request/session_ended_request.rb', line 5

def reason
  @reason
end

Instance Method Details

#to_sString

Ouputs the request_id and the reason of session end

Returns:

  • (String)

    request_id and the reason of session end



19
20
21
# File 'lib/alexa_ruby/request/session_ended_request.rb', line 19

def to_s
  "Session Ended for requestID: #{request_id} with reason #{reason}"
end