twilio-ruby 5.54.0 → 5.57.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +7 -7
  3. data/.travis.yml +2 -2
  4. data/CHANGES.md +52 -0
  5. data/README.md +10 -2
  6. data/lib/twilio-ruby.rb +5 -15
  7. data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  8. data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  9. data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  10. data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  11. data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  12. data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  13. data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/http/http_client.rb +11 -1
  16. data/lib/twilio-ruby/rest.rb +13 -0
  17. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +8 -7
  18. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
  19. data/lib/twilio-ruby/rest/client.rb +7 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  21. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  22. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  23. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  24. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  25. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  26. data/lib/twilio-ruby/rest/frontline_api.rb +47 -0
  27. data/lib/twilio-ruby/rest/frontline_api/v1.rb +45 -0
  28. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +233 -0
  29. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +7 -0
  30. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +29 -0
  31. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  32. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +15 -6
  33. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -7
  34. data/lib/twilio-ruby/version.rb +1 -1
  35. metadata +17 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5566a64b2b4292461e668ceb197a806cee70f04974c5268affc88c2d17b1998
4
- data.tar.gz: 170fe096ae57154ce21fdfd0da343ed5081eb490dcb83e6fbd75bd1316832547
3
+ metadata.gz: 6580fd9988b8f5d7c1494fbc0f68c2c77d42a0f51a81c4e08c4c2302653e6359
4
+ data.tar.gz: a7f3a305f3a4e14457f6299a7e871acbd081c3855981261ac21f99e44e0262d9
5
5
  SHA512:
6
- metadata.gz: c19fbdd472d009b389ab1d74a1d4acb44d40b7f8acbf3ccff8b24ebbb4741fe28775cc93df19a663a8d0c59efbd787237e0e1e7cf02fa06b98ff4341e7e0f195
7
- data.tar.gz: 2886af917c2518e48f1845322b228cc8947f888aa60fc299c9010990361200eb9eaa0b5a52cc9331b3a56da8903289c91ca4f4d7fa1e3ed1e98f813be2873d52
6
+ metadata.gz: 81837aa62cc0638b88205d044b36216a626d71135ea2c72cb79cc3ef4ff79baa9e96fcfbf41e320dd4c6c8a225d4cc00617f702bbad55cbb6f19b68c00683d81
7
+ data.tar.gz: '01816f861fe32a5ffa43b39da58c69fd6cabd71ed333fa6965565427c4fcd4a0fdfe3b3c36f7f9c79e620a0374afe16af29c92ab698156d2ca1b5c60539a5beb'
data/.rubocop_todo.yml CHANGED
@@ -66,7 +66,7 @@ Lint/UnusedBlockArgument:
66
66
  Lint/UnusedMethodArgument:
67
67
  Exclude:
68
68
  - 'lib/twilio-ruby.rb'
69
- - 'lib/twilio-ruby/framework/page.rb'
69
+ - 'lib/twilio-ruby/framework/rest/page.rb'
70
70
  - 'spec/holodeck/holodeck.rb'
71
71
 
72
72
  # Offense count: 1
@@ -130,7 +130,7 @@ Style/FrozenStringLiteralComment:
130
130
  # Configuration parameters: MinBodyLength.
131
131
  Style/GuardClause:
132
132
  Exclude:
133
- - 'lib/twilio-ruby/framework/page.rb'
133
+ - 'lib/twilio-ruby/framework/rest/page.rb'
134
134
 
135
135
  # Offense count: 1
136
136
  # Cop supports --auto-correct.
@@ -144,8 +144,8 @@ Style/HashSyntax:
144
144
  # Cop supports --auto-correct.
145
145
  Style/IfUnlessModifier:
146
146
  Exclude:
147
- - 'lib/twilio-ruby/framework/page.rb'
148
- - 'lib/twilio-ruby/framework/version.rb'
147
+ - 'lib/twilio-ruby/framework/rest/page.rb'
148
+ - 'lib/twilio-ruby/framework/rest/version.rb'
149
149
  - 'lib/twilio-ruby/jwt/access_token.rb'
