Class: Twilio::TwiML::Message

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

Overview

<Message> TwiML Verb

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(body: nil, **keyword_args) {|_self| ... } ⇒ Message

Returns a new instance of Message.

Yields:

  • (_self)

Yield Parameters:



61
62
63
64
65
66
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 61

def initialize(body: nil, **keyword_args)
  super(**keyword_args)
  @name = 'Message'
  @value = body unless body.nil?
  yield(self) if block_given?
end

Instance Method Details

#body(message, **keyword_args) ⇒ Object

Create a new <Body> element

message

Message Body

keyword_args

additional attributes



72
73
74
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 72

def body(message, **keyword_args)
  append(Body.new(message, **keyword_args))
end

#media(url, **keyword_args) ⇒ Object

Create a new <Media> element

url

Media URL

keyword_args

additional attributes



80
81
82
# File 'lib/twilio-ruby/twiml/messaging_response.rb', line 80

def media(url, **keyword_args)
  append(Media.new(url, **keyword_args))
end