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.
26 27 28 29 30 31 |
# File 'lib/plivo/template.rb', line 26 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.
24 25 26 |
# File 'lib/plivo/template.rb', line 24 def index @index end |
#parameters ⇒ Object
Returns the value of attribute parameters.
24 25 26 |
# File 'lib/plivo/template.rb', line 24 def parameters @parameters end |
#sub_type ⇒ Object
Returns the value of attribute sub_type.
24 25 26 |
# File 'lib/plivo/template.rb', line 24 def sub_type @sub_type end |
#type ⇒ Object
Returns the value of attribute type.
24 25 26 |
# File 'lib/plivo/template.rb', line 24 def type @type end |
Instance Method Details
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/plivo/template.rb', line 33 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 |