150
150
  - 'lib/twilio-ruby/jwt/client_capability.rb'
151
151
  - 'lib/twilio-ruby/jwt/jwt.rb'
@@ -168,9 +168,9 @@ Style/RedundantSelf:
168
168
  # SupportedStyles: slashes, percent_r, mixed
169
169
  Style/RegexpLiteral:
170
170
  Exclude:
171
- - 'lib/twilio-ruby/framework/domain.rb'
172
- - 'lib/twilio-ruby/framework/helper.rb'
173
- - 'lib/twilio-ruby/framework/version.rb'
171
+ - 'lib/twilio-ruby/framework/rest/domain.rb'
172
+ - 'lib/twilio-ruby/framework/rest/helper.rb'
173
+ - 'lib/twilio-ruby/framework/rest/version.rb'
174
174
  - 'spec/rack/twilio_webhook_authentication_spec.rb'
175
175
 
176
176
  # Offense count: 5
data/.travis.yml CHANGED
@@ -19,7 +19,7 @@ matrix:
19
19
  fast_finish: true
20
20
  deploy:
21
21
  - provider: script
22
- script: make docker-build && make docker-push
22
+ script: echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin && make docker-build && make docker-push
23
23
  skip_cleanup: true
24
24
  on:
25
25
  tags: true
@@ -36,4 +36,4 @@ notifications:
36
36
  on_success: never
37
37
  on_failure: change
38
38
  rooms:
