twilio-ruby 5.55.0 → 5.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -109,11 +109,15 @@ module Twilio
109
109
  # Create the BrandRegistrationInstance
110
110
  # @param [String] customer_profile_bundle_sid Customer Profile Bundle Sid.
111
111
  # @param [String] a2p_profile_bundle_sid A2P Messaging Profile Bundle Sid.
112
+ # @param [String] brand_type Type of brand being created. One of: "STANDARD",
113
+ # "STARTER". STARTER is for low volume, starter use cases. STANDARD is for all
114
+ # other use cases.
112
115
  # @return [BrandRegistrationInstance] Created BrandRegistrationInstance
113
- def create(customer_profile_bundle_sid: nil, a2p_profile_bundle_sid: nil)
116
+ def create(customer_profile_bundle_sid: nil, a2p_profile_bundle_sid: nil, brand_type: :unset)
114
117
  data = Twilio::Values.of({
115
118
  'CustomerProfileBundleSid' => customer_profile_bundle_sid,
116
119
  'A2PProfileBundleSid' => a2p_profile_bundle_sid,
120
+ 'BrandType' => brand_type,
117
121
  })
118
122
 
119
123
  payload = @version.create('POST', @uri, data: data)
@@ -219,10 +223,12 @@ module Twilio
219
223
  'a2p_profile_bundle_sid' => payload['a2p_profile_bundle_sid'],
220
224
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
221
225
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
226
+ 'brand_type' => payload['brand_type'],
222
227
  'status' => payload['status'],
223
228
  'tcr_id' => payload['tcr_id'],
224
229
  'failure_reason' => payload['failure_reason'],
225
230
  'url' => payload['url'],
231
+ 'brand_score' => payload['brand_score'] == nil ? payload['brand_score'] : payload['brand_score'].to_i,
226
232
  }
227
233
 
228
234
  # Context
@@ -277,6 +283,12 @@ module Twilio
277
283
  @properties['date_updated']
278
284
  end
279
285
 
286
+ ##
287
+ # @return [String] Type of brand. One of: "STANDARD", "STARTER".
288
+ def brand_type
289
+ @properties['brand_type']
290
+ end
291
+
280
292
  ##
281
293
  # @return [brand_registration.Status] Brand Registration status
282
294
  def status
@@ -301,6 +313,12 @@ module Twilio
301
313
  @properties['url']
302
314
  end
303
315
 
316
+ ##
317
+ # @return [String] Brand score
318
+ def brand_score
319
+ @properties['brand_score']
320
+ end
321
+
304
322
  ##
305
323
  # Fetch the BrandRegistrationInstance
306
324
  # @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance
@@ -200,6 +200,9 @@ module Twilio
200
200
  # Path Solution
201
201
  @solution = {sid: sid, }
202
202
  @uri = "/Sims/#{@solution[:sid]}"
203
+
204
+ # Dependents
205
+ @billing_periods = nil
203
206
  end
204
207
 
205
208
  ##
@@ -246,6 +249,18 @@ module Twilio
246
249
  SimInstance.new(@version, payload, sid: @solution[:sid], )
247
250
  end
248
251
 
252
+ ##
253
+ # Access the billing_periods
254
+ # @return [BillingPeriodList]
255
+ # @return [BillingPeriodContext]
256
+ def billing_periods
257
+ unless @billing_periods
258
+ @billing_periods = BillingPeriodList.new(@version, sim_sid: @solution[:sid], )
259
+ end
260
+
261
+ @billing_periods
262
+ end
263
+
249
264
  ##
250
265
  # Provide a user friendly representation
251
266
  def to_s
@@ -284,6 +299,7 @@ module Twilio
284
299
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
285
300
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
286
301
  'url' => payload['url'],
302
+ 'links' => payload['links'],
287
303
  }
288
304
 
289
305
  # Context
@@ -356,6 +372,12 @@ module Twilio
356
372
  @properties['url']
357
373
  end
358
374
 
375
+ ##
376
+ # @return [String] The links
377
+ def links
378
+ @properties['links']
379
+ end
380
+
359
381
  ##
360
382
  # Fetch the SimInstance
361
383
  # @return [SimInstance] Fetched SimInstance
