twilio-ruby 5.61.2 → 5.64.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-deploy.yml +124 -0
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +84 -21
  5. data/CHANGES.md +99 -0
  6. data/Makefile +3 -6
  7. data/README.md +5 -4
  8. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +667 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -0
  11. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +19 -5
  12. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +435 -0
  13. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +20 -20
  14. data/lib/twilio-ruby/rest/conversations/v1.rb +17 -0
  15. data/lib/twilio-ruby/rest/conversations.rb +9 -0
  16. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -77
  17. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +33 -18
  18. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  19. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  20. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  21. data/lib/twilio-ruby/rest/insights/v1.rb +23 -0
  22. data/lib/twilio-ruby/rest/insights.rb +14 -0
  23. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +14 -1
  24. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +23 -0
  25. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +80 -0
  26. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +75 -18
  27. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  28. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +71 -30
  29. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  30. data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
  31. data/lib/twilio-ruby/rest/supersim.rb +9 -0
  32. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +130 -8
  33. data/lib/twilio-ruby/rest/verify/v2/service.rb +8 -2
  34. data/lib/twilio-ruby/rest/verify/v2/template.rb +1 -1
  35. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  36. data/lib/twilio-ruby/rest/verify.rb +2 -2
  37. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -0
  38. data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
  39. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  40. data/lib/twilio-ruby/rest/video/v1/room.rb +30 -5
  41. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  42. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  43. data/lib/twilio-ruby/rest/voice.rb +8 -0
  44. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +4 -4
  45. data/lib/twilio-ruby/version.rb +1 -1
  46. data/sonar-project.properties +1 -1
  47. data/twilio-ruby.gemspec +0 -1
  48. metadata +10 -18
  49. data/.github/workflows/deploy.yml +0 -65
  50. data/.github/workflows/test.yml +0 -52
@@ -152,57 +152,6 @@ module Twilio
152
152
  FaxPage.new(@version, response, @solution)
153
153
  end
154
154
 
155
- ##
156
- # Create the FaxInstance
157
- # @param [String] to The phone number to receive the fax in
158
- # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format or the
159
- # recipient's SIP URI.
160
- # @param [String] media_url The URL of the PDF that contains the fax. See our
161
- # {security}[https://www.twilio.com/docs/usage/security] page for information on
162
- # how to ensure the request for your media comes from Twilio.
163
- # @param [fax.Quality] quality The {Fax Quality
164
- # value}[https://www.twilio.com/docs/fax/api/fax-resource#fax-quality-values] that
165
- # describes the fax quality. Can be: `standard`, `fine`, or `superfine` and
166
- # defaults to `fine`.
167
- # @param [String] status_callback The URL we should call using the `POST` method
168
- # to send {status
169
- # information}[https://www.twilio.com/docs/fax/api/fax-resource#fax-status-callback]
170
- # to your application when the status of the fax changes.
171
- # @param [String] from The number the fax was sent from. Can be the phone number
172
- # in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format or the SIP
173
- # `from` value. The caller ID displayed to the recipient uses this value. If this
174
- # is a phone number, it must be a Twilio number or a verified outgoing caller id
175
- # from your account. If `to` is a SIP address, this can be any alphanumeric string
176
- # (and also the characters `+`, `_`, `.`, and `-`), which will be used in the
177
- # `from` header of the SIP request.
178
- # @param [String] sip_auth_username The username to use with the
179
- # `sip_auth_password` to authenticate faxes sent to a SIP address.
180
- # @param [String] sip_auth_password The password to use with `sip_auth_username`
181
- # to authenticate faxes sent to a SIP address.
182
- # @param [Boolean] store_media Whether to store a copy of the sent media on our
183
- # servers for later retrieval. Can be: `true` or `false` and the default is
184
- # `true`.
185
- # @param [String] ttl How long in minutes from when the fax is initiated that we
186
- # should try to send the fax.
187
- # @return [FaxInstance] Created FaxInstance
188
- def create(to: nil, media_url: nil, quality: :unset, status_callback: :unset, from: :unset, sip_auth_username: :unset, sip_auth_password: :unset, store_media: :unset, ttl: :unset)
189
- data = Twilio::Values.of({
190
- 'To' => to,
191
- 'MediaUrl' => media_url,
192
- 'Quality' => quality,
193
- 'StatusCallback' => status_callback,
194
- 'From' => from,
195
- 'SipAuthUsername' => sip_auth_username,
196
- 'SipAuthPassword' => sip_auth_password,
197
- 'StoreMedia' => store_media,
198
- 'Ttl' => ttl,
199
- })
200
-
201
- payload = @version.create('POST', @uri, data: data)
202
-
203
- FaxInstance.new(@version, payload, )
204
- end
205
-
206
155
  ##