39
- secure: OkXuxf75AYfH919/hhfY3IZOb6IzN3p74ouG2U860Vdwku1WzXjIutq0PnTeL7frqd+jbQgJmKcc3lbVXFZM0r96t8EsAuvXXx9ZWl7GuxpNUKAxwOqAY80m1b6Os7175MKeRyGnfvW8HTX14O7UmyYIJp5HrfN9dU1D1ZMUTDw=
39
+ secure: HG7rC5VSDOZiLCkpTsC4ZImh1k59OPi6YEjYKhdGXItybLHa6Yh5C42WvSx3kVW3SeyLOm1CiaMv+pbBZUXStXYsl8eH69MbEZimhDWsPs/m+bh+gEISov22WNUs3ZfUqIXMIb6v18oXPp2Qa1gX5LUEAGoSxHWNmCAcHayWl7M=
data/CHANGES.md CHANGED
@@ -1,6 +1,58 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2021-07-14] Version 5.57.0
5
+ ---------------------------
6
+ **Conversations**
7
+ - Changed `last_read_message_index` and `unread_messages_count` type in User Conversation's resource **(breaking change)**
8
+ - Expose UserConversations resource
9
+
10
+ **Messaging**
11
+ - Add brand_score field to brand registration responses
12
+
13
+
14
+ [2021-06-30] Version 5.56.0
15
+ ---------------------------
16
+ **Library - Feature**
17
+ - [PR #559](https://github.com/twilio/twilio-ruby/pull/559): Add `Twilio::HTTP::Client#configure_connection`. Thanks to [@darwinShopify](https://github.com/darwinShopify)!
18
+ - [PR #558](https://github.com/twilio/twilio-ruby/pull/558): Autoload Twilio::REST and Twilio::HTTP. Thanks to [@gmcgibbon](https://github.com/gmcgibbon)!
19
+
20
+ **Conversations**
21
+ - Read-only Conversation Email Binding property `binding`
22
+
23
+ **Supersim**
24
+ - Add Billing Period resource for the Super Sim Pilot
25
+ - Add List endpoint to Billing Period resource for Super Sim Pilot
26
+ - Add Fetch endpoint to Billing Period resource for Super Sim Pilot
27
+
28
+ **Taskrouter**
29
+ - Update `transcribe` & `transcription_configuration` form params in Reservation update endpoint to have private visibility **(breaking change)**
30
+ - Add `transcribe` & `transcription_configuration` form params to Reservation update endpoint
31
+
32
+ **Twiml**
33
+ - Add `modify` event to `statusCallbackEvent` for `<Conference>`.
34
+
35
+
36
+ [2021-06-16] Version 5.55.0
37
+ ---------------------------
38
+ **Api**
39
+ - Update `status` enum for Messages to include 'canceled'
40
+ - Update `update_status` enum for Messages to include 'canceled'
41
+
42
+ **Trusthub**
43
+ - Corrected the sid for policy sid in customer_profile_evaluation.json and trust_product_evaluation.json **(breaking change)**
44
+
45
+
46
+ [2021-06-02] Version 5.54.1
47
+ ---------------------------
48
+ **Events**
49
+ - join Sinks and Subscriptions service
50
+
51
+ **Verify**
52
+ - Improved the documentation of `challenge` adding the maximum and minimum expected lengths of some fields.
53
+ - Improve documentation regarding `notification` by updating the documentation of the field `ttl`.
54
+
55
+
4
56
  [2021-05-19] Version 5.54.0
5
57
  ---------------------------
6
58
  **Events**
data/README.md CHANGED
@@ -35,13 +35,13 @@ This library supports the following Ruby implementations:
35
35
  To install using [Bundler][bundler] grab the latest stable version:
36
36
 
37
37
  ```ruby
38
- gem 'twilio-ruby', '~> 5.54.0'
38
+ gem 'twilio-ruby', '~> 5.57.0'
39
39
  ```
40
40
 
41
41
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
42
42
 
43
43
  ```bash
44
- gem install twilio-ruby -v 5.54.0
44
+ gem install twilio-ruby -v 5.57.0
45
45
  ```
46
46
 
47
47
  To build and install the development branch yourself from the latest source:
@@ -158,6 +158,14 @@ message_sid = 'SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
158
158
 
159
159
  To use a custom HTTP client with this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/ruby/custom-http-clients).
160
160
 
161
+ To apply customizations such as middleware, you can use the `configure_connection` method like so:
162
+
163
+ ```ruby
164
+ @client.http_client.configure_connection do |faraday|
165
+ faraday.use SomeMiddleware
166
+ end
167
+ ```
168
+
161
169
  ### Handling Errors
162
170
 
163
171
  ```ruby
data/lib/twilio-ruby.rb CHANGED
@@ -16,27 +16,17 @@ require 'twilio-ruby/util'
16
16
  require 'twilio-ruby/security/request_validator'
17
17
  require 'twilio-ruby/util/configuration'
18
18
 
19
- Dir[File.dirname(__FILE__) + '/twilio-ruby/http/**/*.rb'].sort.each do |file|
20
- require file
21
- end
22
- Dir[File.dirname(__FILE__) + '/twilio-ruby/framework/**/*.rb'].sort.each do |file|
23
- require file
24
- end
25
- Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/*.rb'].sort.each do |file|
26
- require file
27
- end
28
- Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/**/*.rb'].sort.each do |file|
29
- require file
30
- end
31
- Dir[File.dirname(__FILE__) + '/twilio-ruby/compatibility/**/*.rb'].sort.each do |file|
19
+ Dir[File.join(__dir__, 'twilio-ruby/framework/*.rb')].sort.each do |file|
32
20
  require file
33
21
  end
34
22
 
35
23
  module Twilio
36
24
  extend SingleForwardable
37
25
 
38
- autoload :JWT, File.join(File.dirname(__FILE__), 'twilio-ruby', 'jwt', 'jwt.rb')
39
- autoload :TwiML, File.join(File.dirname(__FILE__), 'twilio-ruby', 'twiml', 'twiml.rb')
26
+ autoload :JWT, File.join(__dir__, 'twilio-ruby', 'jwt', 'jwt.rb')
27
+ autoload :TwiML, File.join(__dir__, 'twilio-ruby', 'twiml', 'twiml.rb')
28
+ autoload :HTTP, File.join(__dir__, 'twilio-ruby', 'http.rb')
29
+ autoload :REST, File.join(__dir__, 'twilio-ruby', 'rest.rb')
40
30
 
41
31
  def_delegators :configuration, :account_sid, :auth_token, :http_client, :region, :edge, :logger
42
32
 
File without changes
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir[File.join(__dir__, 'http/**/*.rb')].sort.each do |file|
4
+ require file
5
+ end
@@ -16,18 +16,28 @@ module Twilio
16
16
  @ssl_ca_file = ssl_ca_file
17
17
  @timeout = timeout
18
18
  @adapter = Faraday.default_adapter
19
+ @configure_connection_blocks = []
20
+ end
21
+
22
+ def configure_connection(&block)
23
+ raise ArgumentError, "#{__method__} must be given a block!" unless block_given?
24
+
25
+ @configure_connection_blocks << block
26
+ nil
19
27
  end
20
28
 
21
29
  def _request(request)
22
30
  @connection = Faraday.new(url: request.host + ':' + request.port.to_s, ssl: { verify: true }) do |f|
23
31
  f.options.params_encoder = Faraday::FlatParamsEncoder
24
32
  f.request :url_encoded
25
- f.adapter @adapter
26
33
  f.headers = request.headers
27
34
  f.basic_auth(request.auth[0], request.auth[1])
28
35
  f.proxy = "#{@proxy_prot}://#{@proxy_auth}#{@proxy_path}" if @proxy_prot && @proxy_path
29
36
  f.options.open_timeout = request.timeout || @timeout
30
37
  f.options.timeout = request.timeout || @timeout
38
+
39
+ @configure_connection_blocks.each { |block| block.call(f) }
40
+ f.adapter @adapter
31
41
  end
32
42
 
33
43
  @last_request = request
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir[File.join(__dir__, 'framework/rest/*.rb')].sort.each do |file|
4
+ require file
5
+ end
6
+
7
+ Dir[File.join(__dir__, 'rest/*.rb')].sort.each do |file|
8
+ require file
9
+ end
10
+
11
+ Dir[File.join(__dir__, 'rest/**/*.rb')].sort.each do |file|
12
+ require file
13
+ end
@@ -107,8 +107,8 @@ module Twilio
107
107
  # `POST`.
108
108
  # @param [Array[String]] conference_status_callback_event The conference state
109
109
  # changes that should generate a call to `conference_status_callback`. Can be:
110
- # `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`, and `announcement`.
111
- # Separate multiple values with a space. Defaults to `start end`.
110
+ # `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and
111
+ # `announcement`. Separate multiple values with a space. Defaults to `start end`.
112
112
  # @param [String] recording_channels The recording channels for the final
113
113
  # recording. Can be: `mono` or `dual` and the default is `mono`.
114
114
  # @param [String] recording_status_callback The URL that we should call using the
@@ -130,13 +130,14 @@ module Twilio
130
130
  # `POST` and defaults to `POST`.
131
131
  # @param [Array[String]] recording_status_callback_event The recording state
132
132
  # changes that should generate a call to `recording_status_callback`. Can be:
133
- # `in-progress`, `completed`, and `failed`. Separate multiple values with a space.
134
- # The default value is `in-progress completed failed`.
133
+ # `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`,
134
+ # and `absent`. Separate multiple values with a space, ex: `'in-progress completed
135
+ # failed'`.
135
136
  # @param [Array[String]] conference_recording_status_callback_event The conference
136
137
  # recording state changes that generate a call to
137
- # `conference_recording_status_callback`. Can be: `in-progress`, `completed`, and
138
- # `failed`. Separate multiple values with a space. The default value is
139
- # `in-progress completed failed`.
138
+ # `conference_recording_status_callback`. Can be: `in-progress`, `completed`,
139
+ # `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress
140
+ # completed failed'`
140
141
  # @param [Boolean] coaching Whether the participant is coaching another call. Can
141
142
  # be: `true` or `false`. If not present, defaults to `false` unless
142
143
  # `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined.
@@ -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
 
@@ -37,6 +37,7 @@ module Twilio
37
37
  @events = nil
38
38
  @fax = nil
39
39
  @flex_api = nil
40
+ @frontline_api = nil
40
41
  @insights = nil
41
42
  @ip_messaging = nil
42
43
  @lookups = nil
@@ -206,6 +207,12 @@ module Twilio
206
207
  @flex_api ||= FlexApi.new self
207
208
  end
208
209
 
210
+ ##
211
+ # Access the FrontlineApi Twilio Domain
212
+ def frontline_api
213
+ @frontline_api ||= FrontlineApi.new self
214
+ end
215
+
209
216
  ##
210
217
  # Access the Insights Twilio Domain
211
218
  def insights
@@ -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,
@@ -394,6 +394,7 @@ module Twilio
394
394
  'timers' => payload['timers'],
395
395
  'url' => payload['url'],
396
396
  'links' => payload['links'],
397
+ 'bindings' => payload['bindings'],
397
398
  }
