twilio-ruby 5.47.0 → 5.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +17 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/client.rb +7 -0
  5. data/lib/twilio-ruby/rest/events/v1/subscription.rb +2 -2
  6. data/lib/twilio-ruby/rest/messaging.rb +0 -14
  7. data/lib/twilio-ruby/rest/messaging/v1.rb +0 -22
  8. data/lib/twilio-ruby/rest/trusthub.rb +100 -0
  9. data/lib/twilio-ruby/rest/trusthub/v1.rb +139 -0
  10. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +523 -0
  11. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +359 -0
  12. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb +330 -0
  13. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb +328 -0
  14. data/lib/twilio-ruby/rest/trusthub/v1/end_user.rb +356 -0
  15. data/lib/twilio-ruby/rest/trusthub/v1/end_user_type.rb +271 -0
  16. data/lib/twilio-ruby/rest/{messaging/v1/use_case.rb → trusthub/v1/policies.rb} +110 -46
  17. data/lib/twilio-ruby/rest/{messaging/v1/campaign.rb → trusthub/v1/supporting_document.rb} +125 -143
  18. data/lib/twilio-ruby/rest/trusthub/v1/supporting_document_type.rb +271 -0
  19. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +523 -0
  20. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +359 -0
  21. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb +330 -0
  22. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb +328 -0
  23. data/lib/twilio-ruby/rest/verify.rb +9 -0
  24. data/lib/twilio-ruby/rest/verify/v2.rb +15 -0
  25. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +329 -0
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +4 -16
  28. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment_spec.rb +192 -0
  29. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_entity_assignments_spec.rb +186 -0
  30. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_evaluations_spec.rb +615 -0
  31. data/spec/integration/trusthub/v1/customer_profiles_spec.rb +255 -0
  32. data/spec/integration/trusthub/v1/end_user_spec.rb +247 -0
  33. data/spec/integration/trusthub/v1/end_user_type_spec.rb +176 -0
  34. data/spec/integration/trusthub/v1/policies_spec.rb +252 -0
  35. data/spec/integration/trusthub/v1/supporting_document_spec.rb +235 -0
  36. data/spec/integration/trusthub/v1/supporting_document_type_spec.rb +159 -0
  37. data/spec/integration/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment_spec.rb +192 -0
  38. data/spec/integration/trusthub/v1/trust_products/trust_products_entity_assignments_spec.rb +186 -0
  39. data/spec/integration/trusthub/v1/trust_products/trust_products_evaluations_spec.rb +615 -0
  40. data/spec/integration/trusthub/v1/trust_products_spec.rb +255 -0
  41. data/spec/integration/verify/v2/verification_attempt_spec.rb +146 -0
  42. metadata +46 -8
  43. data/spec/integration/messaging/v1/campaign_spec.rb +0 -194
  44. data/spec/integration/messaging/v1/use_case_spec.rb +0 -55
@@ -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