Class: Ralyxa::ResponseEntities::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ralyxa/response_entities/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_speech, reprompt, session_attributes, end_session, start_over, card, directives) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
13
14
15
16
# File 'lib/ralyxa/response_entities/response.rb', line 8

def initialize(output_speech, reprompt, session_attributes, end_session, start_over, card, directives)
  @output_speech      = output_speech
  @reprompt           = reprompt
  @session_attributes = session_attributes
  @end_session        = end_session
  @start_over         = start_over
  @card               = card
  @directives         = directives
end

Class Method Details

.as_hash(output_speech: false, reprompt: false, session_attributes: {}, end_session: false, start_over: false, card: false, directives: false) ⇒ Object



26
27
28
# File 'lib/ralyxa/response_entities/response.rb', line 26

def self.as_hash(output_speech: false, reprompt: false, session_attributes: {}, end_session: false, start_over: false, card: false, directives: false)
  new(output_speech, reprompt, session_attributes, end_session, start_over, card, directives).to_h
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
# File 'lib/ralyxa/response_entities/response.rb', line 18

def to_h
  {}.tap do |response|
    add_version(response)
    add_session_attributes(response)
    add_response(response)
  end
end