Class: Ralyxa::ResponseBuilder

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_class, output_speech_class, options) ⇒ ResponseBuilder

Returns a new instance of ResponseBuilder.



7
8
9
10
11
# File 'lib/ralyxa/response_builder.rb', line 7

def initialize(response_class, output_speech_class, options)
  @response_class      = response_class
  @output_speech_class = output_speech_class
  @options             = options
end

Class Method Details

.build(options = {}, response_class = Ralyxa::Response, output_speech_class = Ralyxa::OutputSpeech) ⇒ Object



13
14
15
# File 'lib/ralyxa/response_builder.rb', line 13

def self.build(options = {}, response_class = Ralyxa::Response, output_speech_class = Ralyxa::OutputSpeech)
  new(response_class, output_speech_class, options).build
end

Instance Method Details

#buildObject



17
18
19
20
21
22
# File 'lib/ralyxa/response_builder.rb', line 17

def build
  merge_output_speech
  merge_card if card_exists?

  @response_class.as_hash(@options).to_json
end