Class: Twilio::TwiML::MessagingResponse

Inherits:
TwiML
  • Object
show all
Defined in:
lib/twilio-ruby/twiml/messaging_response.rb

Overview

<Response> TwiML for Messages

Instance Attribute Summary

Attributes inherited from TwiML

#indent, #name

Instance Method Summary collapse

Methods inherited from TwiML

#append, to_lower_camel_case, #to_s, #xml

Constructor Details

#initialize(**keyword_args) {|_self| ... } ⇒ MessagingResponse

Returns a new instance of MessagingResponse.

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
16
17
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 12

def initialize(**keyword_args)
  super(**keyword_args)
  @name = 'Response'

  yield(self) if block_given?
end

Instance Method Details

#message(message: nil, to: nil, from: nil, action: nil, method: nil, **keyword_args) {|message| ... } ⇒ Object

Create a new <Message> element

message

Message Body

to

Phone Number to send Message to

from

Phone Number to send Message from

action

Action URL

method

Action URL Method

keyword_args

additional attributes

Yields:



27
28
29
30
31
32
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 27

def message(message: nil, to: nil, from: nil, action: nil, method: nil, **keyword_args)
  message = Message.new(message: message, to: to, from: from, action: action, method: method, **keyword_args)

  yield(message) if block_given?
  append(message)
end

#redirect(url, method: nil, **keyword_args) ⇒ Object

Create a new <Redirect> element

url

Redirect URL

method

Redirect URL method

keyword_args

additional attributes



39
40
41
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 39

def redirect(url, method: nil, **keyword_args)
  append(Redirect.new(url, method: method, **keyword_args))
end