Class: Twilio::REST::Messaging::V1::SessionContext::MessageContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Messaging::V1::SessionContext::MessageContext
- Defined in:
- lib/twilio-ruby/rest/messaging/v1/session/message.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the MessageInstance.
-
#fetch ⇒ MessageInstance
Fetch a MessageInstance.
-
#initialize(version, session_sid, sid) ⇒ MessageContext
constructor
Initialize the MessageContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(author: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, body: :unset) ⇒ MessageInstance
Update the MessageInstance.
Constructor Details
#initialize(version, session_sid, sid) ⇒ MessageContext
Initialize the MessageContext
193 194 195 196 197 198 199 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 193 def initialize(version, session_sid, sid) super(version) # Path Solution @solution = {session_sid: session_sid, sid: sid, } @uri = "/Sessions/#{@solution[:session_sid]}/Messages/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Deletes the MessageInstance
249 250 251 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 249 def delete @version.delete('delete', @uri) end |
#fetch ⇒ MessageInstance
Fetch a MessageInstance
204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 204 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) MessageInstance.new(@version, payload, session_sid: @solution[:session_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
262 263 264 265 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 262 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.MessageContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
255 256 257 258 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 255 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.MessageContext #{context}>" end |
#update(author: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, body: :unset) ⇒ MessageInstance
Update the MessageInstance
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/twilio-ruby/rest/messaging/v1/session/message.rb', line 228 def update(author: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, body: :unset) data = Twilio::Values.of({ 'Author' => , 'Attributes' => attributes, 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created), 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated), 'Body' => body, }) payload = @version.update( 'POST', @uri, data: data, ) MessageInstance.new(@version, payload, session_sid: @solution[:session_sid], sid: @solution[:sid], ) end |