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

#name

Instance Method Summary collapse

Methods inherited from TwiML

#add_child, #add_text, #append, #comment, to_lower_camel_case, #to_s, #xml

Constructor Details

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

Returns a new instance of MessagingResponse.

Yields:

  • (_self)

Yield Parameters:


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

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

  yield(self) if block_given?
end

Instance Method Details

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

Create a new <Message> element

body

Message Body

to

Phone Number to send Message to

from

Phone Number to send Message from

action

Action URL

method

Action URL Method

status_callback

Status callback URL. Deprecated in favor of action.

keyword_args

additional attributes

Yields:


30
31
32
33
34
35
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 30

def message(body: nil, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)
  message = Message.new(body: body, to: to, from: from, action: action, method: method, status_callback: status_callback, **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


42
43
44
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 42

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