twilio-ruby 5.54.1 → 5.57.1

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +7 -7
  3. data/.travis.yml +2 -2
  4. data/CHANGES.md +54 -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.rb +6 -0
  21. data/lib/twilio-ruby/rest/conversations/v1.rb +7 -0
  22. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  23. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  24. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  25. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  26. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  27. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  29. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  30. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  31. data/lib/twilio-ruby/rest/frontline_api.rb +47 -0
  32. data/lib/twilio-ruby/rest/frontline_api/v1.rb +45 -0
  33. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +233 -0
  34. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +7 -0
  35. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +29 -0
  36. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  37. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  38. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  39. data/lib/twilio-ruby/version.rb +1 -1
  40. metadata +19 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32e36d2240839f716f54c9d7071521c1cfc50f6325477e7fe093b220cc373789
4
- data.tar.gz: 3b9e9209db5ddd89b78b1f504e5609d66c5a85aa83f20f55cb133a5d9e54e852
3
+ metadata.gz: 56ba46ce32ceced608bcb6b1ab335f0aa103da6d3a40dba1e0a59b97734fe4f7
4
+ data.tar.gz: 4104e0a452f0760f38a5ef1429553ad9a5f92c33a314e57d8f6e25c1689ada84
5
5
  SHA512:
6
- metadata.gz: 98cf8aaa6597b9948f8bc5e1f2d4093284ee71344bd5a104553324a851a50255b97b57b5333e3aeb7dcfbbee5f74d5d8185b943d052a482f7eab431e1bbf084c
7
- data.tar.gz: 6ae58a103714ee0150afd19e134488b41f5f0f8ef96d7a0a01c851da749a548654e2c61e0c847227a7d76cf3c7ab5042a4591dcb9eeeaa7d075063307cffbec6
6
+ metadata.gz: 0d3edfca4bae4bad789f6ef2e5f15a161c115bb625e6a0912049c8f6054b05c40d4e41dd19544072be75a0e4f6d69f1b23fa41f3e8b3bee2453843f370c8c658
7
+ data.tar.gz: 294073c071626bd889f211b66d16f0f896c6e127d524385b9d8989684eced0d63cdd1b6d456537f9ccc78e8b2a71b45dfdb1b14ec4a86c1f3b90413a0f4c588b
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,60 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2021-07-28] Version 5.57.1
5
+ ---------------------------
6
+ **Conversations**
7
+ - Expose ParticipantConversations resource
8
+
9
+ **Taskrouter**
10
+ - Adding `links` to the activity resource
11
+
12
+ **Verify**
13
+ - Added a `Version` to Verify Factors `Webhooks` to add new fields without breaking old Webhooks.
14
+
15
+
16
+ [2021-07-14] Version 5.57.0
17
+ ---------------------------
18
+ **Conversations**
19
+ - Changed `last_read_message_index` and `unread_messages_count` type in User Conversation's resource **(breaking change)**
20
+ - Expose UserConversations resource
21
+
22
+ **Messaging**
23
+ - Add brand_score field to brand registration responses
24
+
25
+
26
+ [2021-06-30] Version 5.56.0
27
+ ---------------------------
28
+ **Library - Feature**
29
+ - [PR #559](https://github.com/twilio/twilio-ruby/pull/559): Add `Twilio::HTTP::Client#configure_connection`. Thanks to [@darwinShopify](https://github.com/darwinShopify)!
30
+ - [PR #558](https://github.com/twilio/twilio-ruby/pull/558): Autoload Twilio::REST and Twilio::HTTP. Thanks to [@gmcgibbon](https://github.com/gmcgibbon)!
31
+
32
+ **Conversations**
33
+ - Read-only Conversation Email Binding property `binding`
34
+
35
+ **Supersim**
36
+ - Add Billing Period resource for the Super Sim Pilot
37
+ - Add List endpoint to Billing Period resource for Super Sim Pilot
38
+ - Add Fetch endpoint to Billing Period resource for Super Sim Pilot
39
+
40
+ **Taskrouter**
41
+ - Update `transcribe` & `transcription_configuration` form params in Reservation update endpoint to have private visibility **(breaking change)**
42
+ - Add `transcribe` & `transcription_configuration` form params to Reservation update endpoint
43
+
44
+ **Twiml**
45
+ - Add `modify` event to `statusCallbackEvent` for `<Conference>`.
46
+
47
+
48
+ [2021-06-16] Version 5.55.0
49
+ ---------------------------
50
+ **Api**
51
+ - Update `status` enum for Messages to include 'canceled'
52
+ - Update `update_status` enum for Messages to include 'canceled'
53
+
54
+ **Trusthub**
55
+ - Corrected the sid for policy sid in customer_profile_evaluation.json and trust_product_evaluation.json **(breaking change)**
56
+
57
+
4
58
  [2021-06-02] Version 5.54.1
5
59
  ---------------------------
6
60
  **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.1'
38
+ gem 'twilio-ruby', '~> 5.57.1'
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.1
44
+ gem install twilio-ruby -v 5.57.1
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
@@ -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