Class: Plivo::Component
- Inherits:
-
Object
- Object
- Plivo::Component
- Defined in:
- lib/plivo/template.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#sub_type ⇒ Object
Returns the value of attribute sub_type.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type: nil, sub_type: nil, index: nil, parameters: nil) ⇒ Component
constructor
A new instance of Component.
- #to_hash ⇒ Object
Constructor Details
#initialize(type: nil, sub_type: nil, index: nil, parameters: nil) ⇒ Component
Returns a new instance of Component.
27 28 29 30 31 32 |
# File 'lib/plivo/template.rb', line 27 def initialize(type: nil, sub_type: nil, index: nil, parameters: nil) @type = type @sub_type = sub_type @index = index @parameters = parameters end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
25 26 27 |
# File 'lib/plivo/template.rb', line 25 def index @index end |
#parameters ⇒ Object
Returns the value of attribute parameters.
25 26 27 |
# File 'lib/plivo/template.rb', line 25 def parameters @parameters end |
#sub_type ⇒ Object
Returns the value of attribute sub_type.
25 26 27 |
# File 'lib/plivo/template.rb', line 25 def sub_type @sub_type end |
#type ⇒ Object
Returns the value of attribute type.
25 26 27 |
# File 'lib/plivo/template.rb', line 25 def type @type end |
Instance Method Details
#to_hash ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/plivo/template.rb', line 34 def to_hash { type: @type, sub_type: @sub_type, index: @index, parameters: @parameters&.map(&:to_hash)&.reject { |h| h.values.all?(&:nil?) } }.reject { |_, v| v.nil? } end |