Class: Plivo::Action
- Inherits:
-
Object
- Object
- Plivo::Action
- Defined in:
- lib/plivo/interactive.rb
Instance Attribute Summary collapse
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
-
#initialize(buttons: nil, sections: nil) ⇒ Action
constructor
A new instance of Action.
- #to_hash ⇒ Object
Constructor Details
#initialize(buttons: nil, sections: nil) ⇒ Action
Returns a new instance of Action.
75 76 77 78 |
# File 'lib/plivo/interactive.rb', line 75 def initialize(buttons: nil, sections: nil) = ? .map { |b| Buttons.new(**b) } : [] @sections = sections ? sections.map { |s| Section.new(**s) } : [] end |
Instance Attribute Details
#buttons ⇒ Object
Returns the value of attribute buttons.
73 74 75 |
# File 'lib/plivo/interactive.rb', line 73 def end |
#sections ⇒ Object
Returns the value of attribute sections.
73 74 75 |
# File 'lib/plivo/interactive.rb', line 73 def sections @sections end |
Instance Method Details
#to_hash ⇒ Object
80 81 82 83 84 85 |
# File 'lib/plivo/interactive.rb', line 80 def to_hash { buttons: .map(&:to_hash), sections: @sections.map(&:to_hash), }.reject { |_, v| v.nil? } end |