twilio-ruby 5.52.0 → 5.67.3

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 (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -0,0 +1,384 @@
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 FlexApi < Domain
12
+ class V1 < Version
13
+ class InteractionContext < InstanceContext
14
+ class InteractionChannelList < ListResource
15
+ ##
16
+ # Initialize the InteractionChannelList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] interaction_sid The unique string created by Twilio to identify
19
+ # an Interaction resource, prefixed with KD.
20
+ # @return [InteractionChannelList] InteractionChannelList
21
+ def initialize(version, interaction_sid: nil)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {interaction_sid: interaction_sid}
26
+ @uri = "/Interactions/#{@solution[:interaction_sid]}/Channels"
27
+ end
28
+
29
+ ##
30
+ # Lists InteractionChannelInstance records from the API as a list.
31
+ # Unlike stream(), this operation is eager and will load `limit` records into
32
+ # memory before returning.
33
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
34
+ # guarantees to never return more than limit. Default is no limit
35
+ # @param [Integer] page_size Number of records to fetch per request, when
36
+ # not set will use the default value of 50 records. If no page_size is defined
37
+ # but a limit is defined, stream() will attempt to read the limit with the most
38
+ # efficient page size, i.e. min(limit, 1000)
39
+ # @return [Array] Array of up to limit results
40
+ def list(limit: nil, page_size: nil)
41
+ self.stream(limit: limit, page_size: page_size).entries
42
+ end
43
+
44
+ ##
45
+ # Streams InteractionChannelInstance records from the API as an Enumerable.
46
+ # This operation lazily loads records as efficiently as possible until the limit
47
+ # is reached.
48
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
49
+ # guarantees to never return more than limit. Default is no limit.
50
+ # @param [Integer] page_size Number of records to fetch per request, when
51
+ # not set will use the default value of 50 records. If no page_size is defined
52
+ # but a limit is defined, stream() will attempt to read the limit with the most
53
+ # efficient page size, i.e. min(limit, 1000)
54
+ # @return [Enumerable] Enumerable that will yield up to limit results
55
+ def stream(limit: nil, page_size: nil)
56
+ limits = @version.read_limits(limit, page_size)
57
+
58
+ page = self.page(page_size: limits[:page_size], )
59
+
60
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
61
+ end
62
+
63
+ ##
64
+ # When passed a block, yields InteractionChannelInstance records from the API.
65
+ # This operation lazily loads records as efficiently as possible until the limit
66
+ # is reached.
67
+ def each
68
+ limits = @version.read_limits
69
+
70
+ page = self.page(page_size: limits[:page_size], )
71
+
72
+ @version.stream(page,
73
+ limit: limits[:limit],
74
+ page_limit: limits[:page_limit]).each {|x| yield x}
75
+ end
76
+
77
+ ##
78
+ # Retrieve a single page of InteractionChannelInstance records from the API.
79
+ # Request is executed immediately.
80
+ # @param [String] page_token PageToken provided by the API
81
+ # @param [Integer] page_number Page Number, this value is simply for client state
82
+ # @param [Integer] page_size Number of records to return, defaults to 50
83
+ # @return [Page] Page of InteractionChannelInstance
84
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
85
+ params = Twilio::Values.of({
86
+ 'PageToken' => page_token,
87
+ 'Page' => page_number,
88
+ 'PageSize' => page_size,
89
+ })
90
+
91
+ response = @version.page('GET', @uri, params: params)
92
+
93
+ InteractionChannelPage.new(@version, response, @solution)
94
+ end
95
+
96
+ ##
97
+ # Retrieve a single page of InteractionChannelInstance records from the API.
98
+ # Request is executed immediately.
99
+ # @param [String] target_url API-generated URL for the requested results page
100
+ # @return [Page] Page of InteractionChannelInstance
101
+ def get_page(target_url)
102
+ response = @version.domain.request(
103
+ 'GET',
104
+ target_url
105
+ )
106
+ InteractionChannelPage.new(@version, response, @solution)
107
+ end
108
+
109
+ ##
110
+ # Provide a user friendly representation
111
+ def to_s
112
+ '#<Twilio.FlexApi.V1.InteractionChannelList>'
113
+ end
114
+ end
115
+
116
+ class InteractionChannelPage < Page
117
+ ##
118
+ # Initialize the InteractionChannelPage
119
+ # @param [Version] version Version that contains the resource
120
+ # @param [Response] response Response from the API
121
+ # @param [Hash] solution Path solution for the resource
122
+ # @return [InteractionChannelPage] InteractionChannelPage
123
+ def initialize(version, response, solution)
124
+ super(version, response)
125
+
126
+ # Path Solution
127
+ @solution = solution
128
+ end
129
+
130
+ ##
131
+ # Build an instance of InteractionChannelInstance
132
+ # @param [Hash] payload Payload response from the API
133
+ # @return [InteractionChannelInstance] InteractionChannelInstance
134
+ def get_instance(payload)
135
+ InteractionChannelInstance.new(@version, payload, interaction_sid: @solution[:interaction_sid], )
136
+ end
137
+
138
+ ##
139
+ # Provide a user friendly representation
140
+ def to_s
141
+ '<Twilio.FlexApi.V1.InteractionChannelPage>'
142
+ end
143
+ end
144
+
145
+ class InteractionChannelContext < InstanceContext
146
+ ##
147
+ # Initialize the InteractionChannelContext
148
+ # @param [Version] version Version that contains the resource
149
+ # @param [String] interaction_sid The unique string created by Twilio to identify
150
+ # an Interaction resource, prefixed with KD.
151
+ # @param [String] sid The unique string created by Twilio to identify an
152
+ # Interaction Channel resource, prefixed with UO.
153
+ # @return [InteractionChannelContext] InteractionChannelContext
154
+ def initialize(version, interaction_sid, sid)
155
+ super(version)
156
+
157
+ # Path Solution
158
+ @solution = {interaction_sid: interaction_sid, sid: sid, }
159
+ @uri = "/Interactions/#{@solution[:interaction_sid]}/Channels/#{@solution[:sid]}"
160
+
161
+ # Dependents
162
+ @invites = nil
163
+ @participants = nil
164
+ end
165
+
166
+ ##
167
+ # Fetch the InteractionChannelInstance
168
+ # @return [InteractionChannelInstance] Fetched InteractionChannelInstance
169
+ def fetch
170
+ payload = @version.fetch('GET', @uri)
171
+
172
+ InteractionChannelInstance.new(
173
+ @version,
174
+ payload,
175
+ interaction_sid: @solution[:interaction_sid],
176
+ sid: @solution[:sid],
177
+ )
178
+ end
179
+
180
+ ##
181
+ # Update the InteractionChannelInstance
182
+ # @param [interaction_channel.Status] status Required. Indicates the Interaction
183
+ # channel's status. When a channel is set to `closed`, all tasks are put in the
184
+ # `wrapping` state by default unless the Routing status is set to `closed` in
185
+ # which case the tasks will be `completed`. Value: `closed`.
186
+ # @param [Hash] routing Optional. The state of associated tasks. If not specified,
187
+ # all tasks will be set to `wrapping`.
188
+ # @return [InteractionChannelInstance] Updated InteractionChannelInstance
189
+ def update(status: nil, routing: :unset)
190
+ data = Twilio::Values.of({'Status' => status, 'Routing' => Twilio.serialize_object(routing), })
191
+
192
+ payload = @version.update('POST', @uri, data: data)
193
+
194
+ InteractionChannelInstance.new(
195
+ @version,
196
+ payload,
197
+ interaction_sid: @solution[:interaction_sid],
198
+ sid: @solution[:sid],
199
+ )
200
+ end
201
+
202
+ ##
203
+ # Access the invites
204
+ # @return [InteractionChannelInviteList]
205
+ # @return [InteractionChannelInviteContext]
206
+ def invites
207
+ unless @invites
208
+ @invites = InteractionChannelInviteList.new(
209
+ @version,
210
+ interaction_sid: @solution[:interaction_sid],
211
+ channel_sid: @solution[:sid],
212
+ )
213
+ end
214
+
215
+ @invites
216
+ end
217
+
218
+ ##
219
+ # Access the participants
220
+ # @return [InteractionChannelParticipantList]
221
+ # @return [InteractionChannelParticipantContext] if sid was passed.
222
+ def participants(sid=:unset)
223
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
224
+
225
+ if sid != :unset
226
+ return InteractionChannelParticipantContext.new(
227
+ @version,
228
+ @solution[:interaction_sid],
229
+ @solution[:sid],
230
+ sid,
231
+ )
232
+ end
233
+
234
+ unless @participants
235
+ @participants = InteractionChannelParticipantList.new(
236
+ @version,
237
+ interaction_sid: @solution[:interaction_sid],
238
+ channel_sid: @solution[:sid],
239
+ )
240
+ end
241
+
242
+ @participants
243
+ end
244
+
245
+ ##
246
+ # Provide a user friendly representation
247
+ def to_s
248
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
249
+ "#<Twilio.FlexApi.V1.InteractionChannelContext #{context}>"
250
+ end
251
+
252
+ ##
253
+ # Provide a detailed, user friendly representation
254
+ def inspect
255
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
256
+ "#<Twilio.FlexApi.V1.InteractionChannelContext #{context}>"
257
+ end
258
+ end
259
+
260
+ class InteractionChannelInstance < InstanceResource
261
+ ##
262
+ # Initialize the InteractionChannelInstance
263
+ # @param [Version] version Version that contains the resource
264
+ # @param [Hash] payload payload that contains response from Twilio
265
+ # @param [String] interaction_sid The unique string created by Twilio to identify
266
+ # an Interaction resource, prefixed with KD.
267
+ # @param [String] sid The unique string created by Twilio to identify an
268
+ # Interaction Channel resource, prefixed with UO.
269
+ # @return [InteractionChannelInstance] InteractionChannelInstance
270
+ def initialize(version, payload, interaction_sid: nil, sid: nil)
271
+ super(version)
272
+
273
+ # Marshaled Properties
274
+ @properties = {
275
+ 'sid' => payload['sid'],
276
+ 'interaction_sid' => payload['interaction_sid'],
277
+ 'type' => payload['type'],
278
+ 'url' => payload['url'],
279
+ 'links' => payload['links'],
280
+ }
281
+
282
+ # Context
283
+ @instance_context = nil
284
+ @params = {'interaction_sid' => interaction_sid, 'sid' => sid || @properties['sid'], }
285
+ end
286
+
287
+ ##
288
+ # Generate an instance context for the instance, the context is capable of
289
+ # performing various actions. All instance actions are proxied to the context
290
+ # @return [InteractionChannelContext] InteractionChannelContext for this InteractionChannelInstance
291
+ def context
292
+ unless @instance_context
293
+ @instance_context = InteractionChannelContext.new(
294
+ @version,
295
+ @params['interaction_sid'],
296
+ @params['sid'],
297
+ )
298
+ end
299
+ @instance_context
300
+ end
301
+
302
+ ##
303
+ # @return [String] The unique string that identifies the resource
304
+ def sid
305
+ @properties['sid']
306
+ end
307
+
308
+ ##
309
+ # @return [String] The unique string that identifies the resource
310
+ def interaction_sid
311
+ @properties['interaction_sid']
312
+ end
313
+
314
+ ##
315
+ # @return [interaction_channel.Type] The Interaction Channel's type.
316
+ def type
317
+ @properties['type']
318
+ end
319
+
320
+ ##
321
+ # @return [String] The url
322
+ def url
323
+ @properties['url']
324
+ end
325
+
326
+ ##
327
+ # @return [String] The links
328
+ def links
329
+ @properties['links']
330
+ end
331
+
332
+ ##
333
+ # Fetch the InteractionChannelInstance
334
+ # @return [InteractionChannelInstance] Fetched InteractionChannelInstance
335
+ def fetch
336
+ context.fetch
337
+ end
338
+
339
+ ##
340
+ # Update the InteractionChannelInstance
341
+ # @param [interaction_channel.Status] status Required. Indicates the Interaction
342
+ # channel's status. When a channel is set to `closed`, all tasks are put in the
343
+ # `wrapping` state by default unless the Routing status is set to `closed` in
344
+ # which case the tasks will be `completed`. Value: `closed`.
345
+ # @param [Hash] routing Optional. The state of associated tasks. If not specified,
346
+ # all tasks will be set to `wrapping`.
347
+ # @return [InteractionChannelInstance] Updated InteractionChannelInstance
348
+ def update(status: nil, routing: :unset)
349
+ context.update(status: status, routing: routing, )
350
+ end
351
+
352
+ ##
353
+ # Access the invites
354
+ # @return [invites] invites
355
+ def invites
356
+ context.invites
357
+ end
358
+
359
+ ##
360
+ # Access the participants
361
+ # @return [participants] participants
362
+ def participants
363
+ context.participants
364
+ end
365
+
366
+ ##
367
+ # Provide a user friendly representation
368
+ def to_s
369
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
370
+ "<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
371
+ end
372
+
373
+ ##
374
+ # Provide a detailed, user friendly representation
375
+ def inspect
376
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
377
+ "<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
378
+ end
379
+ end
380
+ end
381
+ end
382
+ end
383
+ end
384
+ end
@@ -0,0 +1,233 @@
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 FlexApi < Domain
12
+ class V1 < Version
13
+ class InteractionList < ListResource
14
+ ##
15
+ # Initialize the InteractionList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [InteractionList] InteractionList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/Interactions"
24
+ end
25
+
26
+ ##
27
+ # Create the InteractionInstance
28
+ # @param [Hash] channel The Interaction's channel.
29
+ # @param [Hash] routing The Interaction's routing logic.
30
+ # @return [InteractionInstance] Created InteractionInstance
31
+ def create(channel: nil, routing: nil)
32
+ data = Twilio::Values.of({
33
+ 'Channel' => Twilio.serialize_object(channel),
34
+ 'Routing' => Twilio.serialize_object(routing),
35
+ })
36
+
37
+ payload = @version.create('POST', @uri, data: data)
38
+
39
+ InteractionInstance.new(@version, payload, )
40
+ end
41
+
42
+ ##
43
+ # Provide a user friendly representation
44
+ def to_s
45
+ '#<Twilio.FlexApi.V1.InteractionList>'
46
+ end
47
+ end
48
+
49
+ class InteractionPage < Page
50
+ ##
51
+ # Initialize the InteractionPage
52
+ # @param [Version] version Version that contains the resource
53
+ # @param [Response] response Response from the API
54
+ # @param [Hash] solution Path solution for the resource
55
+ # @return [InteractionPage] InteractionPage
56
+ def initialize(version, response, solution)
57
+ super(version, response)
58
+
59
+ # Path Solution
60
+ @solution = solution
61
+ end
62
+
63
+ ##
64
+ # Build an instance of InteractionInstance
65
+ # @param [Hash] payload Payload response from the API
66
+ # @return [InteractionInstance] InteractionInstance
67
+ def get_instance(payload)
68
+ InteractionInstance.new(@version, payload, )
69
+ end
70
+
71
+ ##
72
+ # Provide a user friendly representation
73
+ def to_s
74
+ '<Twilio.FlexApi.V1.InteractionPage>'
75
+ end
76
+ end
77
+
78
+ class InteractionContext < InstanceContext
79
+ ##
80
+ # Initialize the InteractionContext
81
+ # @param [Version] version Version that contains the resource
82
+ # @param [String] sid The SID of the Interaction resource to fetch.
83
+ # @return [InteractionContext] InteractionContext
84
+ def initialize(version, sid)
85
+ super(version)
86
+
87
+ # Path Solution
88
+ @solution = {sid: sid, }
89
+ @uri = "/Interactions/#{@solution[:sid]}"
90
+
91
+ # Dependents
92
+ @channels = nil
93
+ end
94
+
95
+ ##
96
+ # Fetch the InteractionInstance
97
+ # @return [InteractionInstance] Fetched InteractionInstance
98
+ def fetch
99
+ payload = @version.fetch('GET', @uri)
100
+
101
+ InteractionInstance.new(@version, payload, sid: @solution[:sid], )
102
+ end
103
+
104
+ ##
105
+ # Access the channels
106
+ # @return [InteractionChannelList]
107
+ # @return [InteractionChannelContext] if sid was passed.
108
+ def channels(sid=:unset)
109
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
110
+
111
+ if sid != :unset
112
+ return InteractionChannelContext.new(@version, @solution[:sid], sid, )
113
+ end
114
+
115
+ unless @channels
116
+ @channels = InteractionChannelList.new(@version, interaction_sid: @solution[:sid], )
117
+ end
118
+
119
+ @channels
120
+ end
121
+
122
+ ##
123
+ # Provide a user friendly representation
124
+ def to_s
125
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
126
+ "#<Twilio.FlexApi.V1.InteractionContext #{context}>"
127
+ end
128
+
129
+ ##
130
+ # Provide a detailed, user friendly representation
131
+ def inspect
132
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
133
+ "#<Twilio.FlexApi.V1.InteractionContext #{context}>"
134
+ end
135
+ end
136
+
137
+ class InteractionInstance < InstanceResource
138
+ ##
139
+ # Initialize the InteractionInstance
140
+ # @param [Version] version Version that contains the resource
141
+ # @param [Hash] payload payload that contains response from Twilio
142
+ # @param [String] sid The SID of the Interaction resource to fetch.
143
+ # @return [InteractionInstance] InteractionInstance
144
+ def initialize(version, payload, sid: nil)
145
+ super(version)
146
+
147
+ # Marshaled Properties
148
+ @properties = {
149
+ 'sid' => payload['sid'],
150
+ 'channel' => payload['channel'],
151
+ 'routing' => payload['routing'],
152
+ 'url' => payload['url'],
153
+ 'links' => payload['links'],
154
+ }
155
+
156
+ # Context
157
+ @instance_context = nil
158
+ @params = {'sid' => sid || @properties['sid'], }
159
+ end
160
+
161
+ ##
162
+ # Generate an instance context for the instance, the context is capable of
163
+ # performing various actions. All instance actions are proxied to the context
164
+ # @return [InteractionContext] InteractionContext for this InteractionInstance
165
+ def context
166
+ unless @instance_context
167
+ @instance_context = InteractionContext.new(@version, @params['sid'], )
168
+ end
169
+ @instance_context
170
+ end
171
+
172
+ ##
173
+ # @return [String] The unique string that identifies the resource
174
+ def sid
175
+ @properties['sid']
176
+ end
177
+
178
+ ##
179
+ # @return [Hash] The Interaction's channel
180
+ def channel
181
+ @properties['channel']
182
+ end
183
+
184
+ ##
185
+ # @return [Hash] A JSON Object representing the routing rules for the Interaction Channel
186
+ def routing
187
+ @properties['routing']
188
+ end
189
+
190
+ ##
191
+ # @return [String] The url
192
+ def url
193
+ @properties['url']
194
+ end
195
+
196
+ ##
197
+ # @return [String] The links
198
+ def links
199
+ @properties['links']
200
+ end
201
+
202
+ ##
203
+ # Fetch the InteractionInstance
204
+ # @return [InteractionInstance] Fetched InteractionInstance
205
+ def fetch
206
+ context.fetch
207
+ end
208
+
209
+ ##
210
+ # Access the channels
211
+ # @return [channels] channels
212
+ def channels
213
+ context.channels
214
+ end
215
+
216
+ ##
217
+ # Provide a user friendly representation
218
+ def to_s
219
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
220
+ "<Twilio.FlexApi.V1.InteractionInstance #{values}>"
221
+ end
222
+
223
+ ##
224
+ # Provide a detailed, user friendly representation
225
+ def inspect
226
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
227
+ "<Twilio.FlexApi.V1.InteractionInstance #{values}>"
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
@@ -18,6 +18,7 @@ module Twilio
18
18
  @channel = nil
19
19
  @configuration = nil
20
20
  @flex_flow = nil
21
+ @interaction = nil
21
22
  @web_channel = nil
22
23
  end
23
24
 
@@ -57,6 +58,21 @@ module Twilio
57
58
  end
58
59
  end
59
60
 
61
+ ##
62
+ # @param [String] sid The SID of the Interaction resource to fetch.
63
+ # @return [Twilio::REST::Flex_api::V1::InteractionContext] if sid was passed.
64
+ # @return [Twilio::REST::Flex_api::V1::InteractionList]
65
+ def interaction(sid=:unset)
66
+ if sid.nil?
67
+ raise ArgumentError, 'sid cannot be nil'
68
+ end
69
+ if sid == :unset
70
+ @interaction ||= InteractionList.new self
71
+ else
72
+ InteractionContext.new(self, sid)
73
+ end
74
+ end
75
+
60
76
  ##
61
77
  # @param [String] sid The SID of the WebChannel resource to fetch.
62
78
  # @return [Twilio::REST::Flex_api::V1::WebChannelContext] if sid was passed.
@@ -52,6 +52,15 @@ module Twilio
52
52
  self.v1.flex_flow(sid)
53
53
  end
54
54
 
55
+ ##
56
+ # @param [String] sid The unique string created by Twilio to identify an
57
+ # Interaction resource, prefixed with KD.
58
+ # @return [Twilio::REST::Flex_api::V1::InteractionInstance] if sid was passed.
59
+ # @return [Twilio::REST::Flex_api::V1::InteractionList]
60
+ def interaction(sid=:unset)
61
+ self.v1.interaction(sid)
62
+ end
63
+
55
64
  ##
56
65
  # @param [String] sid The unique string that we created to identify the WebChannel
57
66
  # resource.