398
399
 
399
400
  # Context
@@ -490,6 +491,12 @@ module Twilio
490
491
  @properties['links']
491
492
  end
492
493
 
494
+ ##
495
+ # @return [Hash] The bindings
496
+ def bindings
497
+ @properties['bindings']
498
+ end
499
+
493
500
  ##
494
501
  # Update the ConversationInstance
495
502
  # @param [String] friendly_name The human-readable name of this conversation,
@@ -189,6 +189,9 @@ module Twilio
189
189
  # Path Solution
190
190
  @solution = {chat_service_sid: chat_service_sid, sid: sid, }
191
191
  @uri = "/Services/#{@solution[:chat_service_sid]}/Users/#{@solution[:sid]}"
192
+
193
+ # Dependents
194
+ @user_conversations = nil
192
195
  end
193
196
 
194
197
  ##
@@ -246,6 +249,33 @@ module Twilio
246
249
  )
247
250
  end
248
251
 
252
+ ##
253
+ # Access the user_conversations
254
+ # @return [UserConversationList]
255
+ # @return [UserConversationContext] if conversation_sid was passed.
256
+ def user_conversations(conversation_sid=:unset)
257
+ raise ArgumentError, 'conversation_sid cannot be nil' if conversation_sid.nil?
258
+
259
+ if conversation_sid != :unset
260
+ return UserConversationContext.new(
261
+ @version,
262
+ @solution[:chat_service_sid],
263
+ @solution[:sid],
264
+ conversation_sid,
265
+ )
266
+ end
267
+
268
+ unless @user_conversations
269
+ @user_conversations = UserConversationList.new(
270
+ @version,
271
+ chat_service_sid: @solution[:chat_service_sid],
272
+ user_sid: @solution[:sid],
273
+ )
274
+ end
275
+
276
+ @user_conversations
277
+ end
278
+
249
279
  ##
250
280
  # Provide a user friendly representation
251
281
  def to_s
@@ -289,6 +319,7 @@ module Twilio
289
319
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
290
320
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
291
321
  'url' => payload['url'],
322
+ 'links' => payload['links'],
292
323
  }
293
324
 
294
325
  # Context
@@ -379,6 +410,12 @@ module Twilio
379
410
  @properties['url']
380
411
  end
381
412
 
413
+ ##
414
+ # @return [String] The links
415
+ def links
416
+ @properties['links']
417
+ end
418
+
382
419
  ##
383
420
  # Update the UserInstance
384
421
  # @param [String] friendly_name The string that you assigned to describe the
@@ -416,6 +453,13 @@ module Twilio
416
453
  context.fetch
417
454
  end
418
455
 
456
+ ##
457
+ # Access the user_conversations
458
+ # @return [user_conversations] user_conversations
459
+ def user_conversations
460
+ context.user_conversations
461
+ end
462
+
419
463
  ##
420
464
  # Provide a user friendly representation
421
465
  def to_s