twilio-ruby 5.46.0 → 5.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +112 -0
  3. data/README.md +20 -6
  4. data/lib/twilio-ruby/rest/api.rb +1 -1
  5. data/lib/twilio-ruby/rest/api/v2010.rb +5 -4
  6. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +10 -1
  7. data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +4 -4
  8. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +4 -4
  9. data/lib/twilio-ruby/rest/autopilot/v1.rb +5 -4
  10. data/lib/twilio-ruby/rest/bulkexports/v1.rb +10 -8
  11. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +14 -0
  12. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +14 -0
  13. data/lib/twilio-ruby/rest/chat/v1.rb +10 -8
  14. data/lib/twilio-ruby/rest/chat/v2.rb +10 -8
  15. data/lib/twilio-ruby/rest/client.rb +8 -1
  16. data/lib/twilio-ruby/rest/conversations/v1.rb +25 -20
  17. data/lib/twilio-ruby/rest/events/v1.rb +20 -16
  18. data/lib/twilio-ruby/rest/events/v1/event_type.rb +4 -4
  19. data/lib/twilio-ruby/rest/events/v1/schema.rb +4 -4
  20. data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +4 -4
  21. data/lib/twilio-ruby/rest/events/v1/sink.rb +6 -5
  22. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +3 -3
  23. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +3 -3
  24. data/lib/twilio-ruby/rest/events/v1/subscription.rb +15 -8
  25. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +133 -6
  26. data/lib/twilio-ruby/rest/fax/v1.rb +5 -4
  27. data/lib/twilio-ruby/rest/flex_api/v1.rb +15 -12
  28. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  29. data/lib/twilio-ruby/rest/insights.rb +1 -1
  30. data/lib/twilio-ruby/rest/insights/v1.rb +11 -9
  31. data/lib/twilio-ruby/rest/insights/v1/room.rb +55 -43
  32. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +22 -22
  33. data/lib/twilio-ruby/rest/ip_messaging/v1.rb +10 -8
  34. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +10 -8
  35. data/lib/twilio-ruby/rest/lookups/v1.rb +5 -4
  36. data/lib/twilio-ruby/rest/messaging.rb +8 -0
  37. data/lib/twilio-ruby/rest/messaging/v1.rb +21 -4
  38. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +328 -0
  39. data/lib/twilio-ruby/rest/monitor/v1.rb +10 -8
  40. data/lib/twilio-ruby/rest/notify/v1.rb +10 -8
  41. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +10 -8
  42. data/lib/twilio-ruby/rest/preview/deployed_devices.rb +5 -4
  43. data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +10 -8
  44. data/lib/twilio-ruby/rest/preview/marketplace.rb +10 -8
  45. data/lib/twilio-ruby/rest/preview/sync.rb +5 -4
  46. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +4 -8
  47. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +5 -4
  48. data/lib/twilio-ruby/rest/preview/understand.rb +5 -4
  49. data/lib/twilio-ruby/rest/preview/wireless.rb +15 -12
  50. data/lib/twilio-ruby/rest/proxy/v1.rb +5 -4
  51. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +1 -1
  52. data/lib/twilio-ruby/rest/serverless/v1.rb +5 -4
  53. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +11 -1
  54. data/lib/twilio-ruby/rest/studio/v1.rb +5 -4
  55. data/lib/twilio-ruby/rest/studio/v2.rb +5 -4
  56. data/lib/twilio-ruby/rest/studio/v2/flow.rb +4 -12
  57. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +0 -8
  58. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +0 -8
  59. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +0 -8
  60. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +0 -8
  61. data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +1 -9
  62. data/lib/twilio-ruby/rest/studio/v2/flow/test_user.rb +10 -16
  63. data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +6 -11
  64. data/lib/twilio-ruby/rest/supersim.rb +9 -0
  65. data/lib/twilio-ruby/rest/supersim/v1.rb +41 -20
  66. data/lib/twilio-ruby/rest/supersim/v1/command.rb +4 -4
  67. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +86 -13
  68. data/lib/twilio-ruby/rest/supersim/v1/network.rb +4 -4
  69. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +4 -4
  70. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +4 -4
  71. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +4 -4
  72. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +371 -0
  73. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +3 -3
  74. data/lib/twilio-ruby/rest/sync/v1.rb +5 -4
  75. data/lib/twilio-ruby/rest/sync/v1/service.rb +0 -8
  76. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +13 -32
  77. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +0 -8
  78. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +9 -23
  79. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +38 -45
  80. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +0 -8
  81. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +9 -23
  82. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +38 -47
  83. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +0 -8
  84. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +9 -23
  85. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +0 -6
  86. data/lib/twilio-ruby/rest/taskrouter/v1.rb +5 -4
  87. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +12 -8
  88. data/lib/twilio-ruby/rest/trunking/v1.rb +5 -4
  89. data/lib/twilio-ruby/rest/trusthub.rb +100 -0
  90. data/lib/twilio-ruby/rest/trusthub/v1.rb +146 -0
  91. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +523 -0
  92. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +359 -0
  93. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb +330 -0
  94. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb +328 -0
  95. data/lib/twilio-ruby/rest/trusthub/v1/end_user.rb +356 -0
  96. data/lib/twilio-ruby/rest/trusthub/v1/end_user_type.rb +271 -0
  97. data/lib/twilio-ruby/rest/trusthub/v1/policies.rb +262 -0
  98. data/lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb +369 -0
  99. data/lib/twilio-ruby/rest/trusthub/v1/supporting_document_type.rb +271 -0
  100. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +523 -0
  101. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +359 -0
  102. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb +330 -0
  103. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb +328 -0
  104. data/lib/twilio-ruby/rest/verify.rb +9 -0
  105. data/lib/twilio-ruby/rest/verify/v2.rb +26 -8
  106. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +4 -3
  107. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +64 -13
  108. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +329 -0
  109. data/lib/twilio-ruby/rest/video/v1.rb +20 -16
  110. data/lib/twilio-ruby/rest/video/v1/room.rb +4 -1
  111. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +0 -6
  112. data/lib/twilio-ruby/rest/voice/v1.rb +20 -16
  113. data/lib/twilio-ruby/rest/wireless/v1.rb +15 -12
  114. data/lib/twilio-ruby/twiml/voice_response.rb +38 -8
  115. data/lib/twilio-ruby/version.rb +1 -1
  116. data/spec/integration/api/v2010/account/conference_spec.rb +302 -44
  117. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +4 -16
  118. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  119. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +6 -2
  120. data/spec/integration/bulkexports/v1/export/job_spec.rb +3 -1
  121. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +134 -0
  122. data/spec/integration/flex_api/v1/configuration_spec.rb +24 -0
  123. data/spec/integration/messaging/v1/brand_registration_spec.rb +143 -0
  124. data/spec/integration/preview/sync/service/document_spec.rb +1 -3
  125. data/spec/integration/serverless/v1/service/build_spec.rb +12 -2
  126. data/spec/integration/supersim/v1/fleet_spec.rb +20 -0
  127. data/spec/integration/supersim/v1/sms_command_spec.rb +184 -0
  128. data/spec/integration/sync/v1/service/document_spec.rb +1 -3
  129. data/spec/integration/taskrouter/v1/workspace/task_spec.rb +3 -1
  130. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment_spec.rb +192 -0
  131. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_entity_assignments_spec.rb +186 -0
  132. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_evaluations_spec.rb +615 -0
  133. data/spec/integration/trusthub/v1/customer_profiles_spec.rb +255 -0
  134. data/spec/integration/trusthub/v1/end_user_spec.rb +247 -0
  135. data/spec/integration/trusthub/v1/end_user_type_spec.rb +176 -0
  136. data/spec/integration/trusthub/v1/policies_spec.rb +252 -0
  137. data/spec/integration/trusthub/v1/supporting_document_spec.rb +235 -0
  138. data/spec/integration/trusthub/v1/supporting_document_type_spec.rb +159 -0
  139. data/spec/integration/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment_spec.rb +192 -0
  140. data/spec/integration/trusthub/v1/trust_products/trust_products_entity_assignments_spec.rb +186 -0
  141. data/spec/integration/trusthub/v1/trust_products/trust_products_evaluations_spec.rb +615 -0
  142. data/spec/integration/trusthub/v1/trust_products_spec.rb +255 -0
  143. data/spec/integration/verify/v2/service/entity/factor_spec.rb +3 -3
  144. data/spec/integration/verify/v2/verification_attempt_spec.rb +146 -0
  145. data/spec/integration/video/v1/room_spec.rb +39 -0
  146. metadata +52 -2
