twilio-ruby 5.55.0 → 5.58.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop_todo.yml +7 -7
  4. data/.travis.yml +23 -6
  5. data/CHANGES.md +73 -0
  6. data/Gemfile +1 -0
  7. data/README.md +10 -2
  8. data/examples/examples.rb +1 -1
  9. data/lib/twilio-ruby.rb +5 -15
  10. data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  11. data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  12. data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  13. data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  14. data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  15. data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  16. data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
  17. data/lib/twilio-ruby/http.rb +5 -0
  18. data/lib/twilio-ruby/http/http_client.rb +11 -1
  19. data/lib/twilio-ruby/rest.rb +13 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +12 -3
  21. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  23. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
  24. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  25. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  26. data/lib/twilio-ruby/rest/conversations.rb +6 -0
  27. data/lib/twilio-ruby/rest/conversations/v1.rb +7 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  29. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  30. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  31. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  32. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  35. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  36. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  37. data/lib/twilio-ruby/rest/insights.rb +6 -0
  38. data/lib/twilio-ruby/rest/insights/v1.rb +7 -0
  39. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +428 -0
  40. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +19 -1
  41. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +29 -0
  42. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  43. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  44. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -1
  45. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  46. data/lib/twilio-ruby/version.rb +1 -1
  47. data/sonar-project.properties +13 -0
  48. metadata +18 -9
@@ -282,7 +282,7 @@ module Twilio
282
282
  'start_time' => Twilio.deserialize_rfc2822(payload['start_time']),
283
283
  'duration' => payload['duration'],
284
284
  'sid' => payload['sid'],
285
- 'price' => payload['price'].to_f,
285
+ 'price' => payload['price'],
286
286
  'price_unit' => payload['price_unit'],
287
287
  'status' => payload['status'],
288
288
  'channels' => payload['channels'].to_i,
@@ -330,7 +330,7 @@ module Twilio
330
330
  # @param [String] body The text of the message you want to send. Can be up to
331
331
  # 1,600 characters long.
332
332
  # @return [MessageInstance] Updated MessageInstance
333
- def update(body: nil)
333
+ def update(body: :unset)
334
334
  data = Twilio::Values.of({'Body' => body, })
335
335
 
336
336
  payload = @version.update('POST', @uri, data: data)
@@ -580,7 +580,7 @@ module Twilio
580
580
  # @param [String] body The text of the message you want to send. Can be up to
581
581
  # 1,600 characters long.
582
582
  # @return [MessageInstance] Updated MessageInstance
583
- def update(body: nil)
583
+ def update(body: :unset)
584
584
  context.update(body: body, )
585
585
  end
586
586
 
@@ -19,8 +19,8 @@ module Twilio
19
19
  # @param [Version] version Version that contains the resource
20
20
  # @param [String] account_sid The unique id of the Account that is responsible for
21
21
  # this resource.
22
- # @param [String] domain_sid The unique string that that we created to identify
23
- # the SipDomain resource.
22
+ # @param [String] domain_sid The unique string that is created to identify the
23
+ # SipDomain resource.
24
24
  # @return [CredentialListMappingList] CredentialListMappingList
25
25
  def initialize(version, account_sid: nil, domain_sid: nil)
26
26
  super(version)
@@ -233,8 +233,8 @@ module Twilio
233
233
  # @param [Hash] payload payload that contains response from Twilio
234
234
  # @param [String] account_sid The unique id of the Account that is responsible for
235
235
  # this resource.
236
- # @param [String] domain_sid The unique string that that we created to identify
237
- # the SipDomain resource.
236
+ # @param [String] domain_sid The unique string that is created to identify the
237
+ # SipDomain resource.
238
238
  # @param [String] sid A 34 character string that uniquely identifies the resource
239
239
  # to fetch.
240
240
  # @return [CredentialListMappingInstance] CredentialListMappingInstance
@@ -246,10 +246,10 @@ module Twilio
246
246
  'account_sid' => payload['account_sid'],
247
247
  'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
248
248
  'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
249
+ 'domain_sid' => payload['domain_sid'],
249
250
  'friendly_name' => payload['friendly_name'],
250
251
  'sid' => payload['sid'],
251
252
  'uri' => payload['uri'],
