twilio-ruby 5.39.2 → 5.40.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +107 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/PULL_REQUEST_TEMPLATE.md +1 -1
  7. data/README.md +4 -3
  8. data/lib/twilio-ruby/framework/version.rb +4 -8
  9. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +12 -3
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +12 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +12 -3
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +12 -3
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +12 -3
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +12 -3
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +12 -3
  17. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -1
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +85 -60
  19. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
  20. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  22. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  23. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +8 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +3 -1
  25. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +2 -1
  26. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +8 -4
  27. data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +11 -4
  28. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +13 -6
  29. data/lib/twilio-ruby/rest/client.rb +7 -0
  30. data/lib/twilio-ruby/rest/conversations.rb +39 -3
  31. data/lib/twilio-ruby/rest/conversations/v1.rb +68 -5
  32. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +268 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +21 -10
  35. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
  36. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +34 -19
  37. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +48 -32
  38. data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
  39. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  40. data/lib/twilio-ruby/rest/conversations/v1/role.rb +374 -0
  41. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  42. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +388 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +271 -0
  44. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +549 -0
  47. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +394 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +519 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +457 -0
  50. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +395 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  53. data/lib/twilio-ruby/rest/events.rb +72 -0
  54. data/lib/twilio-ruby/rest/events/v1.rb +90 -0
  55. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  56. data/lib/twilio-ruby/rest/events/v1/schema.rb +226 -0
  57. data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +290 -0
  58. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  59. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  60. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  61. data/lib/twilio-ruby/rest/events/v1/subscription.rb +383 -0
  62. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +216 -0
  63. data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
  64. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  65. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  66. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  67. data/lib/twilio-ruby/rest/messaging/v1/service.rb +6 -3
  68. data/lib/twilio-ruby/rest/notify/v1/credential.rb +12 -6
  69. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +10 -2
  70. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  71. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  72. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  73. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +10 -5
  74. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +6 -3
  75. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +1 -4
  76. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +3 -1
  77. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  78. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  79. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  80. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  81. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  82. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  83. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  84. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  85. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  86. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  87. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  88. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  89. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  90. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
  91. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  92. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  93. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +6 -2
  94. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +1 -4
  95. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +6 -2
  96. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +38 -23
  97. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -1
  98. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -1
  99. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +201 -0
  100. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  101. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  102. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -2
  103. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -3
  104. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +18 -9
  105. data/lib/twilio-ruby/rest/video/v1/room.rb +2 -1
  106. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  107. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +1 -4
  108. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -1
  109. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  110. data/lib/twilio-ruby/version.rb +1 -1
  111. data/spec/framework/version_spec.rb +53 -0
  112. data/spec/holodeck/holodeck.rb +3 -3
  113. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  114. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  115. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  116. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  117. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  118. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  119. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  120. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  121. data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
  122. data/spec/integration/conversations/v1/configuration_spec.rb +87 -0
  123. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  124. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  125. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  126. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  127. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  128. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  129. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  130. data/spec/integration/conversations/v1/service/configuration/notification_spec.rb +115 -0
  131. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  132. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  133. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  134. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  135. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  136. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  137. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  138. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  139. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  140. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  141. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  142. data/spec/integration/events/v1/schema/schema_version_spec.rb +126 -0
  143. data/spec/integration/events/v1/schema_spec.rb +46 -0
  144. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  145. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  146. data/spec/integration/events/v1/sink_spec.rb +217 -0
  147. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +91 -0
  148. data/spec/integration/events/v1/subscription_spec.rb +243 -0
  149. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  150. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  151. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  152. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  153. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  154. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  155. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  156. data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
  157. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  158. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  159. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  160. data/spec/integration/video/v1/room_spec.rb +37 -0
  161. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  162. data/spec/spec_helper.rb +1 -1
  163. metadata +82 -5
  164. data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -0,0 +1,388 @@
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 ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class BindingList < ListResource
17
+ ##
18
+ # Initialize the BindingList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] chat_service_sid The SID of the [Conversation
21
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
22
+ # Binding resource is associated with.
23
+ # @return [BindingList] BindingList
24
+ def initialize(version, chat_service_sid: nil)
25
+ super(version)
26
+
27
+ # Path Solution
28
+ @solution = {chat_service_sid: chat_service_sid}
29
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Bindings"
30
+ end
31
+
32
+ ##
33
+ # Lists BindingInstance records from the API as a list.
34
+ # Unlike stream(), this operation is eager and will load `limit` records into
35
+ # memory before returning.
36
+ # @param [binding.BindingType] binding_type The push technology used by the
37
+ # Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push
38
+ # notification
39
+ # configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
40
+ # for more info.
41
+ # @param [String] identity The identity of a [Conversation
42
+ # User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
43
+ # belongs to. See [access
44
+ # tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
45
+ # details.
46
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
47
+ # guarantees to never return more than limit. Default is no limit
48
+ # @param [Integer] page_size Number of records to fetch per request, when
49
+ # not set will use the default value of 50 records. If no page_size is defined
50
+ # but a limit is defined, stream() will attempt to read the limit with the most
51
+ # efficient page size, i.e. min(limit, 1000)
52
+ # @return [Array] Array of up to limit results
53
+ def list(binding_type: :unset, identity: :unset, limit: nil, page_size: nil)
54
+ self.stream(
55
+ binding_type: binding_type,
56
+ identity: identity,
57
+ limit: limit,
58
+ page_size: page_size
59
+ ).entries
60
+ end
61
+
62
+ ##
63
+ # Streams BindingInstance records from the API as an Enumerable.
64
+ # This operation lazily loads records as efficiently as possible until the limit
65
+ # is reached.
66
+ # @param [binding.BindingType] binding_type The push technology used by the
67
+ # Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push
68
+ # notification
69
+ # configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
70
+ # for more info.
71
+ # @param [String] identity The identity of a [Conversation
72
+ # User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
73
+ # belongs to. See [access
74
+ # tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
75
+ # details.
76
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
77
+ # guarantees to never return more than limit. Default is no limit.
78
+ # @param [Integer] page_size Number of records to fetch per request, when
79
+ # not set will use the default value of 50 records. If no page_size is defined
80
+ # but a limit is defined, stream() will attempt to read the limit with the most
81
+ # efficient page size, i.e. min(limit, 1000)
82
+ # @return [Enumerable] Enumerable that will yield up to limit results
83
+ def stream(binding_type: :unset, identity: :unset, limit: nil, page_size: nil)
84
+ limits = @version.read_limits(limit, page_size)
85
+
86
+ page = self.page(binding_type: binding_type, identity: identity, page_size: limits[:page_size], )
87
+
88
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
89
+ end
90
+
91
+ ##
92
+ # When passed a block, yields BindingInstance records from the API.
93
+ # This operation lazily loads records as efficiently as possible until the limit
94
+ # is reached.
95
+ def each
96
+ limits = @version.read_limits
97
+
98
+ page = self.page(page_size: limits[:page_size], )
99
+
100
+ @version.stream(page,
101
+ limit: limits[:limit],
102
+ page_limit: limits[:page_limit]).each {|x| yield x}
103
+ end
104
+
105
+ ##
106
+ # Retrieve a single page of BindingInstance records from the API.
107
+ # Request is executed immediately.
108
+ # @param [binding.BindingType] binding_type The push technology used by the
109
+ # Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push
110
+ # notification
111
+ # configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
112
+ # for more info.
113
+ # @param [String] identity The identity of a [Conversation
114
+ # User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
115
+ # belongs to. See [access
116
+ # tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
117
+ # details.
118
+ # @param [String] page_token PageToken provided by the API
119
+ # @param [Integer] page_number Page Number, this value is simply for client state
120
+ # @param [Integer] page_size Number of records to return, defaults to 50
121
+ # @return [Page] Page of BindingInstance
122
+ def page(binding_type: :unset, identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
123
+ params = Twilio::Values.of({
124
+ 'BindingType' => Twilio.serialize_list(binding_type) { |e| e },
125
+ 'Identity' => Twilio.serialize_list(identity) { |e| e },
126
+ 'PageToken' => page_token,
127
+ 'Page' => page_number,
128
+ 'PageSize' => page_size,
129
+ })
130
+
131
+ response = @version.page('GET', @uri, params: params)
132
+
133
+ BindingPage.new(@version, response, @solution)
134
+ end
135
+
136
+ ##
137
+ # Retrieve a single page of BindingInstance records from the API.
138
+ # Request is executed immediately.
139
+ # @param [String] target_url API-generated URL for the requested results page
140
+ # @return [Page] Page of BindingInstance
141
+ def get_page(target_url)
142
+ response = @version.domain.request(
143
+ 'GET',
144
+ target_url
145
+ )
146
+ BindingPage.new(@version, response, @solution)
147
+ end
148
+
149
+ ##
150
+ # Provide a user friendly representation
151
+ def to_s
152
+ '#<Twilio.Conversations.V1.BindingList>'
153
+ end
154
+ end
155
+
156
+ ##
157
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
158
+ class BindingPage < Page
159
+ ##
160
+ # Initialize the BindingPage
161
+ # @param [Version] version Version that contains the resource
162
+ # @param [Response] response Response from the API
163
+ # @param [Hash] solution Path solution for the resource
164
+ # @return [BindingPage] BindingPage
165
+ def initialize(version, response, solution)
166
+ super(version, response)
167
+
168
+ # Path Solution
169
+ @solution = solution
170
+ end
171
+
172
+ ##
173
+ # Build an instance of BindingInstance
174
+ # @param [Hash] payload Payload response from the API
175
+ # @return [BindingInstance] BindingInstance
176
+ def get_instance(payload)
177
+ BindingInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
178
+ end
179
+
180
+ ##
181
+ # Provide a user friendly representation
182
+ def to_s
183
+ '<Twilio.Conversations.V1.BindingPage>'
184
+ end
185
+ end
186
+
187
+ ##
188
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
189
+ class BindingContext < InstanceContext
190
+ ##
191
+ # Initialize the BindingContext
192
+ # @param [Version] version Version that contains the resource
193
+ # @param [String] chat_service_sid The SID of the [Conversation
194
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
195
+ # Binding resource is associated with.
196
+ # @param [String] sid A 34 character string that uniquely identifies this
197
+ # resource.
198
+ # @return [BindingContext] BindingContext
199
+ def initialize(version, chat_service_sid, sid)
200
+ super(version)
201
+
202
+ # Path Solution
203
+ @solution = {chat_service_sid: chat_service_sid, sid: sid, }
204
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Bindings/#{@solution[:sid]}"
205
+ end
206
+
207
+ ##
208
+ # Delete the BindingInstance
209
+ # @return [Boolean] true if delete succeeds, false otherwise
210
+ def delete
211
+ @version.delete('DELETE', @uri)
212
+ end
213
+
214
+ ##
215
+ # Fetch the BindingInstance
216
+ # @return [BindingInstance] Fetched BindingInstance
217
+ def fetch
218
+ payload = @version.fetch('GET', @uri)
219
+
220
+ BindingInstance.new(
221
+ @version,
222
+ payload,
223
+ chat_service_sid: @solution[:chat_service_sid],
224
+ sid: @solution[:sid],
225
+ )
226
+ end
227
+
228
+ ##
229
+ # Provide a user friendly representation
230
+ def to_s
231
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
232
+ "#<Twilio.Conversations.V1.BindingContext #{context}>"
233
+ end
234
+
235
+ ##
236
+ # Provide a detailed, user friendly representation
237
+ def inspect
238
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
239
+ "#<Twilio.Conversations.V1.BindingContext #{context}>"
240
+ end
241
+ end
242
+
243
+ ##
244
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
245
+ class BindingInstance < InstanceResource
246
+ ##
247
+ # Initialize the BindingInstance
248
+ # @param [Version] version Version that contains the resource
249
+ # @param [Hash] payload payload that contains response from Twilio
250
+ # @param [String] chat_service_sid The SID of the [Conversation
251
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
252
+ # Binding resource is associated with.
253
+ # @param [String] sid A 34 character string that uniquely identifies this
254
+ # resource.
255
+ # @return [BindingInstance] BindingInstance
256
+ def initialize(version, payload, chat_service_sid: nil, sid: nil)
257
+ super(version)
258
+
259
+ # Marshaled Properties
260
+ @properties = {
261
+ 'sid' => payload['sid'],
262
+ 'account_sid' => payload['account_sid'],
263
+ 'chat_service_sid' => payload['chat_service_sid'],
264
+ 'credential_sid' => payload['credential_sid'],
265
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
266
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
267
+ 'endpoint' => payload['endpoint'],
268
+ 'identity' => payload['identity'],
269
+ 'binding_type' => payload['binding_type'],
270
+ 'message_types' => payload['message_types'],
271
+ 'url' => payload['url'],
272
+ }
273
+
274
+ # Context
275
+ @instance_context = nil
276
+ @params = {'chat_service_sid' => chat_service_sid, 'sid' => sid || @properties['sid'], }
277
+ end
278
+
279
+ ##
280
+ # Generate an instance context for the instance, the context is capable of
281
+ # performing various actions. All instance actions are proxied to the context
282
+ # @return [BindingContext] BindingContext for this BindingInstance
283
+ def context
284
+ unless @instance_context
285
+ @instance_context = BindingContext.new(@version, @params['chat_service_sid'], @params['sid'], )
286
+ end
287
+ @instance_context
288
+ end
289
+
290
+ ##
291
+ # @return [String] A 34 character string that uniquely identifies this resource.
292
+ def sid
293
+ @properties['sid']
294
+ end
295
+
296
+ ##
297
+ # @return [String] The unique ID of the Account responsible for this binding.
298
+ def account_sid
299
+ @properties['account_sid']
300
+ end
301
+
302
+ ##
303
+ # @return [String] The SID of the Conversation Service that the resource is associated with.
304
+ def chat_service_sid
305
+ @properties['chat_service_sid']
306
+ end
307
+
308
+ ##
309
+ # @return [String] The SID of the Credential for the binding.
310
+ def credential_sid
311
+ @properties['credential_sid']
312
+ end
313
+
314
+ ##
315
+ # @return [Time] The date that this resource was created.
316
+ def date_created
317
+ @properties['date_created']
318
+ end
319
+
320
+ ##
321
+ # @return [Time] The date that this resource was last updated.
322
+ def date_updated
323
+ @properties['date_updated']
324
+ end
325
+
326
+ ##
327
+ # @return [String] The unique endpoint identifier for the Binding.
328
+ def endpoint
329
+ @properties['endpoint']
330
+ end
331
+
332
+ ##
333
+ # @return [String] The identity of Conversation User associated with this binding.
334
+ def identity
335
+ @properties['identity']
336
+ end
337
+
338
+ ##
339
+ # @return [binding.BindingType] The push technology to use for the binding.
340
+ def binding_type
341
+ @properties['binding_type']
342
+ end
343
+
344
+ ##
345
+ # @return [String] The Conversation message types the binding is subscribed to.
346
+ def message_types
347
+ @properties['message_types']
348
+ end
349
+
350
+ ##
351
+ # @return [String] An absolute URL for this binding.
352
+ def url
353
+ @properties['url']
354
+ end
355
+
356
+ ##
357
+ # Delete the BindingInstance
358
+ # @return [Boolean] true if delete succeeds, false otherwise
359
+ def delete
360
+ context.delete
361
+ end
362
+
363
+ ##
364
+ # Fetch the BindingInstance
365
+ # @return [BindingInstance] Fetched BindingInstance
366
+ def fetch
367
+ context.fetch
368
+ end
369
+
370
+ ##
371
+ # Provide a user friendly representation
372
+ def to_s
373
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
374
+ "<Twilio.Conversations.V1.BindingInstance #{values}>"
375
+ end
376
+
377
+ ##
378
+ # Provide a detailed, user friendly representation
379
+ def inspect
380
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
381
+ "<Twilio.Conversations.V1.BindingInstance #{values}>"
382
+ end
383
+ end
384
+ end
385
+ end
386
+ end
387
+ end
388
+ end
@@ -0,0 +1,271 @@
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 ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class ConfigurationList < ListResource
17
+ ##
18
+ # Initialize the ConfigurationList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] chat_service_sid The unique string that we created to identify
21
+ # the Service configuration resource.
22
+ # @return [ConfigurationList] ConfigurationList
23
+ def initialize(version, chat_service_sid: nil)
24
+ super(version)
25
+
26
+ # Path Solution
27
+ @solution = {chat_service_sid: chat_service_sid}
28
+ end
29
+
30
+ ##
31
+ # Provide a user friendly representation
32
+ def to_s
33
+ '#<Twilio.Conversations.V1.ConfigurationList>'
34
+ end
35
+ end
36
+
37
+ ##
38
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
39
+ class ConfigurationPage < Page
40
+ ##
41
+ # Initialize the ConfigurationPage
42
+ # @param [Version] version Version that contains the resource
43
+ # @param [Response] response Response from the API
44
+ # @param [Hash] solution Path solution for the resource
45
+ # @return [ConfigurationPage] ConfigurationPage
46
+ def initialize(version, response, solution)
47
+ super(version, response)
48
+
49
+ # Path Solution
50
+ @solution = solution
51
+ end
52
+
53
+ ##
54
+ # Build an instance of ConfigurationInstance
55
+ # @param [Hash] payload Payload response from the API
56
+ # @return [ConfigurationInstance] ConfigurationInstance
57
+ def get_instance(payload)
58
+ ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
59
+ end
60
+
61
+ ##
62
+ # Provide a user friendly representation
63
+ def to_s
64
+ '<Twilio.Conversations.V1.ConfigurationPage>'
65
+ end
66
+ end
67
+
68
+ ##
69
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
70
+ class ConfigurationContext < InstanceContext
71
+ ##
72
+ # Initialize the ConfigurationContext
73
+ # @param [Version] version Version that contains the resource
74
+ # @param [String] chat_service_sid The SID of the Service configuration resource
75
+ # to fetch.
76
+ # @return [ConfigurationContext] ConfigurationContext
77
+ def initialize(version, chat_service_sid)
78
+ super(version)
79
+
80
+ # Path Solution
81
+ @solution = {chat_service_sid: chat_service_sid, }
82
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration"
83
+
84
+ # Components
85
+ @notifications = nil
86
+ end
87
+
88
+ ##
89
+ # Fetch the ConfigurationInstance
90
+ # @return [ConfigurationInstance] Fetched ConfigurationInstance
91
+ def fetch
92
+ payload = @version.fetch('GET', @uri)
93
+
94
+ ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
95
+ end
96
+
97
+ ##
98
+ # Update the ConfigurationInstance
99
+ # @param [String] default_conversation_creator_role_sid The conversation-level
100
+ # role assigned to a conversation creator when they join a new conversation. See
101
+ # the [Conversation
102
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
103
+ # about roles.
104
+ # @param [String] default_conversation_role_sid The conversation-level role
105
+ # assigned to users when they are added to a conversation. See the [Conversation
106
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
107
+ # about roles.
108
+ # @param [String] default_chat_service_role_sid The service-level role assigned to
109
+ # users when they are added to the service. See the [Conversation
110
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
111
+ # about roles.
112
+ # @return [ConfigurationInstance] Updated ConfigurationInstance
113
+ def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
114
+ data = Twilio::Values.of({
115
+ 'DefaultConversationCreatorRoleSid' => default_conversation_creator_role_sid,
116
+ 'DefaultConversationRoleSid' => default_conversation_role_sid,
117
+ 'DefaultChatServiceRoleSid' => default_chat_service_role_sid,
118
+ })
119
+
120
+ payload = @version.update('POST', @uri, data: data)
121
+
122
+ ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
123
+ end
124
+
125
+ ##
126
+ # Access the notifications
127
+ # @return [NotificationContext] NotificationContext
128
+ def notifications
129
+ return NotificationContext.new(@version, @solution[:chat_service_sid], )
130
+ end
131
+
132
+ ##
133
+ # Provide a user friendly representation
134
+ def to_s
135
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
136
+ "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
137
+ end
138
+
139
+ ##
140
+ # Provide a detailed, user friendly representation
141
+ def inspect
142
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
143
+ "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
144
+ end
145
+ end
146
+
147
+ ##
148
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
149
+ class ConfigurationInstance < InstanceResource
150
+ ##
151
+ # Initialize the ConfigurationInstance
152
+ # @param [Version] version Version that contains the resource
153
+ # @param [Hash] payload payload that contains response from Twilio
154
+ # @param [String] chat_service_sid The unique string that we created to identify
155
+ # the Service configuration resource.
156
+ # @return [ConfigurationInstance] ConfigurationInstance
157
+ def initialize(version, payload, chat_service_sid: nil)
158
+ super(version)
159
+
160
+ # Marshaled Properties
161
+ @properties = {
162
+ 'chat_service_sid' => payload['chat_service_sid'],
163
+ 'default_conversation_creator_role_sid' => payload['default_conversation_creator_role_sid'],
164
+ 'default_conversation_role_sid' => payload['default_conversation_role_sid'],
165
+ 'default_chat_service_role_sid' => payload['default_chat_service_role_sid'],
166
+ 'url' => payload['url'],
167
+ 'links' => payload['links'],
168
+ }
169
+
170
+ # Context
171
+ @instance_context = nil
172
+ @params = {'chat_service_sid' => chat_service_sid, }
173
+ end
174
+
175
+ ##
176
+ # Generate an instance context for the instance, the context is capable of
177
+ # performing various actions. All instance actions are proxied to the context
178
+ # @return [ConfigurationContext] ConfigurationContext for this ConfigurationInstance
179
+ def context
180
+ unless @instance_context
181
+ @instance_context = ConfigurationContext.new(@version, @params['chat_service_sid'], )
182
+ end
183
+ @instance_context
184
+ end
185
+
186
+ ##
187
+ # @return [String] The unique string that identifies the resource
188
+ def chat_service_sid
189
+ @properties['chat_service_sid']
190
+ end
191
+
192
+ ##
193
+ # @return [String] The role assigned to a conversation creator user when they join a new conversation
194
+ def default_conversation_creator_role_sid
195
+ @properties['default_conversation_creator_role_sid']
196
+ end
197
+
198
+ ##
199
+ # @return [String] The role assigned to users when they are added to a conversation
200
+ def default_conversation_role_sid
201
+ @properties['default_conversation_role_sid']
202
+ end
203
+
204
+ ##
205
+ # @return [String] The service role assigned to users when they are added to the service
206
+ def default_chat_service_role_sid
207
+ @properties['default_chat_service_role_sid']
208
+ end
209
+
210
+ ##
211
+ # @return [String] The absolute URL of the Service configuration resource
212
+ def url
213
+ @properties['url']
214
+ end
215
+
216
+ ##
217
+ # @return [String] Absolute URL to access the Push Notifications configuration of this Service.
218
+ def links
219
+ @properties['links']
220
+ end
221
+
222
+ ##
223
+ # Fetch the ConfigurationInstance
224
+ # @return [ConfigurationInstance] Fetched ConfigurationInstance
225
+ def fetch
226
+ context.fetch
227
+ end
228
+
229
+ ##
230
+ # Update the ConfigurationInstance
231
+ # @param [String] default_conversation_creator_role_sid The conversation-level
232
+ # role assigned to a conversation creator when they join a new conversation. See
233
+ # the [Conversation
234
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
235
+ # about roles.
236
+ # @param [String] default_conversation_role_sid The conversation-level role
237
+ # assigned to users when they are added to a conversation. See the [Conversation
238
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
239
+ # about roles.
240
+ # @param [String] default_chat_service_role_sid The service-level role assigned to
241
+ # users when they are added to the service. See the [Conversation
242
+ # Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
243
+ # about roles.
244
+ # @return [ConfigurationInstance] Updated ConfigurationInstance
245
+ def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
246
+ context.update(
247
+ default_conversation_creator_role_sid: default_conversation_creator_role_sid,
248
+ default_conversation_role_sid: default_conversation_role_sid,
249
+ default_chat_service_role_sid: default_chat_service_role_sid,
250
+ )
251
+ end
252
+
253
+ ##
254
+ # Provide a user friendly representation
255
+ def to_s
256
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
257
+ "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
258
+ end
259
+
260
+ ##
261
+ # Provide a detailed, user friendly representation
262
+ def inspect
263
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
264
+ "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
271
+ end