Class: SignalWire::Contexts::GatherQuestion
- Inherits:
-
Object
- Object
- SignalWire::Contexts::GatherQuestion
- Defined in:
- lib/signalwire/contexts/context_builder.rb
Overview
Represents a single question in a gather_info configuration.
Instance Attribute Summary collapse
-
#confirm ⇒ Object
Returns the value of attribute confirm.
-
#functions ⇒ Object
Returns the value of attribute functions.
-
#key ⇒ Object
Returns the value of attribute key.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#question ⇒ Object
Returns the value of attribute question.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(key:, question:, type: 'string', confirm: false, prompt: nil, functions: nil) ⇒ GatherQuestion
constructor
A new instance of GatherQuestion.
- #to_h ⇒ Object
Constructor Details
#initialize(key:, question:, type: 'string', confirm: false, prompt: nil, functions: nil) ⇒ GatherQuestion
Returns a new instance of GatherQuestion.
31 32 33 34 35 36 37 38 |
# File 'lib/signalwire/contexts/context_builder.rb', line 31 def initialize(key:, question:, type: 'string', confirm: false, prompt: nil, functions: nil) @key = key @question = question @type = type @confirm = confirm @prompt = prompt @functions = functions end |
Instance Attribute Details
#confirm ⇒ Object
Returns the value of attribute confirm.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def confirm @confirm end |
#functions ⇒ Object
Returns the value of attribute functions.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def functions @functions end |
#key ⇒ Object
Returns the value of attribute key.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def key @key end |
#prompt ⇒ Object
Returns the value of attribute prompt.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def prompt @prompt end |
#question ⇒ Object
Returns the value of attribute question.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def question @question end |
#type ⇒ Object
Returns the value of attribute type.
29 30 31 |
# File 'lib/signalwire/contexts/context_builder.rb', line 29 def type @type end |
Instance Method Details
#to_h ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/signalwire/contexts/context_builder.rb', line 40 def to_h h = { "key" => @key, "question" => @question } h["type"] = @type if @type != 'string' h["confirm"] = true if @confirm h["prompt"] = @prompt if @prompt h["functions"] = @functions if @functions h end |