252
- 'subresource_uris' => payload['subresource_uris'],
253
253
  }
254
254
 
255
255
  # Context
@@ -295,6 +295,12 @@ module Twilio
295
295
  @properties['date_updated']
296
296
  end
297
297
 
298
+ ##
299
+ # @return [String] The unique string that identifies the SipDomain resource.
300
+ def domain_sid
301
+ @properties['domain_sid']
302
+ end
303
+
298
304
  ##
299
305
  # @return [String] A human readable descriptive text for this resource, up to 64 characters long.
300
306
  def friendly_name
@@ -313,12 +319,6 @@ module Twilio
313
319
  @properties['uri']
314
320
  end
315
321
 
316
- ##
317
- # @return [String] The credentials associated with this resource.
318
- def subresource_uris
319
- @properties['subresource_uris']
320
- end
321
-
322
322
  ##
323
323
  # Fetch the CredentialListMappingInstance
324
324
  # @return [CredentialListMappingInstance] Fetched CredentialListMappingInstance
@@ -19,8 +19,8 @@ module Twilio
19
19
  # @param [Version] version Version that contains the resource
20
20
  # @param [String] account_sid The unique id of the Account that is responsible for
21
21
  # this resource.
22
- # @param [String] domain_sid The unique string that that we created to identify
23
- # the SipDomain resource.
22
+ # @param [String] domain_sid The unique string that is created to identify the
23
+ # SipDomain resource.
24
24
  # @return [IpAccessControlListMappingList] IpAccessControlListMappingList
25
25
  def initialize(version, account_sid: nil, domain_sid: nil)
26
26
  super(version)
@@ -232,8 +232,8 @@ module Twilio
232
232
  # @param [Hash] payload payload that contains response from Twilio
233
233
  # @param [String] account_sid The unique id of the Account that is responsible for
234
234
  # this resource.
235
- # @param [String] domain_sid The unique string that that we created to identify
236
- # the SipDomain resource.
235
+ # @param [String] domain_sid The unique string that is created to identify the
236
+ # SipDomain resource.
237
237
  # @param [String] sid A 34 character string that uniquely identifies the resource
238
238
  # to fetch.
239
239
  # @return [IpAccessControlListMappingInstance] IpAccessControlListMappingInstance
@@ -245,10 +245,10 @@ module Twilio
245
245
  'account_sid' => payload['account_sid'],
246
246
  'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
247
247
  'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
248
+ 'domain_sid' => payload['domain_sid'],
248
249
  'friendly_name' => payload['friendly_name'],
249
250
  'sid' => payload['sid'],
250
251
  'uri' => payload['uri'],
251
- 'subresource_uris' => payload['subresource_uris'],
252
252
  }
253
253
 
254
254
  # Context
@@ -294,6 +294,12 @@ module Twilio
294
294
  @properties['date_updated']
295
295
  end
296
296
 
297
+ ##
298
+ # @return [String] The unique string that identifies the SipDomain resource.
299
+ def domain_sid
300
+ @properties['domain_sid']
301
+ end
302
+
297
303
  ##
298
304
  # @return [String] A human readable descriptive text for this resource, up to 64 characters long.
299
305
  def friendly_name
@@ -312,12 +318,6 @@ module Twilio
312
318
  @properties['uri']
313
319
  end
314
320
 
315
- ##
316
- # @return [String] The list of IP addresses associated with this domain.
317
- def subresource_uris
318
- @properties['subresource_uris']
319
- end
320
-
321
321
  ##
322
322
  # Fetch the IpAccessControlListMappingInstance
323
323
  # @return [IpAccessControlListMappingInstance] Fetched IpAccessControlListMappingInstance
@@ -52,6 +52,12 @@ module Twilio
52
52
  self.v1.credentials(sid)
53
53
  end
54
54
 
55
+ ##
56
+ # @return [Twilio::REST::Conversations::V1::ParticipantConversationInstance]
57
+ def participant_conversations
58
+ self.v1.participant_conversations()
59
+ end
60
+
55
61
  ##
56
62
  # @param [String] sid The unique string that we created to identify the Role
57
63
  # resource.
@@ -18,6 +18,7 @@ module Twilio
18
18
  @configuration = nil
19
19
  @conversations = nil
20
20
  @credentials = nil