@@ -0,0 +1,359 @@
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 Trusthub < Domain
12
+ class V1 < Version
13
+ class CustomerProfilesContext < InstanceContext
14
+ class CustomerProfilesChannelEndpointAssignmentList < ListResource
15
+ ##
16
+ # Initialize the CustomerProfilesChannelEndpointAssignmentList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] customer_profile_sid The unique string that we created to
19
+ # identify the CustomerProfile resource.
20
+ # @return [CustomerProfilesChannelEndpointAssignmentList] CustomerProfilesChannelEndpointAssignmentList
21
+ def initialize(version, customer_profile_sid: nil)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {customer_profile_sid: customer_profile_sid}
26
+ @uri = "/CustomerProfiles/#{@solution[:customer_profile_sid]}/ChannelEndpointAssignments"
27
+ end
28
+
29
+ ##
30
+ # Create the CustomerProfilesChannelEndpointAssignmentInstance
31
+ # @param [String] channel_endpoint_type The type of channel endpoint. eg:
32
+ # phone-number
33
+ # @param [String] channel_endpoint_sid The SID of an channel endpoint
34
+ # @return [CustomerProfilesChannelEndpointAssignmentInstance] Created CustomerProfilesChannelEndpointAssignmentInstance
35
+ def create(channel_endpoint_type: nil, channel_endpoint_sid: nil)
36
+ data = Twilio::Values.of({
37
+ 'ChannelEndpointType' => channel_endpoint_type,
38
+ 'ChannelEndpointSid' => channel_endpoint_sid,
39
+ })
40
+
41
+ payload = @version.create('POST', @uri, data: data)
42
+
43
+ CustomerProfilesChannelEndpointAssignmentInstance.new(
44
+ @version,
45
+ payload,
46
+ customer_profile_sid: @solution[:customer_profile_sid],
47
+ )
48
+ end
49
+
50
+ ##
51
+ # Lists CustomerProfilesChannelEndpointAssignmentInstance records from the API as a list.
52
+ # Unlike stream(), this operation is eager and will load `limit` records into
53
+ # memory before returning.
54
+ # @param [String] channel_endpoint_sid The SID of an channel endpoint
55
+ # @param [String] channel_endpoint_sids comma separated list of channel endpoint
56
+ # sids
57
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
58
+ # guarantees to never return more than limit. Default is no limit
59
+ # @param [Integer] page_size Number of records to fetch per request, when
60
+ # not set will use the default value of 50 records. If no page_size is defined
61
+ # but a limit is defined, stream() will attempt to read the limit with the most
62
+ # efficient page size, i.e. min(limit, 1000)
63
+ # @return [Array] Array of up to limit results
64
+ def list(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil)
65
+ self.stream(
66
+ channel_endpoint_sid: channel_endpoint_sid,
67
+ channel_endpoint_sids: channel_endpoint_sids,
68
+ limit: limit,
69
+ page_size: page_size
70
+ ).entries
71
+ end
72
+
73
+ ##
74
+ # Streams CustomerProfilesChannelEndpointAssignmentInstance records from the API as an Enumerable.
75
+ # This operation lazily loads records as efficiently as possible until the limit
76
+ # is reached.
77
+ # @param [String] channel_endpoint_sid The SID of an channel endpoint
78
+ # @param [String] channel_endpoint_sids comma separated list of channel endpoint
79
+ # sids
80
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
81
+ # guarantees to never return more than limit. Default is no limit.
82
+ # @param [Integer] page_size Number of records to fetch per request, when
83
+ # not set will use the default value of 50 records. If no page_size is defined
84
+ # but a limit is defined, stream() will attempt to read the limit with the most
85
+ # efficient page size, i.e. min(limit, 1000)
86
+ # @return [Enumerable] Enumerable that will yield up to limit results
87
+ def stream(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil)
88
+ limits = @version.read_limits(limit, page_size)
89
+
90
+ page = self.page(
91
+ channel_endpoint_sid: channel_endpoint_sid,
92
+ channel_endpoint_sids: channel_endpoint_sids,
93
+ page_size: limits[:page_size],
94
+ )
95
+
96
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
97
+ end
98
+
99
+ ##
100
+ # When passed a block, yields CustomerProfilesChannelEndpointAssignmentInstance records from the API.
101
+ # This operation lazily loads records as efficiently as possible until the limit
102
+ # is reached.
103
+ def each
104
+ limits = @version.read_limits
105
+
106
+ page = self.page(page_size: limits[:page_size], )
107
+
108
+ @version.stream(page,
109
+ limit: limits[:limit],
110
+ page_limit: limits[:page_limit]).each {|x| yield x}
111
+ end
112
+
113
+ ##
114
+ # Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
115
+ # Request is executed immediately.
116
+ # @param [String] channel_endpoint_sid The SID of an channel endpoint
117
+ # @param [String] channel_endpoint_sids comma separated list of channel endpoint
118
+ # sids
119
+ # @param [String] page_token PageToken provided by the API
120
+ # @param [Integer] page_number Page Number, this value is simply for client state
121
+ # @param [Integer] page_size Number of records to return, defaults to 50
122
+ # @return [Page] Page of CustomerProfilesChannelEndpointAssignmentInstance
123
+ def page(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
124
+ params = Twilio::Values.of({
125
+ 'ChannelEndpointSid' => channel_endpoint_sid,
126
+ 'ChannelEndpointSids' => channel_endpoint_sids,
127
+ 'PageToken' => page_token,
128
+ 'Page' => page_number,
129
+ 'PageSize' => page_size,
130
+ })
131
+
132
+ response = @version.page('GET', @uri, params: params)
133
+
134
+ CustomerProfilesChannelEndpointAssignmentPage.new(@version, response, @solution)
135
+ end
136
+
137
+ ##
138
+ # Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
139
+ # Request is executed immediately.
140
+ # @param [String] target_url API-generated URL for the requested results page
141
+ # @return [Page] Page of CustomerProfilesChannelEndpointAssignmentInstance
142
+ def get_page(target_url)
143
+ response = @version.domain.request(
144
+ 'GET',
145
+ target_url
146
+ )
147
+ CustomerProfilesChannelEndpointAssignmentPage.new(@version, response, @solution)
148
+ end
149
+
150
+ ##
151
+ # Provide a user friendly representation
152
+ def to_s
153
+ '#<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentList>'
154
+ end
155
+ end
156
+
157
+ class CustomerProfilesChannelEndpointAssignmentPage < Page
158
+ ##
159
+ # Initialize the CustomerProfilesChannelEndpointAssignmentPage
160
+ # @param [Version] version Version that contains the resource
161
+ # @param [Response] response Response from the API
162
+ # @param [Hash] solution Path solution for the resource
163
+ # @return [CustomerProfilesChannelEndpointAssignmentPage] CustomerProfilesChannelEndpointAssignmentPage
164
+ def initialize(version, response, solution)
165
+ super(version, response)
166
+
167
+ # Path Solution
168
+ @solution = solution
169
+ end
170
+
171
+ ##
172
+ # Build an instance of CustomerProfilesChannelEndpointAssignmentInstance
173
+ # @param [Hash] payload Payload response from the API
174
+ # @return [CustomerProfilesChannelEndpointAssignmentInstance] CustomerProfilesChannelEndpointAssignmentInstance
175
+ def get_instance(payload)
176
+ CustomerProfilesChannelEndpointAssignmentInstance.new(
177
+ @version,
178
+ payload,
179
+ customer_profile_sid: @solution[:customer_profile_sid],
180
+ )
181
+ end
182
+
183
+ ##
184
+ # Provide a user friendly representation
185
+ def to_s
186
+ '<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentPage>'
187
+ end
188
+ end
189
+
190
+ class CustomerProfilesChannelEndpointAssignmentContext < InstanceContext
191
+ ##
192
+ # Initialize the CustomerProfilesChannelEndpointAssignmentContext
193
+ # @param [Version] version Version that contains the resource
194
+ # @param [String] customer_profile_sid The unique string that we created to
195
+ # identify the CustomerProfile resource.
196
+ # @param [String] sid The unique string that we created to identify the resource.
197
+ # @return [CustomerProfilesChannelEndpointAssignmentContext] CustomerProfilesChannelEndpointAssignmentContext
198
+ def initialize(version, customer_profile_sid, sid)
199
+ super(version)
200
+
201
+ # Path Solution
202
+ @solution = {customer_profile_sid: customer_profile_sid, sid: sid, }
203
+ @uri = "/CustomerProfiles/#{@solution[:customer_profile_sid]}/ChannelEndpointAssignments/#{@solution[:sid]}"
204
+ end
205
+
206
+ ##
207
+ # Fetch the CustomerProfilesChannelEndpointAssignmentInstance
208
+ # @return [CustomerProfilesChannelEndpointAssignmentInstance] Fetched CustomerProfilesChannelEndpointAssignmentInstance
209
+ def fetch
210
+ payload = @version.fetch('GET', @uri)
211
+
212
+ CustomerProfilesChannelEndpointAssignmentInstance.new(
213
+ @version,
214
+ payload,
215
+ customer_profile_sid: @solution[:customer_profile_sid],
216
+ sid: @solution[:sid],
217
+ )
218
+ end
219
+
220
+ ##
221
+ # Delete the CustomerProfilesChannelEndpointAssignmentInstance
222
+ # @return [Boolean] true if delete succeeds, false otherwise
223
+ def delete
224
+ @version.delete('DELETE', @uri)
225
+ end
226
+
227
+ ##
228
+ # Provide a user friendly representation
229
+ def to_s
230
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231
+ "#<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentContext #{context}>"
232
+ end
233
+
234
+ ##
235
+ # Provide a detailed, user friendly representation
236
+ def inspect
237
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
238
+ "#<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentContext #{context}>"
239
+ end
240
+ end
241
+
242
+ class CustomerProfilesChannelEndpointAssignmentInstance < InstanceResource
243
+ ##
244
+ # Initialize the CustomerProfilesChannelEndpointAssignmentInstance
245
+ # @param [Version] version Version that contains the resource
246
+ # @param [Hash] payload payload that contains response from Twilio
247
+ # @param [String] customer_profile_sid The unique string that we created to
248
+ # identify the CustomerProfile resource.
249
+ # @param [String] sid The unique string that we created to identify the resource.
250
+ # @return [CustomerProfilesChannelEndpointAssignmentInstance] CustomerProfilesChannelEndpointAssignmentInstance
251
+ def initialize(version, payload, customer_profile_sid: nil, sid: nil)
252
+ super(version)
253
+
254
+ # Marshaled Properties
255
+ @properties = {
256
+ 'sid' => payload['sid'],
257
+ 'customer_profile_sid' => payload['customer_profile_sid'],
258
+ 'account_sid' => payload['account_sid'],
259
+ 'channel_endpoint_type' => payload['channel_endpoint_type'],
260
+ 'channel_endpoint_sid' => payload['channel_endpoint_sid'],
261
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
262
+ 'url' => payload['url'],
263
+ }
264
+
265
+ # Context
266
+ @instance_context = nil
267
+ @params = {'customer_profile_sid' => customer_profile_sid, 'sid' => sid || @properties['sid'], }
268
+ end
269
+
270
+ ##
271
+ # Generate an instance context for the instance, the context is capable of
272
+ # performing various actions. All instance actions are proxied to the context
273
+ # @return [CustomerProfilesChannelEndpointAssignmentContext] CustomerProfilesChannelEndpointAssignmentContext for this CustomerProfilesChannelEndpointAssignmentInstance
274
+ def context
275
+ unless @instance_context
276
+ @instance_context = CustomerProfilesChannelEndpointAssignmentContext.new(
277
+ @version,
278
+ @params['customer_profile_sid'],
279
+ @params['sid'],
280
+ )
281
+ end
282
+ @instance_context
283
+ end
284
+
285
+ ##
286
+ # @return [String] The unique string that identifies the resource
287
+ def sid
288
+ @properties['sid']
289
+ end
290
+
291
+ ##
292
+ # @return [String] The unique string that identifies the CustomerProfile resource.
293
+ def customer_profile_sid
294
+ @properties['customer_profile_sid']
295
+ end
296
+
297
+ ##
298
+ # @return [String] The SID of the Account that created the resource
299
+ def account_sid
300
+ @properties['account_sid']
301
+ end
302
+
303
+ ##
304
+ # @return [String] The type of channel endpoint
305
+ def channel_endpoint_type
306
+ @properties['channel_endpoint_type']
307
+ end
308
+
309
+ ##
310
+ # @return [String] The sid of an channel endpoint
311
+ def channel_endpoint_sid
312
+ @properties['channel_endpoint_sid']
313
+ end
314
+
315
+ ##
316
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
317
+ def date_created
318
+ @properties['date_created']
319
+ end
320
+
321
+ ##
322
+ # @return [String] The absolute URL of the Identity resource
323
+ def url
324
+ @properties['url']
325
+ end
326
+
327
+ ##
328
+ # Fetch the CustomerProfilesChannelEndpointAssignmentInstance
329
+ # @return [CustomerProfilesChannelEndpointAssignmentInstance] Fetched CustomerProfilesChannelEndpointAssignmentInstance
330
+ def fetch
331
+ context.fetch
332
+ end
333
+
334
+ ##
335
+ # Delete the CustomerProfilesChannelEndpointAssignmentInstance
336
+ # @return [Boolean] true if delete succeeds, false otherwise
337
+ def delete
338
+ context.delete
339
+ end
340
+
341
+ ##
342
+ # Provide a user friendly representation
343
+ def to_s
344
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
345
+ "<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentInstance #{values}>"
346
+ end
347
+
348
+ ##
349
+ # Provide a detailed, user friendly representation
350
+ def inspect
351
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
352
+ "<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentInstance #{values}>"
353
+ end
354
+ end
355
+ end
356
+ end
357
+ end
358
+ end
359
+ end
@@ -0,0 +1,330 @@
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 Trusthub < Domain
12
+ class V1 < Version
13
+ class CustomerProfilesContext < InstanceContext
14
+ class CustomerProfilesEntityAssignmentsList < ListResource
15
+ ##
16
+ # Initialize the CustomerProfilesEntityAssignmentsList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] customer_profile_sid The unique string that we created to
19
+ # identify the CustomerProfile resource.
20
+ # @return [CustomerProfilesEntityAssignmentsList] CustomerProfilesEntityAssignmentsList
21
+ def initialize(version, customer_profile_sid: nil)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {customer_profile_sid: customer_profile_sid}
26
+ @uri = "/CustomerProfiles/#{@solution[:customer_profile_sid]}/EntityAssignments"
27
+ end
28
+
29
+ ##
30
+ # Create the CustomerProfilesEntityAssignmentsInstance
31
+ # @param [String] object_sid The SID of an object bag that holds information of
32
+ # the different items.
33
+ # @return [CustomerProfilesEntityAssignmentsInstance] Created CustomerProfilesEntityAssignmentsInstance
34
+ def create(object_sid: nil)
35
+ data = Twilio::Values.of({'ObjectSid' => object_sid, })
36
+
37
+ payload = @version.create('POST', @uri, data: data)
38
+
39
+ CustomerProfilesEntityAssignmentsInstance.new(
40
+ @version,
41
+ payload,
42
+ customer_profile_sid: @solution[:customer_profile_sid],
43
+ )
44
+ end
45
+
46
+ ##
47
+ # Lists CustomerProfilesEntityAssignmentsInstance records from the API as a list.
48
+ # Unlike stream(), this operation is eager and will load `limit` records into
49
+ # memory before returning.
50
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
51
+ # guarantees to never return more than limit. Default is no limit
52
+ # @param [Integer] page_size Number of records to fetch per request, when
53
+ # not set will use the default value of 50 records. If no page_size is defined
54
+ # but a limit is defined, stream() will attempt to read the limit with the most
55
+ # efficient page size, i.e. min(limit, 1000)
56
+ # @return [Array] Array of up to limit results
57
+ def list(limit: nil, page_size: nil)
58
+ self.stream(limit: limit, page_size: page_size).entries
59
+ end
60
+
61
+ ##
62
+ # Streams CustomerProfilesEntityAssignmentsInstance records from the API as an Enumerable.
63
+ # This operation lazily loads records as efficiently as possible until the limit
64
+ # is reached.
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(page_size: limits[:page_size], )
76
+
77
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
78
+ end
79
+
80
+ ##
81
+ # When passed a block, yields CustomerProfilesEntityAssignmentsInstance records from the API.
82
+ # This operation lazily loads records as efficiently as possible until the limit
83
+ # is reached.
84
+ def each
85
+ limits = @version.read_limits
86
+
87
+ page = self.page(page_size: limits[:page_size], )
88
+
89
+ @version.stream(page,
90
+ limit: limits[:limit],
91
+ page_limit: limits[:page_limit]).each {|x| yield x}
92
+ end
93
+
94
+ ##
95
+ # Retrieve a single page of CustomerProfilesEntityAssignmentsInstance records from the API.
96
+ # Request is executed immediately.
97
+ # @param [String] page_token PageToken provided by the API
98
+ # @param [Integer] page_number Page Number, this value is simply for client state
99
+ # @param [Integer] page_size Number of records to return, defaults to 50
100
+ # @return [Page] Page of CustomerProfilesEntityAssignmentsInstance
101
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
102
+ params = Twilio::Values.of({
103
+ 'PageToken' => page_token,
104
+ 'Page' => page_number,
105
+ 'PageSize' => page_size,
106
+ })
107
+
108
+ response = @version.page('GET', @uri, params: params)
109
+
110
+ CustomerProfilesEntityAssignmentsPage.new(@version, response, @solution)
111
+ end
112
+
113
+ ##
114
+ # Retrieve a single page of CustomerProfilesEntityAssignmentsInstance records from the API.
115
+ # Request is executed immediately.
116
+ # @param [String] target_url API-generated URL for the requested results page
117
+ # @return [Page] Page of CustomerProfilesEntityAssignmentsInstance
118
+ def get_page(target_url)
119
+ response = @version.domain.request(
120
+ 'GET',
121
+ target_url
122
+ )
123
+ CustomerProfilesEntityAssignmentsPage.new(@version, response, @solution)
124
+ end
125
+
126
+ ##
127
+ # Provide a user friendly representation
128
+ def to_s
129
+ '#<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsList>'
130
+ end
131
+ end
132
+
133
+ class CustomerProfilesEntityAssignmentsPage < Page
134
+ ##
135
+ # Initialize the CustomerProfilesEntityAssignmentsPage
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Response] response Response from the API
138
+ # @param [Hash] solution Path solution for the resource
139
+ # @return [CustomerProfilesEntityAssignmentsPage] CustomerProfilesEntityAssignmentsPage
140
+ def initialize(version, response, solution)
141
+ super(version, response)
142
+
143
+ # Path Solution
144
+ @solution = solution
145
+ end
146
+
147
+ ##
148
+ # Build an instance of CustomerProfilesEntityAssignmentsInstance
149
+ # @param [Hash] payload Payload response from the API
150
+ # @return [CustomerProfilesEntityAssignmentsInstance] CustomerProfilesEntityAssignmentsInstance
151
+ def get_instance(payload)
152
+ CustomerProfilesEntityAssignmentsInstance.new(
153
+ @version,
154
+ payload,
155
+ customer_profile_sid: @solution[:customer_profile_sid],
156
+ )
157
+ end
158
+
159
+ ##
160
+ # Provide a user friendly representation
161
+ def to_s
162
+ '<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsPage>'
163
+ end
164
+ end
165
+
166
+ class CustomerProfilesEntityAssignmentsContext < InstanceContext
167
+ ##
168
+ # Initialize the CustomerProfilesEntityAssignmentsContext
169
+ # @param [Version] version Version that contains the resource
170
+ # @param [String] customer_profile_sid The unique string that we created to
171
+ # identify the CustomerProfile resource.
172
+ # @param [String] sid The unique string that we created to identify the Identity
173
+ # resource.
174
+ # @return [CustomerProfilesEntityAssignmentsContext] CustomerProfilesEntityAssignmentsContext
175
+ def initialize(version, customer_profile_sid, sid)
176
+ super(version)
177
+
178
+ # Path Solution
179
+ @solution = {customer_profile_sid: customer_profile_sid, sid: sid, }
180
+ @uri = "/CustomerProfiles/#{@solution[:customer_profile_sid]}/EntityAssignments/#{@solution[:sid]}"
181
+ end
182
+
183
+ ##
184
+ # Fetch the CustomerProfilesEntityAssignmentsInstance
185
+ # @return [CustomerProfilesEntityAssignmentsInstance] Fetched CustomerProfilesEntityAssignmentsInstance
186
+ def fetch
187
+ payload = @version.fetch('GET', @uri)
188
+
189
+ CustomerProfilesEntityAssignmentsInstance.new(
190
+ @version,
191
+ payload,
192
+ customer_profile_sid: @solution[:customer_profile_sid],
193
+ sid: @solution[:sid],
194
+ )
195
+ end
196
+
197
+ ##
198
+ # Delete the CustomerProfilesEntityAssignmentsInstance
199
+ # @return [Boolean] true if delete succeeds, false otherwise
200
+ def delete
201
+ @version.delete('DELETE', @uri)
202
+ end
203
+
204
+ ##
205
+ # Provide a user friendly representation
206
+ def to_s
207
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
208
+ "#<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsContext #{context}>"
209
+ end
210
+
211
+ ##
212
+ # Provide a detailed, user friendly representation
213
+ def inspect
214
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
215
+ "#<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsContext #{context}>"
216
+ end
217
+ end
218
+
219
+ class CustomerProfilesEntityAssignmentsInstance < InstanceResource
220
+ ##
221
+ # Initialize the CustomerProfilesEntityAssignmentsInstance
222
+ # @param [Version] version Version that contains the resource
223
+ # @param [Hash] payload payload that contains response from Twilio
224
+ # @param [String] customer_profile_sid The unique string that we created to
225
+ # identify the CustomerProfile resource.
226
+ # @param [String] sid The unique string that we created to identify the Identity
227
+ # resource.
228
+ # @return [CustomerProfilesEntityAssignmentsInstance] CustomerProfilesEntityAssignmentsInstance
229
+ def initialize(version, payload, customer_profile_sid: nil, sid: nil)
230
+ super(version)
231
+
232
+ # Marshaled Properties
233
+ @properties = {
234
+ 'sid' => payload['sid'],
235
+ 'customer_profile_sid' => payload['customer_profile_sid'],
236
+ 'account_sid' => payload['account_sid'],
237
+ 'object_sid' => payload['object_sid'],
238
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
239
+ 'url' => payload['url'],
240
+ }
241
+
242
+ # Context
243
+ @instance_context = nil
244
+ @params = {'customer_profile_sid' => customer_profile_sid, 'sid' => sid || @properties['sid'], }
245
+ end
246
+
247
+ ##
248
+ # Generate an instance context for the instance, the context is capable of
249
+ # performing various actions. All instance actions are proxied to the context
250
+ # @return [CustomerProfilesEntityAssignmentsContext] CustomerProfilesEntityAssignmentsContext for this CustomerProfilesEntityAssignmentsInstance
251
+ def context
252
+ unless @instance_context
253
+ @instance_context = CustomerProfilesEntityAssignmentsContext.new(
254
+ @version,
255
+ @params['customer_profile_sid'],
256
+ @params['sid'],
257
+ )
258
+ end
259
+ @instance_context
260
+ end
261
+
262
+ ##
263
+ # @return [String] The unique string that identifies the resource
264
+ def sid
265
+ @properties['sid']
266
+ end
267
+
268
+ ##
269
+ # @return [String] The unique string that identifies the CustomerProfile resource.
270
+ def customer_profile_sid
271
+ @properties['customer_profile_sid']
272
+ end
273
+
274
+ ##
275
+ # @return [String] The SID of the Account that created the resource
276
+ def account_sid
277
+ @properties['account_sid']
278
+ end
279
+
280
+ ##
281
+ # @return [String] The sid of an object bag
282
+ def object_sid
283
+ @properties['object_sid']
284
+ end
285
+
286
+ ##
287
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
288
+ def date_created
289
+ @properties['date_created']
290
+ end
291
+
292
+ ##
293
+ # @return [String] The absolute URL of the Identity resource
294
+ def url
295
+ @properties['url']
296
+ end
297
+
298
+ ##
299
+ # Fetch the CustomerProfilesEntityAssignmentsInstance
300
+ # @return [CustomerProfilesEntityAssignmentsInstance] Fetched CustomerProfilesEntityAssignmentsInstance
301
+ def fetch
302
+ context.fetch
303
+ end
304
+
305
+ ##
306
+ # Delete the CustomerProfilesEntityAssignmentsInstance
307
+ # @return [Boolean] true if delete succeeds, false otherwise
308
+ def delete
309
+ context.delete
310
+ end
311
+
312
+ ##
313
+ # Provide a user friendly representation
314
+ def to_s
315
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
316
+ "<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsInstance #{values}>"
317
+ end
318
+
319
+ ##
320
+ # Provide a detailed, user friendly representation
321
+ def inspect
322
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
323
+ "<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsInstance #{values}>"
324
+ end
325
+ end
326
+ end
327
+ end
328
+ end
329
+ end
330
+ end