Class: Twi::ParticipantEvent
- Defined in:
- lib/twi/participant_event.rb
Overview
An event signaling a participant added to a conversation.
Class Method Summary collapse
-
.params_for(id:, participant_id:, identity: nil, phone: nil) ⇒ Hash
The shape of the payload send by Twilio to the callback URL.
- .participant_params_for(identity, phone) ⇒ Object
Methods inherited from Event
#code, #content, #conversation_id, #id, #image_urls, #participant, #status, #target
Methods inherited from Resource
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.
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 |