21
+ @participant_conversations = nil
21
22
  @roles = nil
22
23
  @services = nil
23
24
  @users = nil
@@ -61,6 +62,12 @@ module Twilio
61
62
  end
62
63
  end
63
64
 
65
+ ##
66
+ # @return [Twilio::REST::Conversations::V1::ParticipantConversationContext]
67
+ def participant_conversations
68
+ @participant_conversations ||= ParticipantConversationList.new self
69
+ end
70
+
64
71
  ##
65
72
  # @param [String] sid The SID of the Role resource to fetch.
66
73
  # @return [Twilio::REST::Conversations::V1::RoleContext] if sid was passed.
@@ -362,6 +362,7 @@ module Twilio
362
362
  'timers' => payload['timers'],
363
363
  'url' => payload['url'],
364
364
  'links' => payload['links'],
365
+ 'bindings' => payload['bindings'],
365
366
  }
366
367
 
367
368
  # Context
@@ -458,6 +459,12 @@ module Twilio
458
459
  @properties['links']
459
460
  end
460
461
 
462
+ ##
463
+ # @return [Hash] The bindings
464
+ def bindings
465
+ @properties['bindings']
466
+ end
467
+
461
468
  ##
462
469
  # Update the ConversationInstance
463
470
  # @param [String] friendly_name The human-readable name of this conversation,
