Class: Plivo::Interactive

Inherits:
Object
  • Object
show all
Defined in:
lib/plivo/interactive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, header: nil, body: nil, footer: nil, action: nil) ⇒ Interactive

Returns a new instance of Interactive.



7
8
9
10
11
12
13
# File 'lib/plivo/interactive.rb', line 7

def initialize(type: nil, header: nil, body: nil, footer: nil, action: nil)
  @type = type
  @header = header
  @body = body
  @footer = footer
  @action = action
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



5
6
7
# File 'lib/plivo/interactive.rb', line 5

def action
  @action
end

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/plivo/interactive.rb', line 5

def body
  @body
end

Returns the value of attribute footer.



5
6
7
# File 'lib/plivo/interactive.rb', line 5

def footer
  @footer
end

#headerObject

Returns the value of attribute header.



5
6
7
# File 'lib/plivo/interactive.rb', line 5

def header
  @header
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/plivo/interactive.rb', line 5

def type
  @type
end

Instance Method Details

#to_hashObject



15
16
17
18
19
20
21
22
23
# File 'lib/plivo/interactive.rb', line 15

def to_hash
  {
    type: @type,
    header: @header&.to_hash,
    body: @body&.to_hash,
    footer: @footer&.to_hash,
    action: @action&.to_hash
  }.reject { |_, v| v.nil? }
end