@@ -394,6 +416,13 @@ module Twilio
394
416
  )
395
417
  end
396
418
 
419
+ ##
420
+ # Access the billing_periods
421
+ # @return [billing_periods] billing_periods
422
+ def billing_periods
423
+ context.billing_periods
424
+ end
425
+
397
426
  ##
398
427
  # Provide a user friendly representation
399
428
  def to_s
@@ -0,0 +1,231 @@
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 Supersim < Domain
12
+ class V1 < Version
13
+ class SimContext < InstanceContext
14
+ class BillingPeriodList < ListResource
15
+ ##
16
+ # Initialize the BillingPeriodList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to.
19
+ # @return [BillingPeriodList] BillingPeriodList
20
+ def initialize(version, sim_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {sim_sid: sim_sid}
25
+ @uri = "/Sims/#{@solution[:sim_sid]}/BillingPeriods"
26
+ end
27
+
28
+ ##
29
+ # Lists BillingPeriodInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
33
+ # guarantees to never return more than limit. Default is no limit
34
+ # @param [Integer] page_size Number of records to fetch per request, when
35
+ # not set will use the default value of 50 records. If no page_size is defined
36
+ # but a limit is defined, stream() will attempt to read the limit with the most
37
+ # efficient page size, i.e. min(limit, 1000)
38
+ # @return [Array] Array of up to limit results
39
+ def list(limit: nil, page_size: nil)
40
+ self.stream(limit: limit, page_size: page_size).entries
41
+ end
42
+
43
+ ##
44
+ # Streams BillingPeriodInstance records from the API as an Enumerable.
45
+ # This operation lazily loads records as efficiently as possible until the limit
46
+ # is reached.
47
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
48
+ # guarantees to never return more than limit. Default is no limit.
49
+ # @param [Integer] page_size Number of records to fetch per request, when
50
+ # not set will use the default value of 50 records. If no page_size is defined
51
+ # but a limit is defined, stream() will attempt to read the limit with the most
52
+ # efficient page size, i.e. min(limit, 1000)
53
+ # @return [Enumerable] Enumerable that will yield up to limit results
54
+ def stream(limit: nil, page_size: nil)
55
+ limits = @version.read_limits(limit, page_size)
56
+
57
+ page = self.page(page_size: limits[:page_size], )
58
+
59
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
60
+ end
61
+
62
+ ##
63
+ # When passed a block, yields BillingPeriodInstance records from the API.
64
+ # This operation lazily loads records as efficiently as possible until the limit
65
+ # is reached.
66
+ def each
67
+ limits = @version.read_limits
68
+
69
+ page = self.page(page_size: limits[:page_size], )
70
+
71
+ @version.stream(page,
72
+ limit: limits[:limit],
73
+ page_limit: limits[:page_limit]).each {|x| yield x}
74
+ end
75
+
76
+ ##
77
+ # Retrieve a single page of BillingPeriodInstance records from the API.
78
+ # Request is executed immediately.
79
+ # @param [String] page_token PageToken provided by the API
80
+ # @param [Integer] page_number Page Number, this value is simply for client state
81
+ # @param [Integer] page_size Number of records to return, defaults to 50
82
+ # @return [Page] Page of BillingPeriodInstance
83
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
84
+ params = Twilio::Values.of({
85
+ 'PageToken' => page_token,
86
+ 'Page' => page_number,
87
+ 'PageSize' => page_size,
88
+ })
89
+
90
+ response = @version.page('GET', @uri, params: params)
91
+
92
+ BillingPeriodPage.new(@version, response, @solution)
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of BillingPeriodInstance records from the API.
97
+ # Request is executed immediately.
98
+ # @param [String] target_url API-generated URL for the requested results page
99
+ # @return [Page] Page of BillingPeriodInstance
100
+ def get_page(target_url)
101
+ response = @version.domain.request(
102
+ 'GET',
103
+ target_url
104
+ )
105
+ BillingPeriodPage.new(@version, response, @solution)
106
+ end
107
+
108
+ ##
109
+ # Provide a user friendly representation
110
+ def to_s
111
+ '#<Twilio.Supersim.V1.BillingPeriodList>'
112
+ end
113
+ end
114
+
115
+ class BillingPeriodPage < Page
116
+ ##
117
+ # Initialize the BillingPeriodPage
118
+ # @param [Version] version Version that contains the resource
119
+ # @param [Response] response Response from the API
120
+ # @param [Hash] solution Path solution for the resource
121
+ # @return [BillingPeriodPage] BillingPeriodPage
122
+ def initialize(version, response, solution)
123
+ super(version, response)
124
+
125
+ # Path Solution
126
+ @solution = solution
127
+ end
128
+
129
+ ##
130
+ # Build an instance of BillingPeriodInstance
131
+ # @param [Hash] payload Payload response from the API
132
+ # @return [BillingPeriodInstance] BillingPeriodInstance
133
+ def get_instance(payload)
134
+ BillingPeriodInstance.new(@version, payload, sim_sid: @solution[:sim_sid], )
135
+ end
136
+
137
+ ##
138
+ # Provide a user friendly representation
139
+ def to_s
140
+ '<Twilio.Supersim.V1.BillingPeriodPage>'
141
+ end
142
+ end
143
+
144
+ class BillingPeriodInstance < InstanceResource
145
+ ##
146
+ # Initialize the BillingPeriodInstance
147
+ # @param [Version] version Version that contains the resource
148
+ # @param [Hash] payload payload that contains response from Twilio
149
+ # @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to.
150
+ # @return [BillingPeriodInstance] BillingPeriodInstance
151
+ def initialize(version, payload, sim_sid: nil)
152
+ super(version)
153
+
154
+ # Marshaled Properties
155
+ @properties = {
156
+ 'sid' => payload['sid'],
157
+ 'account_sid' => payload['account_sid'],
158
+ 'sim_sid' => payload['sim_sid'],
159
+ 'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
160
+ 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
161
+ 'period_type' => payload['period_type'],
162
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
163
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
164
+ }
165
+ end
166
+
167
+ ##
168
+ # @return [String] The SID of the Billing Period
169
+ def sid
170
+ @properties['sid']
171
+ end
172
+
173
+ ##
174
+ # @return [String] The SID of the Account the Super SIM belongs to
175
+ def account_sid
176
+ @properties['account_sid']
177
+ end
178
+
179
+ ##
180
+ # @return [String] The SID of the Super SIM the Billing Period belongs to
181
+ def sim_sid
182
+ @properties['sim_sid']
183
+ end
184
+
185
+ ##
186
+ # @return [Time] The start time of the Billing Period
187
+ def start_time
188
+ @properties['start_time']
189
+ end
190
+
191
+ ##
192
+ # @return [Time] The end time of the Billing Period
193
+ def end_time
194
+ @properties['end_time']
195
+ end
196
+
197
+ ##
198
+ # @return [billing_period.BpType] The type of the Billing Period
199
+ def period_type
200
+ @properties['period_type']
201
+ end
202
+
203
+ ##
204
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
205
+ def date_created
206
+ @properties['date_created']
207
+ end
208
+
209
+ ##
210
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
211
+ def date_updated
212
+ @properties['date_updated']
213
+ end
214
+
215
+ ##
216
+ # Provide a user friendly representation
217
+ def to_s
218
+ "<Twilio.Supersim.V1.BillingPeriodInstance>"
219
+ end
220
+
221
+ ##
222
+ # Provide a detailed, user friendly representation
223
+ def inspect
224
+ "<Twilio.Supersim.V1.BillingPeriodInstance>"
225
+ end
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
@@ -282,6 +282,7 @@ module Twilio
282
282
  'sid' => payload['sid'],
283
283
  'workspace_sid' => payload['workspace_sid'],
284
284
  'url' => payload['url'],
285
+ 'links' => payload['links'],
285
286
  }