207
156
  # Provide a user friendly representation
208
157
  def to_s
@@ -270,21 +219,6 @@ module Twilio
270
219
  FaxInstance.new(@version, payload, sid: @solution[:sid], )
271
220
  end
272
221
 
273
- ##
274
- # Update the FaxInstance
275
- # @param [fax.UpdateStatus] status The new
276
- # {status}[https://www.twilio.com/docs/fax/api/fax-resource#fax-status-values] of
277
- # the resource. Can be only `canceled`. This may fail if transmission has already
278
- # started.
279
- # @return [FaxInstance] Updated FaxInstance
280
- def update(status: :unset)
281
- data = Twilio::Values.of({'Status' => status, })
282
-
283
- payload = @version.update('POST', @uri, data: data)
284
-
285
- FaxInstance.new(@version, payload, sid: @solution[:sid], )
286
- end
287
-
288
222
  ##
289
223
  # Delete the FaxInstance
290
224
  # @return [Boolean] true if delete succeeds, false otherwise
@@ -491,17 +425,6 @@ module Twilio
491
425
  context.fetch
492
426
  end
493
427
 
494
- ##
495
- # Update the FaxInstance
496
- # @param [fax.UpdateStatus] status The new
497
- # {status}[https://www.twilio.com/docs/fax/api/fax-resource#fax-status-values] of
498
- # the resource. Can be only `canceled`. This may fail if transmission has already
499
- # started.
500
- # @return [FaxInstance] Updated FaxInstance
501
- def update(status: :unset)
502
- context.update(status: status, )
503
- end
504
-
505
428
  ##
506
429
  # Delete the FaxInstance
507
430
  # @return [Boolean] true if delete succeeds, false otherwise
@@ -115,8 +115,13 @@ module Twilio
115
115
  # @param [String] friendly_name A descriptive string that you create to describe
116
116
  # the Flex Flow resource.
117
117
  # @param [String] chat_service_sid The SID of the chat service.
118
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
119
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
118
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
119
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
120
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
121
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
122
+ # respective Task as appropriate (applying channel-specific design and length
123
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
124
+ # widget should set the Task Channel to Programmable Chat.
120
125
  # @param [String] contact_identity The channel contact's Identity.
121
126
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
122
127
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -151,10 +156,10 @@ module Twilio
151
156
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
152
157
  # will remove active Proxy sessions if the associated Task is deleted outside of
153
158
  # the Flex UI. Defaults to `false`.
154
- # @param [String] integration_retry_count The number of times to retry the webhook
155
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
156
- # default is 3. Optional when `integrationType` is `external`, not applicable
157
- # otherwise.
159
+ # @param [String] integration_retry_count The number of times to retry the Studio
160
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
161
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
162
+ # applicable otherwise.
158
163
  # @return [FlexFlowInstance] Created FlexFlowInstance
