Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationWithParticipantsList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, chat_service_sid: nil) ⇒ ConversationWithParticipantsList

Initialize the ConversationWithParticipantsList

Parameters:

  • version (Version)

    Version that contains the resource



28
29
30
31
32
33
34
35
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb', line 28

def initialize(version, chat_service_sid: nil)
    super(version)
    
    # Path Solution
    @solution = { chat_service_sid: chat_service_sid }
    @uri = "/Services/#{@solution[:chat_service_sid]}/ConversationWithParticipants"
    
end

Instance Method Details

#create(friendly_name: :unset, unique_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, bindings_email_address: :unset, bindings_email_name: :unset, participant: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationWithParticipantsInstance

Create the ConversationWithParticipantsInstance

Parameters:

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

    The human-readable name of this conversation, limited to 256 characters. Optional.

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

    An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource’s sid in the URL.

  • 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.

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

    The unique ID of the [Messaging Service](www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.

  • 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.

  • state (State) (defaults to: :unset)
  • timers_inactive (String) (defaults to: :unset)

    ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

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

    ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

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

    The default email address that will be used when sending outbound emails in this conversation.

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

    The default name that will be used when sending outbound emails in this conversation.

  • participant (Array[String]) (defaults to: :unset)

    The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10.

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

    The X-Twilio-Webhook-Enabled HTTP request header

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb', line 52

def create(
    friendly_name: :unset, 
    unique_name: :unset, 
    date_created: :unset, 
    date_updated: :unset, 
    messaging_service_sid: :unset, 
    attributes: :unset, 
    state: :unset, 
    timers_inactive: :unset, 
    timers_closed: :unset, 
    bindings_email_address: :unset, 
    bindings_email_name: :unset, 
    participant: :unset, 
    x_twilio_webhook_enabled: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'UniqueName' => unique_name,
        'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
        'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
        'MessagingServiceSid' => messaging_service_sid,
        'Attributes' => attributes,
        'State' => state,
        'Timers.Inactive' => timers_inactive,
        'Timers.Closed' => timers_closed,
        'Bindings.Email.Address' => bindings_email_address,
        'Bindings.Email.Name' => bindings_email_name,
        'Participant' => Twilio.serialize_list(participant) { |e| e },
    })

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

#create_with_metadata(friendly_name: :unset, unique_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, bindings_email_address: :unset, bindings_email_name: :unset, participant: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationWithParticipantsInstance

Create the ConversationWithParticipantsInstanceMetadata

Parameters:

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

    The human-readable name of this conversation, limited to 256 characters. Optional.

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

    An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource’s sid in the URL.

  • 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.

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

    The unique ID of the [Messaging Service](www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.

  • 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.

  • state (State) (defaults to: :unset)
  • timers_inactive (String) (defaults to: :unset)

    ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

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

    ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

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

    The default email address that will be used when sending outbound emails in this conversation.

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

    The default name that will be used when sending outbound emails in this conversation.

  • participant (Array[String]) (defaults to: :unset)

    The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10.

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

    The X-Twilio-Webhook-Enabled HTTP request header

Returns:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb', line 113

def (
  friendly_name: :unset, 
  unique_name: :unset, 
  date_created: :unset, 
  date_updated: :unset, 
  messaging_service_sid: :unset, 
  attributes: :unset, 
  state: :unset, 
  timers_inactive: :unset, 
  timers_closed: :unset, 
  bindings_email_address: :unset, 
  bindings_email_name: :unset, 
  participant: :unset, 
  x_twilio_webhook_enabled: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'UniqueName' => unique_name,
        'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
        'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
        'MessagingServiceSid' => messaging_service_sid,
        'Attributes' => attributes,
        'State' => state,
        'Timers.Inactive' => timers_inactive,
        'Timers.Closed' => timers_closed,
        'Bindings.Email.Address' => bindings_email_address,
        'Bindings.Email.Name' => bindings_email_name,
        'Participant' => Twilio.serialize_list(participant) { |e| e },
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    conversation_with_participants_instance = ConversationWithParticipantsInstance.new(
        @version,
        response.body,
        chat_service_sid: @solution[:chat_service_sid],
    )
    ConversationWithParticipantsInstanceMetadata.new(
        @version,
        conversation_with_participants_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



168
169
170
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb', line 168

def to_s
    '#<Twilio.Conversations.V1.ConversationWithParticipantsList>'
end