286
287
 
287
288
  # Context
@@ -348,6 +349,12 @@ module Twilio
348
349
  @properties['url']
349
350
  end
350
351
 
352
+ ##
353
+ # @return [String] The links
354
+ def links
355
+ @properties['links']
356
+ end
357
+
351
358
  ##
352
359
  # Fetch the ActivityInstance
353
360
  # @return [ActivityInstance] Fetched ActivityInstance
@@ -64,8 +64,9 @@ module Twilio
64
64
  # Hash}[https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string]
65
65
  # to be appended at the end of your verification SMS body. Applies only to SMS.
66
66
  # Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`.
67
+ # @param [String] template_sid The SID of the custom template to be used.
67
68
  # @return [VerificationInstance] Created VerificationInstance
68
- def create(to: nil, channel: nil, custom_friendly_name: :unset, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset, rate_limits: :unset, channel_configuration: :unset, app_hash: :unset)
69
+ def create(to: nil, channel: nil, custom_friendly_name: :unset, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset, rate_limits: :unset, channel_configuration: :unset, app_hash: :unset, template_sid: :unset)
69
70
  data = Twilio::Values.of({
70
71
  'To' => to,
71
72
  'Channel' => channel,
@@ -79,6 +80,7 @@ module Twilio
79
80
  'RateLimits' => Twilio.serialize_object(rate_limits),
80
81
  'ChannelConfiguration' => Twilio.serialize_object(channel_configuration),
81
82
  'AppHash' => app_hash,
83
+ 'TemplateSid' => template_sid,
82
84
  })