159
164
  def create(friendly_name: nil, chat_service_sid: nil, channel_type: nil, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
160
165
  data = Twilio::Values.of({
@@ -246,8 +251,13 @@ module Twilio
246
251
  # @param [String] friendly_name A descriptive string that you create to describe
247
252
  # the Flex Flow resource.
248
253
  # @param [String] chat_service_sid The SID of the chat service.
249
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
250
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
254
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
255
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
256
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
257
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
258
+ # respective Task as appropriate (applying channel-specific design and length
259
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
260
+ # widget should set the Task Channel to Programmable Chat.
251
261
  # @param [String] contact_identity The channel contact's Identity.
252
262
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
253
263
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -282,10 +292,10 @@ module Twilio
282
292
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
283
293
  # will remove active Proxy sessions if the associated Task is deleted outside of
284
294
  # the Flex UI. Defaults to `false`.
285
- # @param [String] integration_retry_count The number of times to retry the webhook
286
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
287
- # default is 3. Optional when `integrationType` is `external`, not applicable
288
- # otherwise.
295
+ # @param [String] integration_retry_count The number of times to retry the Studio
296
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
297
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
298
+ # applicable otherwise.
289
299
  # @return [FlexFlowInstance] Updated FlexFlowInstance
290
300
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
291
301
  data = Twilio::Values.of({
@@ -475,8 +485,13 @@ module Twilio
475
485
  # @param [String] friendly_name A descriptive string that you create to describe
476
486
  # the Flex Flow resource.
477
487
  # @param [String] chat_service_sid The SID of the chat service.
478
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
479
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
488
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
489
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
490
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
491
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
492
+ # respective Task as appropriate (applying channel-specific design and length
493
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
494
+ # widget should set the Task Channel to Programmable Chat.
480
495
  # @param [String] contact_identity The channel contact's Identity.
481
496
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
482
497
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -511,10 +526,10 @@ module Twilio
511
526
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
512
527
  # will remove active Proxy sessions if the associated Task is deleted outside of
513
528
  # the Flex UI. Defaults to `false`.
514
- # @param [String] integration_retry_count The number of times to retry the webhook
515
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
516
- # default is 3. Optional when `integrationType` is `external`, not applicable
517
- # otherwise.
529
+ # @param [String] integration_retry_count The number of times to retry the Studio
530
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
531
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
532
+ # applicable otherwise.
518
533
  # @return [FlexFlowInstance] Updated FlexFlowInstance
519
534
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
520
535
  context.update(
@@ -0,0 +1,474 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Insights < Domain
12
+ class V1 < Version
13
+ class ConferenceContext < InstanceContext
14
+ class ConferenceParticipantList < ListResource
15
+ ##
16
+ # Initialize the ConferenceParticipantList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] conference_sid The unique SID identifier of the Conference.
19
+ # @return [ConferenceParticipantList] ConferenceParticipantList
20
+ def initialize(version, conference_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {conference_sid: conference_sid}
25
+ @uri = "/Conferences/#{@solution[:conference_sid]}/Participants"
26
+ end
27
+
28
+ ##
29
+ # Lists ConferenceParticipantInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [String] participant_sid The unique SID identifier of the Participant.
33
+ # @param [String] label User-specified label for a participant.
34
+ # @param [String] events Conference events generated by application or participant
35
+ # activity; e.g. `hold`, `mute`, etc.
36
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
37
+ # guarantees to never return more than limit. Default is no limit
38
+ # @param [Integer] page_size Number of records to fetch per request, when
39
+ # not set will use the default value of 50 records. If no page_size is defined
40
+ # but a limit is defined, stream() will attempt to read the limit with the most
41
+ # efficient page size, i.e. min(limit, 1000)
42
+ # @return [Array] Array of up to limit results
43
+ def list(participant_sid: :unset, label: :unset, events: :unset, limit: nil, page_size: nil)
44
+ self.stream(
45
+ participant_sid: participant_sid,
46
+ label: label,
47
+ events: events,
48
+ limit: limit,
49
+ page_size: page_size
50
+ ).entries
51
+ end
52
+
53
+ ##
54
+ # Streams ConferenceParticipantInstance records from the API as an Enumerable.
55
+ # This operation lazily loads records as efficiently as possible until the limit
56
+ # is reached.
57
+ # @param [String] participant_sid The unique SID identifier of the Participant.
58
+ # @param [String] label User-specified label for a participant.
59
+ # @param [String] events Conference events generated by application or participant
60
+ # activity; e.g. `hold`, `mute`, etc.
61
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
62
+ # guarantees to never return more than limit. Default is no limit.
63
+ # @param [Integer] page_size Number of records to fetch per request, when
64
+ # not set will use the default value of 50 records. If no page_size is defined
65
+ # but a limit is defined, stream() will attempt to read the limit with the most
66
+ # efficient page size, i.e. min(limit, 1000)
67
+ # @return [Enumerable] Enumerable that will yield up to limit results
68
+ def stream(participant_sid: :unset, label: :unset, events: :unset, limit: nil, page_size: nil)
69
+ limits = @version.read_limits(limit, page_size)
70
+
71
+ page = self.page(
72
+ participant_sid: participant_sid,
73
+ label: label,
74
+ events: events,
75
+ page_size: limits[:page_size],
76
+ )
77
+
78
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
+ end
80
+
81
+ ##
82
+ # When passed a block, yields ConferenceParticipantInstance records from the API.
83
+ # This operation lazily loads records as efficiently as possible until the limit
84
+ # is reached.
85
+ def each
86
+ limits = @version.read_limits
87
+
88
+ page = self.page(page_size: limits[:page_size], )
89
+
90
+ @version.stream(page,
91
+ limit: limits[:limit],
92
+ page_limit: limits[:page_limit]).each {|x| yield x}
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of ConferenceParticipantInstance records from the API.
97
+ # Request is executed immediately.
98
+ # @param [String] participant_sid The unique SID identifier of the Participant.
99
+ # @param [String] label User-specified label for a participant.
100
+ # @param [String] events Conference events generated by application or participant
101
+ # activity; e.g. `hold`, `mute`, etc.
102
+ # @param [String] page_token PageToken provided by the API
103
+ # @param [Integer] page_number Page Number, this value is simply for client state
104
+ # @param [Integer] page_size Number of records to return, defaults to 50
105
+ # @return [Page] Page of ConferenceParticipantInstance
106
+ def page(participant_sid: :unset, label: :unset, events: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
107
+ params = Twilio::Values.of({
108
+ 'ParticipantSid' => participant_sid,
109
+ 'Label' => label,
110
+ 'Events' => events,
111
+ 'PageToken' => page_token,
112
+ 'Page' => page_number,
113
+ 'PageSize' => page_size,
114
+ })
115
+
116
+ response = @version.page('GET', @uri, params: params)
117
+
118
+ ConferenceParticipantPage.new(@version, response, @solution)
119
+ end
120
+
121
+ ##
122
+ # Retrieve a single page of ConferenceParticipantInstance records from the API.
123
+ # Request is executed immediately.
124
+ # @param [String] target_url API-generated URL for the requested results page
125
+ # @return [Page] Page of ConferenceParticipantInstance
126
+ def get_page(target_url)
127
+ response = @version.domain.request(
128
+ 'GET',
129
+ target_url
130
+ )
131
+ ConferenceParticipantPage.new(@version, response, @solution)
132
+ end
133
+
134
+ ##
135
+ # Provide a user friendly representation
136
+ def to_s
137
+ '#<Twilio.Insights.V1.ConferenceParticipantList>'
138
+ end
139
+ end
140
+
141
+ class ConferenceParticipantPage < Page
142
+ ##
143
+ # Initialize the ConferenceParticipantPage
144
+ # @param [Version] version Version that contains the resource
145
+ # @param [Response] response Response from the API
146
+ # @param [Hash] solution Path solution for the resource
147
+ # @return [ConferenceParticipantPage] ConferenceParticipantPage
148
+ def initialize(version, response, solution)
149
+ super(version, response)
150
+
151
+ # Path Solution
152
+ @solution = solution
153
+ end
154
+
155
+ ##
156
+ # Build an instance of ConferenceParticipantInstance
157
+ # @param [Hash] payload Payload response from the API
158
+ # @return [ConferenceParticipantInstance] ConferenceParticipantInstance
159
+ def get_instance(payload)
160
+ ConferenceParticipantInstance.new(@version, payload, conference_sid: @solution[:conference_sid], )
161
+ end
162
+
163
+ ##
164
+ # Provide a user friendly representation
165
+ def to_s
166
+ '<Twilio.Insights.V1.ConferenceParticipantPage>'
167
+ end
168
+ end
169
+
170
+ class ConferenceParticipantContext < InstanceContext
171
+ ##
172
+ # Initialize the ConferenceParticipantContext
173
+ # @param [Version] version Version that contains the resource
174
+ # @param [String] conference_sid The unique SID identifier of the Conference.
175
+ # @param [String] participant_sid The unique SID identifier of the Participant.
176
+ # @return [ConferenceParticipantContext] ConferenceParticipantContext
177
+ def initialize(version, conference_sid, participant_sid)
178
+ super(version)
179
+
180
+ # Path Solution
181
+ @solution = {conference_sid: conference_sid, participant_sid: participant_sid, }
182
+ @uri = "/Conferences/#{@solution[:conference_sid]}/Participants/#{@solution[:participant_sid]}"
183
+ end
184
+
185
+ ##
186
+ # Fetch the ConferenceParticipantInstance
187
+ # @param [String] events Conference events generated by application or participant
188
+ # activity; e.g. `hold`, `mute`, etc.
189
+ # @param [String] metrics Object. Contains participant call quality metrics.
190
+ # @return [ConferenceParticipantInstance] Fetched ConferenceParticipantInstance
191
+ def fetch(events: :unset, metrics: :unset)
192
+ params = Twilio::Values.of({'Events' => events, 'Metrics' => metrics, })
193
+
194
+ payload = @version.fetch('GET', @uri, params: params)
195
+
196
+ ConferenceParticipantInstance.new(
197
+ @version,
198
+ payload,
199
+ conference_sid: @solution[:conference_sid],
200
+ participant_sid: @solution[:participant_sid],
201
+ )
202
+ end
203
+
204
+ ##
205
+ # Provide a user friendly representation
206
+ def to_s
207
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
208
+ "#<Twilio.Insights.V1.ConferenceParticipantContext #{context}>"
209
+ end
210
+
211
+ ##
212
+ # Provide a detailed, user friendly representation
213
+ def inspect
214
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
215
+ "#<Twilio.Insights.V1.ConferenceParticipantContext #{context}>"
216
+ end
217
+ end
218
+
219
+ class ConferenceParticipantInstance < InstanceResource
220
+ ##
221
+ # Initialize the ConferenceParticipantInstance
222
+ # @param [Version] version Version that contains the resource
223
+ # @param [Hash] payload payload that contains response from Twilio
224
+ # @param [String] conference_sid The unique SID identifier of the Conference.
225
+ # @param [String] participant_sid The unique SID identifier of the Participant.
226
+ # @return [ConferenceParticipantInstance] ConferenceParticipantInstance
227
+ def initialize(version, payload, conference_sid: nil, participant_sid: nil)
228
+ super(version)
229
+
230
+ # Marshaled Properties
231
+ @properties = {
232
+ 'participant_sid' => payload['participant_sid'],
233
+ 'label' => payload['label'],
234
+ 'conference_sid' => payload['conference_sid'],
235
+ 'call_sid' => payload['call_sid'],
236
+ 'account_sid' => payload['account_sid'],
237
+ 'call_direction' => payload['call_direction'],
238
+ 'from' => payload['from'],
239
+ 'to' => payload['to'],
240
+ 'call_status' => payload['call_status'],
241
+ 'country_code' => payload['country_code'],
242
+ 'is_moderator' => payload['is_moderator'],
243
+ 'join_time' => Twilio.deserialize_iso8601_datetime(payload['join_time']),
244
+ 'leave_time' => Twilio.deserialize_iso8601_datetime(payload['leave_time']),
245
+ 'duration_seconds' => payload['duration_seconds'] == nil ? payload['duration_seconds'] : payload['duration_seconds'].to_i,
246
+ 'outbound_queue_length' => payload['outbound_queue_length'] == nil ? payload['outbound_queue_length'] : payload['outbound_queue_length'].to_i,
247
+ 'outbound_time_in_queue' => payload['outbound_time_in_queue'] == nil ? payload['outbound_time_in_queue'] : payload['outbound_time_in_queue'].to_i,
248
+ 'jitter_buffer_size' => payload['jitter_buffer_size'],
249
+ 'is_coach' => payload['is_coach'],
250
+ 'coached_participants' => payload['coached_participants'],
251
+ 'participant_region' => payload['participant_region'],
252
+ 'conference_region' => payload['conference_region'],
253
+ 'call_type' => payload['call_type'],
254
+ 'processing_state' => payload['processing_state'],
255
+ 'properties' => payload['properties'],
256
+ 'events' => payload['events'],
257
+ 'metrics' => payload['metrics'],
258
+ 'url' => payload['url'],
259
+ }
260
+
261
+ # Context
262
+ @instance_context = nil
263
+ @params = {
264
+ 'conference_sid' => conference_sid,
265
+ 'participant_sid' => participant_sid || @properties['participant_sid'],
266
+ }
267
+ end
268
+
269
+ ##
270
+ # Generate an instance context for the instance, the context is capable of
271
+ # performing various actions. All instance actions are proxied to the context
272
+ # @return [ConferenceParticipantContext] ConferenceParticipantContext for this ConferenceParticipantInstance
273
+ def context
274
+ unless @instance_context
275
+ @instance_context = ConferenceParticipantContext.new(
276
+ @version,
277
+ @params['conference_sid'],
278
+ @params['participant_sid'],
279
+ )
280
+ end
281
+ @instance_context
282
+ end
283
+
284
+ ##
285
+ # @return [String] SID for this participant.
286
+ def participant_sid
287
+ @properties['participant_sid']
288
+ end
289
+
290
+ ##
291
+ # @return [String] The user-specified label of this participant.
292
+ def label
293
+ @properties['label']
294
+ end
295
+
296
+ ##
297
+ # @return [String] Conference SID.
298
+ def conference_sid
299
+ @properties['conference_sid']
300
+ end
301
+
302
+ ##
303
+ # @return [String] Unique SID identifier of the call.
304
+ def call_sid
305
+ @properties['call_sid']
306
+ end
307
+
308
+ ##
309
+ # @return [String] Account SID.
310
+ def account_sid
311
+ @properties['account_sid']
312
+ end
313
+
314
+ ##
315
+ # @return [conference_participant.CallDirection] Call direction of the participant.
316
+ def call_direction
317
+ @properties['call_direction']
318
+ end
319
+
320
+ ##
321
+ # @return [String] Caller ID of the calling party.
322
+ def from
323
+ @properties['from']
324
+ end
325
+
326
+ ##
327
+ # @return [String] Called party.
328
+ def to
329
+ @properties['to']
330
+ end
331
+
332
+ ##
333
+ # @return [conference_participant.CallStatus] Call status of the call that generated the participant.
334
+ def call_status
335
+ @properties['call_status']
336
+ end
337
+
338
+ ##
339
+ # @return [String] ISO alpha-2 country code of the participant.
340
+ def country_code
341
+ @properties['country_code']
342
+ end
343
+
344
+ ##
345
+ # @return [Boolean] Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true.
346
+ def is_moderator
347
+ @properties['is_moderator']
348
+ end
349
+
350
+ ##
351
+ # @return [Time] ISO 8601 timestamp of participant join event.
352
+ def join_time
353
+ @properties['join_time']
354
+ end
355
+
356
+ ##
357
+ # @return [Time] ISO 8601 timestamp of participant leave event.
358
+ def leave_time
359
+ @properties['leave_time']
360
+ end
361
+
362
+ ##
363
+ # @return [String] Participant durations in seconds.
364
+ def duration_seconds
365
+ @properties['duration_seconds']
366
+ end
367
+
368
+ ##
369
+ # @return [String] Estimated time in queue at call creation.
370
+ def outbound_queue_length
371
+ @properties['outbound_queue_length']
372
+ end
373
+
374
+ ##
375
+ # @return [String] Actual time in queue (seconds).
376
+ def outbound_time_in_queue
377
+ @properties['outbound_time_in_queue']
378
+ end
379
+
380
+ ##
381
+ # @return [conference_participant.JitterBufferSize] The Jitter Buffer Size of this Conference Participant.
382
+ def jitter_buffer_size
383
+ @properties['jitter_buffer_size']
384
+ end
385
+
386
+ ##
387
+ # @return [Boolean] Boolean. Indicated whether participant was a coach.
388
+ def is_coach
389
+ @properties['is_coach']
390
+ end
391
+
392
+ ##
393
+ # @return [Array[String]] Call SIDs coached by this participant.
394
+ def coached_participants
395
+ @properties['coached_participants']
396
+ end
397
+
398
+ ##
399
+ # @return [conference_participant.Region] Twilio region where the participant media originates.
400
+ def participant_region
401
+ @properties['participant_region']
402
+ end
403
+
404
+ ##
405
+ # @return [conference_participant.Region] The Conference Region of this Conference Participant.
406
+ def conference_region
407
+ @properties['conference_region']
408
+ end
409
+
410
+ ##
411
+ # @return [conference_participant.CallType] The Call Type of this Conference Participant.
412
+ def call_type
413
+ @properties['call_type']
414
+ end
415
+
416
+ ##
417
+ # @return [conference_participant.ProcessingState] Processing state of the Participant Summary.
418
+ def processing_state
419
+ @properties['processing_state']
420
+ end
421
+
422
+ ##
423
+ # @return [Hash] Participant properties and metadata.
424
+ def properties
425
+ @properties['properties']
426
+ end
427
+
428
+ ##
429
+ # @return [Hash] Object containing information of actions taken by participants. Nested resource URLs.
430
+ def events
431
+ @properties['events']
432
+ end
433
+
434
+ ##
435
+ # @return [Hash] Object. Contains participant quality metrics.
436
+ def metrics
437
+ @properties['metrics']
438
+ end
439
+
440
+ ##
441
+ # @return [String] The URL of this resource.
442
+ def url
443
+ @properties['url']
444
+ end
445
+
446
+ ##
447
+ # Fetch the ConferenceParticipantInstance
448
+ # @param [String] events Conference events generated by application or participant
449
+ # activity; e.g. `hold`, `mute`, etc.
450
+ # @param [String] metrics Object. Contains participant call quality metrics.
451
+ # @return [ConferenceParticipantInstance] Fetched ConferenceParticipantInstance
452
+ def fetch(events: :unset, metrics: :unset)
453
+ context.fetch(events: events, metrics: metrics, )
454
+ end
455
+
456
+ ##
457
+ # Provide a user friendly representation
458
+ def to_s
459
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
460
+ "<Twilio.Insights.V1.ConferenceParticipantInstance #{values}>"
461
+ end
462
+
463
+ ##
464
+ # Provide a detailed, user friendly representation
465
+ def inspect
466
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
467
+ "<Twilio.Insights.V1.ConferenceParticipantInstance #{values}>"
468
+ end
469
+ end
470
+ end
471
+ end
472
+ end
473
+ end
474
+ end