Class: Twilio::REST::Conversations::V1::ConversationContext::ParticipantContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, conversation_sid, sid) ⇒ ParticipantContext

Initialize the ParticipantContext

Parameters:



188
189
190
191
192
193
194
195
196
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 188

def initialize(version, conversation_sid, sid)
    super(version)

    # Path Solution
    @solution = { conversation_sid: conversation_sid, sid: sid,  }
    @uri = "/Conversations/#{@solution[:conversation_sid]}/Participants/#{@solution[:sid]}"

    
end

Instance Method Details

#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean

Delete the ParticipantInstance

Parameters:

  • x_twilio_webhook_enabled (ConversationParticipantEnumWebhookEnabledType) (defaults to: :unset)

    The X-Twilio-Webhook-Enabled HTTP request header

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



201
202
203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 201

def delete(
    x_twilio_webhook_enabled: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 215

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ParticipantInstance.new(
        @version,
        payload,
        conversation_sid: @solution[:conversation_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



295
296
297
298
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 295

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
end

#to_sObject

Provide a user friendly representation



288
289
290
291
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 288

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
end

#update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

  • date_created (Time) (defaults to: :unset)

    The date that this resource was created.

  • date_updated (Time) (defaults to: :unset)

    The date that this resource was last updated.

  • attributes (String) (defaults to: :unset)

    An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set \"{}\" will be returned.

  • role_sid (String) (defaults to: :unset)

    The SID of a conversation-level [Role](www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.

  • messaging_binding_proxy_address (String) (defaults to: :unset)

    The address of the Twilio phone number that the participant is in contact with. ‘null’ value will remove it.

  • messaging_binding_projected_address (String) (defaults to: :unset)

    The address of the Twilio phone number that is used in Group MMS. ‘null’ value will remove it.

  • identity (String) (defaults to: :unset)

    A unique string identifier for the conversation participant as [Conversation User](www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.

  • last_read_message_index (String) (defaults to: :unset)

    Index of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.

  • last_read_timestamp (String) (defaults to: :unset)

    Timestamp of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.

  • x_twilio_webhook_enabled (ConversationParticipantEnumWebhookEnabledType) (defaults to: :unset)

    The X-Twilio-Webhook-Enabled HTTP request header

Returns:



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 245

def update(
    date_created: :unset, 
    date_updated: :unset, 
    attributes: :unset, 
    role_sid: :unset, 
    messaging_binding_proxy_address: :unset, 
    messaging_binding_projected_address: :unset, 
    identity: :unset, 
    last_read_message_index: :unset, 
    last_read_timestamp: :unset, 
    x_twilio_webhook_enabled: :unset
)

    data = Twilio::Values.of({
        'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
        'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
        'Attributes' => attributes,
        'RoleSid' => role_sid,
        'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address,
        'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
        'Identity' => identity,
        'LastReadMessageIndex' => last_read_message_index,
        'LastReadTimestamp' => last_read_timestamp,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ParticipantInstance.new(
        @version,
        payload,
        conversation_sid: @solution[:conversation_sid],
        sid: @solution[:sid],
    )
end