83
85
 
84
86
  payload = @version.create('POST', @uri, data: data)
@@ -37,13 +37,17 @@ module Twilio
37
37
  # @param [String] webhook_url The URL associated with this Webhook.
38
38
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
39
39
  # One of: `enabled` or `disabled`
40
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
41
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
42
+ # in the future.
40
43
  # @return [WebhookInstance] Created WebhookInstance
41
- def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset)
44
+ def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset, version: :unset)
42
45
  data = Twilio::Values.of({
43
46
  'FriendlyName' => friendly_name,
44
47
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
45
48
  'WebhookUrl' => webhook_url,
46
49
  'Status' => status,
50
+ 'Version' => version,
47
51
  })
48
52
 
49
53
  payload = @version.create('POST', @uri, data: data)
@@ -197,13 +201,17 @@ module Twilio
197
201
  # @param [String] webhook_url The URL associated with this Webhook.
198
202
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
199
203
  # One of: `enabled` or `disabled`
204
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
205
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
206
+ # in the future.
200
207
  # @return [WebhookInstance] Updated WebhookInstance
201
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
208
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
202
209
  data = Twilio::Values.of({
203
210
  'FriendlyName' => friendly_name,
204
211
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
205
212
  'WebhookUrl' => webhook_url,
206
213
  'Status' => status,
214
+ 'Version' => version,
207
215
  })
208
216
 
209
217
  payload = @version.update('POST', @uri, data: data)
@@ -264,6 +272,7 @@ module Twilio
264
272
  'friendly_name' => payload['friendly_name'],
265
273
  'event_types' => payload['event_types'],
266
274
  'status' => payload['status'],
275
+ 'version' => payload['version'],
267
276
  'webhook_url' => payload['webhook_url'],
268
277
  'webhook_method' => payload['webhook_method'],
269
278
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
@@ -323,6 +332,12 @@ module Twilio
323
332
  @properties['status']
324
333
  end
325
334
 
335
+ ##
336
+ # @return [webhook.Version] The webhook version
337
+ def version
338
+ @properties['version']
339
+ end
340
+
326
341
  ##
327
342
  # @return [String] The URL associated with this Webhook.
328
343
  def webhook_url
@@ -336,13 +351,13 @@ module Twilio
336
351
  end
337
352
 
338
353
  ##
339
- # @return [Time] The RFC 2822 date and time in GMT when the resource was created
354
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
340
355
  def date_created
341
356
  @properties['date_created']
342
357
  end
343
358
 
344
359
  ##
345
- # @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
360
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
346
361
  def date_updated
347
362
  @properties['date_updated']
348
363
  end
@@ -363,13 +378,17 @@ module Twilio
363
378
  # @param [String] webhook_url The URL associated with this Webhook.
364
379
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
365
380
  # One of: `enabled` or `disabled`
381
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
382
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
383
+ # in the future.
366
384
  # @return [WebhookInstance] Updated WebhookInstance
367
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
385
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
368
386
  context.update(
369
387
  friendly_name: friendly_name,
370
388
  event_types: event_types,
371
389
  webhook_url: webhook_url,
372
390
  status: status,
391
+ version: version,
373
392
  )
374
393
  end
375
394