Class: Peach::App::Response
- Inherits:
-
Object
- Object
- Peach::App::Response
- Defined in:
- lib/peach/app/response.rb
Overview
:nodoc:
Constant Summary collapse
- SUPPORTED_ACTIONS =
%w[navigate send_prompt end].freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#context ⇒ Object
Returns the value of attribute context.
-
#data ⇒ Object
Returns the value of attribute data.
-
#screen ⇒ Object
Returns the value of attribute screen.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(**args) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(**args) ⇒ Response
Returns a new instance of Response.
11 12 13 14 15 |
# File 'lib/peach/app/response.rb', line 11 def initialize(**args) args = set_defaults_for args validate_arguments args instantiate_instance_variables_from args end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
9 10 11 |
# File 'lib/peach/app/response.rb', line 9 def action @action end |
#context ⇒ Object
Returns the value of attribute context.
9 10 11 |
# File 'lib/peach/app/response.rb', line 9 def context @context end |
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/peach/app/response.rb', line 9 def data @data end |
#screen ⇒ Object
Returns the value of attribute screen.
9 10 11 |
# File 'lib/peach/app/response.rb', line 9 def screen @screen end |
Instance Method Details
#body ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/peach/app/response.rb', line 17 def body body = { action: @action, screen: @screen, data: @data, context: @context } validate_arguments body body.delete(:screen) if @action == 'end' JSON.generate body end |