Class: Twilio::Rails::Phone::Tree::Prompt

Inherits:
Object
  • Object
show all
Defined in:
lib/twilio/rails/phone/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, message:, gather:, after:) ⇒ Prompt

Returns a new instance of Prompt.



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/twilio/rails/phone/tree.rb', line 40

def initialize(name:, message:, gather:, after:)
  @name = name&.to_sym
  raise Twilio::Rails::Phone::InvalidTreeError, "prompt name cannot be blank" if @name.blank?

  @messages = if message.is_a?(Proc)
    message
  else
    Twilio::Rails::Phone::Tree::MessageSet.new(message)
  end

  @gather = Twilio::Rails::Phone::Tree::Gather.new(gather) if gather.present?
  @after = Twilio::Rails::Phone::Tree::After.new(after)
end

Instance Attribute Details

#afterObject (readonly)

Returns the value of attribute after.



38
39
40
# File 'lib/twilio/rails/phone/tree.rb', line 38

def after
  @after
end

#gatherObject (readonly)

Returns the value of attribute gather.



38
39
40
# File 'lib/twilio/rails/phone/tree.rb', line 38

def gather
  @gather
end

#messagesObject (readonly)

Returns the value of attribute messages.



38
39
40
# File 'lib/twilio/rails/phone/tree.rb', line 38

def messages
  @messages
end

#nameObject (readonly)

Returns the value of attribute name.



38
39
40
# File 'lib/twilio/rails/phone/tree.rb', line 38

def name
  @name
end