@@ -0,0 +1,312 @@
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 Conversations < Domain
12
+ class V1 < Version
13
+ class ParticipantConversationList < ListResource
14
+ ##
15
+ # Initialize the ParticipantConversationList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [ParticipantConversationList] ParticipantConversationList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/ParticipantConversations"
24
+ end
25
+
26
+ ##
27
+ # Lists ParticipantConversationInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [String] identity A unique string identifier for the conversation
31
+ # participant as {Conversation
32
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
33
+ # parameter is non-null if (and only if) the participant is using the
34
+ # Conversations SDK to communicate. Limited to 256 characters.
35
+ # @param [String] address A unique string identifier for the conversation
36
+ # participant who's not a Conversation User. This parameter could be found in
37
+ # messaging_binding.address field of Participant resource. It should be
38
+ # url-encoded.
39
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
40
+ # guarantees to never return more than limit. Default is no limit
41
+ # @param [Integer] page_size Number of records to fetch per request, when
42
+ # not set will use the default value of 50 records. If no page_size is defined
43
+ # but a limit is defined, stream() will attempt to read the limit with the most
44
+ # efficient page size, i.e. min(limit, 1000)
45
+ # @return [Array] Array of up to limit results
46
+ def list(identity: :unset, address: :unset, limit: nil, page_size: nil)
47
+ self.stream(identity: identity, address: address, limit: limit, page_size: page_size).entries
48
+ end
49
+
50
+ ##
51
+ # Streams ParticipantConversationInstance records from the API as an Enumerable.
52
+ # This operation lazily loads records as efficiently as possible until the limit
53
+ # is reached.
54
+ # @param [String] identity A unique string identifier for the conversation
55
+ # participant as {Conversation
56
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
57
+ # parameter is non-null if (and only if) the participant is using the
58
+ # Conversations SDK to communicate. Limited to 256 characters.
59
+ # @param [String] address A unique string identifier for the conversation
60
+ # participant who's not a Conversation User. This parameter could be found in
61
+ # messaging_binding.address field of Participant resource. It should be
62
+ # url-encoded.
63
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
64
+ # guarantees to never return more than limit. Default is no limit.
65
+ # @param [Integer] page_size Number of records to fetch per request, when
66
+ # not set will use the default value of 50 records. If no page_size is defined
67
+ # but a limit is defined, stream() will attempt to read the limit with the most
68
+ # efficient page size, i.e. min(limit, 1000)
69
+ # @return [Enumerable] Enumerable that will yield up to limit results
70
+ def stream(identity: :unset, address: :unset, limit: nil, page_size: nil)
71
+ limits = @version.read_limits(limit, page_size)
72
+
73
+ page = self.page(identity: identity, address: address, page_size: limits[:page_size], )
74
+
75
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
76
+ end
77
+
78
+ ##
79
+ # When passed a block, yields ParticipantConversationInstance records from the API.
80
+ # This operation lazily loads records as efficiently as possible until the limit
81
+ # is reached.
82
+ def each
83
+ limits = @version.read_limits
84
+
85
+ page = self.page(page_size: limits[:page_size], )
86
+
87
+ @version.stream(page,
88
+ limit: limits[:limit],
89
+ page_limit: limits[:page_limit]).each {|x| yield x}
90
+ end
91
+
92
+ ##
93
+ # Retrieve a single page of ParticipantConversationInstance records from the API.
94
+ # Request is executed immediately.
95
+ # @param [String] identity A unique string identifier for the conversation
96
+ # participant as {Conversation
97
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
98
+ # parameter is non-null if (and only if) the participant is using the
99
+ # Conversations SDK to communicate. Limited to 256 characters.
100
+ # @param [String] address A unique string identifier for the conversation
101
+ # participant who's not a Conversation User. This parameter could be found in
102
+ # messaging_binding.address field of Participant resource. It should be
103
+ # url-encoded.
104
+ # @param [String] page_token PageToken provided by the API
105
+ # @param [Integer] page_number Page Number, this value is simply for client state
106
+ # @param [Integer] page_size Number of records to return, defaults to 50
107
+ # @return [Page] Page of ParticipantConversationInstance
108
+ def page(identity: :unset, address: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
109
+ params = Twilio::Values.of({
110
+ 'Identity' => identity,
111
+ 'Address' => address,
112
+ 'PageToken' => page_token,
113
+ 'Page' => page_number,
114
+ 'PageSize' => page_size,
115
+ })
116
+
117
+ response = @version.page('GET', @uri, params: params)
118
+
119
+ ParticipantConversationPage.new(@version, response, @solution)
120
+ end
121
+
122
+ ##
123
+ # Retrieve a single page of ParticipantConversationInstance records from the API.
124
+ # Request is executed immediately.
125
+ # @param [String] target_url API-generated URL for the requested results page
126
+ # @return [Page] Page of ParticipantConversationInstance
127
+ def get_page(target_url)
128
+ response = @version.domain.request(
129
+ 'GET',
130
+ target_url
131
+ )
132
+ ParticipantConversationPage.new(@version, response, @solution)
133
+ end
134
+
135
+ ##
136
+ # Provide a user friendly representation
137
+ def to_s
138
+ '#<Twilio.Conversations.V1.ParticipantConversationList>'
139
+ end
140
+ end
141
+
142
+ class ParticipantConversationPage < Page
143
+ ##
144
+ # Initialize the ParticipantConversationPage
145
+ # @param [Version] version Version that contains the resource
146
+ # @param [Response] response Response from the API
147
+ # @param [Hash] solution Path solution for the resource
148
+ # @return [ParticipantConversationPage] ParticipantConversationPage
149
+ def initialize(version, response, solution)
150
+ super(version, response)
151
+
152
+ # Path Solution
153
+ @solution = solution
154
+ end
155
+
156
+ ##
157
+ # Build an instance of ParticipantConversationInstance
158
+ # @param [Hash] payload Payload response from the API
159
+ # @return [ParticipantConversationInstance] ParticipantConversationInstance
160
+ def get_instance(payload)
161
+ ParticipantConversationInstance.new(@version, payload, )
162
+ end
163
+
164
+ ##
165
+ # Provide a user friendly representation
166
+ def to_s
167
+ '<Twilio.Conversations.V1.ParticipantConversationPage>'
168
+ end
169
+ end
170
+
171
+ class ParticipantConversationInstance < InstanceResource
172
+ ##
173
+ # Initialize the ParticipantConversationInstance
174
+ # @param [Version] version Version that contains the resource
175
+ # @param [Hash] payload payload that contains response from Twilio
176
+ # @return [ParticipantConversationInstance] ParticipantConversationInstance
177
+ def initialize(version, payload)
178
+ super(version)
179
+
180
+ # Marshaled Properties
181
+ @properties = {
182
+ 'account_sid' => payload['account_sid'],
183
+ 'chat_service_sid' => payload['chat_service_sid'],
184
+ 'participant_sid' => payload['participant_sid'],
185
+ 'participant_user_sid' => payload['participant_user_sid'],
186
+ 'participant_identity' => payload['participant_identity'],
187
+ 'participant_messaging_binding' => payload['participant_messaging_binding'],
188
+ 'conversation_sid' => payload['conversation_sid'],
189
+ 'conversation_unique_name' => payload['conversation_unique_name'],
190
+ 'conversation_friendly_name' => payload['conversation_friendly_name'],
191
+ 'conversation_attributes' => payload['conversation_attributes'],
192
+ 'conversation_date_created' => Twilio.deserialize_iso8601_datetime(payload['conversation_date_created']),
193
+ 'conversation_date_updated' => Twilio.deserialize_iso8601_datetime(payload['conversation_date_updated']),
194
+ 'conversation_created_by' => payload['conversation_created_by'],
195
+ 'conversation_state' => payload['conversation_state'],
196
+ 'conversation_timers' => payload['conversation_timers'],
197
+ 'links' => payload['links'],
198
+ }
199
+ end
200
+
201
+ ##
202
+ # @return [String] The unique ID of the Account responsible for this conversation.
203
+ def account_sid
204
+ @properties['account_sid']
205
+ end
206
+
207
+ ##
208
+ # @return [String] The unique ID of the Conversation Service this conversation belongs to.
209
+ def chat_service_sid
210
+ @properties['chat_service_sid']
211
+ end
212
+
213
+ ##
214
+ # @return [String] The unique ID of the Participant.
215
+ def participant_sid
216
+ @properties['participant_sid']
217
+ end
218
+
219
+ ##
220
+ # @return [String] The unique ID for the conversation participant as Conversation User.
221
+ def participant_user_sid
222
+ @properties['participant_user_sid']
223
+ end
224
+
225
+ ##
226
+ # @return [String] A unique string identifier for the conversation participant as Conversation User.
227
+ def participant_identity
228
+ @properties['participant_identity']
229
+ end
230
+
231
+ ##
232
+ # @return [Hash] Information about how this participant exchanges messages with the conversation.
233
+ def participant_messaging_binding
234
+ @properties['participant_messaging_binding']
235
+ end
236
+
237
+ ##
238
+ # @return [String] The unique ID of the Conversation this Participant belongs to.
239
+ def conversation_sid
240
+ @properties['conversation_sid']
241
+ end
242
+
243
+ ##
244
+ # @return [String] An application-defined string that uniquely identifies the Conversation resource
245
+ def conversation_unique_name
246
+ @properties['conversation_unique_name']
247
+ end
248
+
249
+ ##
250
+ # @return [String] The human-readable name of this conversation.
251
+ def conversation_friendly_name
252
+ @properties['conversation_friendly_name']
253
+ end
254
+
255
+ ##
256
+ # @return [String] An optional string metadata field you can use to store any data you wish.
257
+ def conversation_attributes
258
+ @properties['conversation_attributes']
259
+ end
260
+
261
+ ##
262
+ # @return [Time] The date that this conversation was created.
263
+ def conversation_date_created
264
+ @properties['conversation_date_created']
265
+ end
266
+
267
+ ##
268
+ # @return [Time] The date that this conversation was last updated.
269
+ def conversation_date_updated
270
+ @properties['conversation_date_updated']
271
+ end
272
+
273
+ ##
274
+ # @return [String] Creator of this conversation.
275
+ def conversation_created_by
276
+ @properties['conversation_created_by']
277
+ end
278
+
279
+ ##
280
+ # @return [participant_conversation.State] The current state of this User Conversation
281
+ def conversation_state
282
+ @properties['conversation_state']
283
+ end
284
+
285
+ ##
286
+ # @return [Hash] Timer date values for this conversation.
287
+ def conversation_timers
288
+ @properties['conversation_timers']
289
+ end
290
+
291
+ ##
292
+ # @return [String] Absolute URLs to access the participant and conversation of this Participant Conversation.
293
+ def links
294
+ @properties['links']
295
+ end
296
+
297
+ ##
298
+ # Provide a user friendly representation
299
+ def to_s
300
+ "<Twilio.Conversations.V1.ParticipantConversationInstance>"
301
+ end
302
+
303
+ ##
304
+ # Provide a detailed, user friendly representation
305
+ def inspect
306
+ "<Twilio.Conversations.V1.ParticipantConversationInstance>"
307
+ end
308
+ end
309
+ end
310
+ end
311
+ end
312
+ end