Class: Twi::ParticipantEvent

Inherits:
Event show all
Defined in:
lib/twi/participant_event.rb

Overview

An event signaling a participant added to a conversation.

Class Method Summary collapse

Methods inherited from Event

#code, #content, #conversation_id, #id, #image_urls, #participant, #status, #target

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Twi::Resource

Class Method Details

.params_for(id:, participant_id:, identity: nil, phone: nil) ⇒ Hash

Returns the shape of the payload send by Twilio to the callback URL.

Returns:

  • (Hash)

    the shape of the payload send by Twilio to the callback URL.



6
7
8
9
10
11
# File 'lib/twi/participant_event.rb', line 6

def self.params_for(id:, participant_id:, identity: nil, phone: nil)
  {
    ConversationSid: id, EventType: 'onParticipantChanged',
    ParticipantSid: participant_id.to_s
  }.merge participant_params_for(identity, phone)
end

.participant_params_for(identity, phone) ⇒ Object



15
16
17
# File 'lib/twi/participant_event.rb', line 15

def self.participant_params_for(identity, phone)
  identity ? { Identity: identity } : { 'MessagingBinding.Address' => "+1#{phone}" }
end