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,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 Trusthub < Domain
12
+ class V1 < Version
13
+ class EndUserTypeList < ListResource
14
+ ##
15
+ # Initialize the EndUserTypeList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [EndUserTypeList] EndUserTypeList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/EndUserTypes"
24
+ end
25
+
26
+ ##
27
+ # Lists EndUserTypeInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
31
+ # guarantees to never return more than limit. Default is no limit
32
+ # @param [Integer] page_size Number of records to fetch per request, when
33
+ # not set will use the default value of 50 records. If no page_size is defined
34
+ # but a limit is defined, stream() will attempt to read the limit with the most
35
+ # efficient page size, i.e. min(limit, 1000)
36
+ # @return [Array] Array of up to limit results
37
+ def list(limit: nil, page_size: nil)
38
+ self.stream(limit: limit, page_size: page_size).entries
39
+ end
40
+
41
+ ##
42
+ # Streams EndUserTypeInstance records from the API as an Enumerable.
43
+ # This operation lazily loads records as efficiently as possible until the limit
44
+ # is reached.
45
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
46
+ # guarantees to never return more than limit. Default is no limit.
47
+ # @param [Integer] page_size Number of records to fetch per request, when
48
+ # not set will use the default value of 50 records. If no page_size is defined
49
+ # but a limit is defined, stream() will attempt to read the limit with the most
50
+ # efficient page size, i.e. min(limit, 1000)
51
+ # @return [Enumerable] Enumerable that will yield up to limit results
52
+ def stream(limit: nil, page_size: nil)
53
+ limits = @version.read_limits(limit, page_size)
54
+
55
+ page = self.page(page_size: limits[:page_size], )
56
+
57
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
58
+ end
59
+
60
+ ##
61
+ # When passed a block, yields EndUserTypeInstance records from the API.
62
+ # This operation lazily loads records as efficiently as possible until the limit
63
+ # is reached.
64
+ def each
65
+ limits = @version.read_limits
66
+
67
+ page = self.page(page_size: limits[:page_size], )
68
+
69
+ @version.stream(page,
70
+ limit: limits[:limit],
71
+ page_limit: limits[:page_limit]).each {|x| yield x}
72
+ end
73
+
74
+ ##
75
+ # Retrieve a single page of EndUserTypeInstance records from the API.
76
+ # Request is executed immediately.
77
+ # @param [String] page_token PageToken provided by the API
78
+ # @param [Integer] page_number Page Number, this value is simply for client state
79
+ # @param [Integer] page_size Number of records to return, defaults to 50
80
+ # @return [Page] Page of EndUserTypeInstance
81
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
82
+ params = Twilio::Values.of({
83
+ 'PageToken' => page_token,
84
+ 'Page' => page_number,
85
+ 'PageSize' => page_size,
86
+ })
87
+
88
+ response = @version.page('GET', @uri, params: params)
89
+
90
+ EndUserTypePage.new(@version, response, @solution)
91
+ end
92
+
93
+ ##
94
+ # Retrieve a single page of EndUserTypeInstance records from the API.
95
+ # Request is executed immediately.
96
+ # @param [String] target_url API-generated URL for the requested results page
97
+ # @return [Page] Page of EndUserTypeInstance
98
+ def get_page(target_url)
99
+ response = @version.domain.request(
100
+ 'GET',
101
+ target_url
102
+ )
103
+ EndUserTypePage.new(@version, response, @solution)
104
+ end
105
+
106
+ ##
107
+ # Provide a user friendly representation
108
+ def to_s
109
+ '#<Twilio.Trusthub.V1.EndUserTypeList>'
110
+ end
111
+ end
112
+
113
+ class EndUserTypePage < Page
114
+ ##
115
+ # Initialize the EndUserTypePage
116
+ # @param [Version] version Version that contains the resource
117
+ # @param [Response] response Response from the API
118
+ # @param [Hash] solution Path solution for the resource
119
+ # @return [EndUserTypePage] EndUserTypePage
120
+ def initialize(version, response, solution)
121
+ super(version, response)
122
+
123
+ # Path Solution
124
+ @solution = solution
125
+ end
126
+
127
+ ##
128
+ # Build an instance of EndUserTypeInstance
129
+ # @param [Hash] payload Payload response from the API
130
+ # @return [EndUserTypeInstance] EndUserTypeInstance
131
+ def get_instance(payload)
132
+ EndUserTypeInstance.new(@version, payload, )
133
+ end
134
+
135
+ ##
136
+ # Provide a user friendly representation
137
+ def to_s
138
+ '<Twilio.Trusthub.V1.EndUserTypePage>'
139
+ end
140
+ end
141
+
142
+ class EndUserTypeContext < InstanceContext
143
+ ##
144
+ # Initialize the EndUserTypeContext
145
+ # @param [Version] version Version that contains the resource
146
+ # @param [String] sid The unique string that identifies the End-User Type
147
+ # resource.
148
+ # @return [EndUserTypeContext] EndUserTypeContext
149
+ def initialize(version, sid)
150
+ super(version)
151
+
152
+ # Path Solution
153
+ @solution = {sid: sid, }
154
+ @uri = "/EndUserTypes/#{@solution[:sid]}"
155
+ end
156
+
157
+ ##
158
+ # Fetch the EndUserTypeInstance
159
+ # @return [EndUserTypeInstance] Fetched EndUserTypeInstance
160
+ def fetch
161
+ payload = @version.fetch('GET', @uri)
162
+
163
+ EndUserTypeInstance.new(@version, payload, sid: @solution[:sid], )
164
+ end
165
+
166
+ ##
167
+ # Provide a user friendly representation
168
+ def to_s
169
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
170
+ "#<Twilio.Trusthub.V1.EndUserTypeContext #{context}>"
171
+ end
172
+
173
+ ##
174
+ # Provide a detailed, user friendly representation
175
+ def inspect
176
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
177
+ "#<Twilio.Trusthub.V1.EndUserTypeContext #{context}>"
178
+ end
179
+ end
180
+
181
+ class EndUserTypeInstance < InstanceResource
182
+ ##
183
+ # Initialize the EndUserTypeInstance
184
+ # @param [Version] version Version that contains the resource
185
+ # @param [Hash] payload payload that contains response from Twilio
186
+ # @param [String] sid The unique string that identifies the End-User Type
187
+ # resource.
188
+ # @return [EndUserTypeInstance] EndUserTypeInstance
189
+ def initialize(version, payload, sid: nil)
190
+ super(version)
191
+
192
+ # Marshaled Properties
193
+ @properties = {
194
+ 'sid' => payload['sid'],
195
+ 'friendly_name' => payload['friendly_name'],
196
+ 'machine_name' => payload['machine_name'],
197
+ 'fields' => payload['fields'],
198
+ 'url' => payload['url'],
199
+ }
200
+
201
+ # Context
202
+ @instance_context = nil
203
+ @params = {'sid' => sid || @properties['sid'], }
204
+ end
205
+
206
+ ##
207
+ # Generate an instance context for the instance, the context is capable of
208
+ # performing various actions. All instance actions are proxied to the context
209
+ # @return [EndUserTypeContext] EndUserTypeContext for this EndUserTypeInstance
210
+ def context
211
+ unless @instance_context
212
+ @instance_context = EndUserTypeContext.new(@version, @params['sid'], )
213
+ end
214
+ @instance_context
215
+ end
216
+
217
+ ##
218
+ # @return [String] The unique string that identifies the End-User Type resource
219
+ def sid
220
+ @properties['sid']
221
+ end
222
+
223
+ ##
224
+ # @return [String] A human-readable description of the End-User Type resource
225
+ def friendly_name
226
+ @properties['friendly_name']
227
+ end
228
+
229
+ ##
230
+ # @return [String] A machine-readable description of the End-User Type resource
231
+ def machine_name
232
+ @properties['machine_name']
233
+ end
234
+
235
+ ##
236
+ # @return [Array[Hash]] The required information for creating an End-User.
237
+ def fields
238
+ @properties['fields']
239
+ end
240
+
241
+ ##
242
+ # @return [String] The absolute URL of the End-User Type resource
243
+ def url
244
+ @properties['url']
245
+ end
246
+
247
+ ##
248
+ # Fetch the EndUserTypeInstance
249
+ # @return [EndUserTypeInstance] Fetched EndUserTypeInstance
250
+ def fetch
251
+ context.fetch
252
+ end
253
+
254
+ ##
255
+ # Provide a user friendly representation
256
+ def to_s
257
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
258
+ "<Twilio.Trusthub.V1.EndUserTypeInstance #{values}>"
259
+ end
260
+
261
+ ##
262
+ # Provide a detailed, user friendly representation
263
+ def inspect
264
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
265
+ "<Twilio.Trusthub.V1.EndUserTypeInstance #{values}>"
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
271
+ end
@@ -8,25 +8,23 @@
8
8
 
9
9
  module Twilio
10
10
  module REST
11
- class Messaging < Domain
11
+ class Trusthub < Domain
12
12
  class V1 < Version
13
- ##
14
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
- class UseCaseList < ListResource
13
+ class PoliciesList < ListResource
16
14
  ##
17
- # Initialize the UseCaseList
15
+ # Initialize the PoliciesList
18
16
  # @param [Version] version Version that contains the resource
19
- # @return [UseCaseList] UseCaseList
17
+ # @return [PoliciesList] PoliciesList
20
18
  def initialize(version)
21
19
  super(version)
22
20
 
23
21
  # Path Solution
24
22
  @solution = {}
25
- @uri = "/a2p/UseCases"
23
+ @uri = "/Policies"
26
24
  end
27
25
 
28
26
  ##
29
- # Lists UseCaseInstance records from the API as a list.
27
+ # Lists PoliciesInstance records from the API as a list.
30
28
  # Unlike stream(), this operation is eager and will load `limit` records into
31
29
  # memory before returning.
32
30
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -41,7 +39,7 @@ module Twilio
41
39
  end
42
40
 
43
41
  ##
44
- # Streams UseCaseInstance records from the API as an Enumerable.
42
+ # Streams PoliciesInstance records from the API as an Enumerable.
45
43
  # This operation lazily loads records as efficiently as possible until the limit
46
44
  # is reached.
47
45
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -60,7 +58,7 @@ module Twilio
60
58
  end
61
59
 
62
60
  ##
63
- # When passed a block, yields UseCaseInstance records from the API.
61
+ # When passed a block, yields PoliciesInstance records from the API.
64
62
  # This operation lazily loads records as efficiently as possible until the limit
65
63
  # is reached.
66
64
  def each
@@ -74,12 +72,12 @@ module Twilio
74
72
  end
75
73
 
76
74
  ##
77
- # Retrieve a single page of UseCaseInstance records from the API.
75
+ # Retrieve a single page of PoliciesInstance records from the API.
78
76
  # Request is executed immediately.
79
77
  # @param [String] page_token PageToken provided by the API
80
78
  # @param [Integer] page_number Page Number, this value is simply for client state
81
79
  # @param [Integer] page_size Number of records to return, defaults to 50
82
- # @return [Page] Page of UseCaseInstance
80
+ # @return [Page] Page of PoliciesInstance
83
81
  def page(page_token: :unset, page_number: :unset, page_size: :unset)
84
82
  params = Twilio::Values.of({
85
83
  'PageToken' => page_token,
@@ -89,38 +87,36 @@ module Twilio
89
87
 
90
88
  response = @version.page('GET', @uri, params: params)
91
89
 
92
- UseCasePage.new(@version, response, @solution)
90
+ PoliciesPage.new(@version, response, @solution)
93
91
  end
94
92
 
95
93
  ##
96
- # Retrieve a single page of UseCaseInstance records from the API.
94
+ # Retrieve a single page of PoliciesInstance records from the API.
97
95
  # Request is executed immediately.
98
96
  # @param [String] target_url API-generated URL for the requested results page
99
- # @return [Page] Page of UseCaseInstance
97
+ # @return [Page] Page of PoliciesInstance
100
98
  def get_page(target_url)
101
99
  response = @version.domain.request(
102
100
  'GET',
103
101
  target_url
104
102
  )
105
- UseCasePage.new(@version, response, @solution)
103
+ PoliciesPage.new(@version, response, @solution)
106
104
  end
107
105
 
108
106
  ##
109
107
  # Provide a user friendly representation
110
108
  def to_s
111
- '#<Twilio.Messaging.V1.UseCaseList>'
109
+ '#<Twilio.Trusthub.V1.PoliciesList>'
112
110
  end
113
111
  end
114
112
 
115
- ##
116
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
117
- class UseCasePage < Page
113
+ class PoliciesPage < Page
118
114
  ##
119
- # Initialize the UseCasePage
115
+ # Initialize the PoliciesPage
120
116
  # @param [Version] version Version that contains the resource
121
117
  # @param [Response] response Response from the API
122
118
  # @param [Hash] solution Path solution for the resource
123
- # @return [UseCasePage] UseCasePage
119
+ # @return [PoliciesPage] PoliciesPage
124
120
  def initialize(version, response, solution)
125
121
  super(version, response)
126
122
 
@@ -129,67 +125,135 @@ module Twilio
129
125
  end
130
126
 
131
127
  ##
132
- # Build an instance of UseCaseInstance
128
+ # Build an instance of PoliciesInstance
133
129
  # @param [Hash] payload Payload response from the API
134
- # @return [UseCaseInstance] UseCaseInstance
130
+ # @return [PoliciesInstance] PoliciesInstance
135
131
  def get_instance(payload)
136
- UseCaseInstance.new(@version, payload, )
132
+ PoliciesInstance.new(@version, payload, )
137
133
  end
138
134
 
139
135
  ##
140
136
  # Provide a user friendly representation
141
137
  def to_s
142
- '<Twilio.Messaging.V1.UseCasePage>'
138
+ '<Twilio.Trusthub.V1.PoliciesPage>'
143
139
  end
144
140
  end
145
141
 
146
- ##
147
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
148
- class UseCaseInstance < InstanceResource
142
+ class PoliciesContext < InstanceContext
149
143
  ##
150
- # Initialize the UseCaseInstance
144
+ # Initialize the PoliciesContext
145
+ # @param [Version] version Version that contains the resource
146
+ # @param [String] sid The unique string that identifies the Policy resource.
147
+ # @return [PoliciesContext] PoliciesContext
148
+ def initialize(version, sid)
149
+ super(version)
150
+
151
+ # Path Solution
152
+ @solution = {sid: sid, }
153
+ @uri = "/Policies/#{@solution[:sid]}"
154
+ end
155
+
156
+ ##
157
+ # Fetch the PoliciesInstance
158
+ # @return [PoliciesInstance] Fetched PoliciesInstance
159
+ def fetch
160
+ payload = @version.fetch('GET', @uri)
161
+
162
+ PoliciesInstance.new(@version, payload, sid: @solution[:sid], )
163
+ end
164
+
165
+ ##
166
+ # Provide a user friendly representation
167
+ def to_s
168
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
169
+ "#<Twilio.Trusthub.V1.PoliciesContext #{context}>"
170
+ end
171
+
172
+ ##
173
+ # Provide a detailed, user friendly representation
174
+ def inspect
175
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
176
+ "#<Twilio.Trusthub.V1.PoliciesContext #{context}>"
177
+ end
178
+ end
179
+
180
+ class PoliciesInstance < InstanceResource
181
+ ##
182
+ # Initialize the PoliciesInstance
151
183
  # @param [Version] version Version that contains the resource
152
184
  # @param [Hash] payload payload that contains response from Twilio
153
- # @return [UseCaseInstance] UseCaseInstance
154
- def initialize(version, payload)
185
+ # @param [String] sid The unique string that identifies the Policy resource.
186
+ # @return [PoliciesInstance] PoliciesInstance
187
+ def initialize(version, payload, sid: nil)
155
188
  super(version)
156
189
 
157
190
  # Marshaled Properties
158
191
  @properties = {
159
- 'name' => payload['name'],
160
- 'code' => payload['code'],
161
- 'description' => payload['description'],
192
+ 'sid' => payload['sid'],
193
+ 'friendly_name' => payload['friendly_name'],
194
+ 'requirements' => payload['requirements'],
195
+ 'url' => payload['url'],
162
196
  }
197
+
198
+ # Context
199
+ @instance_context = nil
200
+ @params = {'sid' => sid || @properties['sid'], }
201
+ end
202
+
203
+ ##
204
+ # Generate an instance context for the instance, the context is capable of
205
+ # performing various actions. All instance actions are proxied to the context
206
+ # @return [PoliciesContext] PoliciesContext for this PoliciesInstance
207
+ def context
208
+ unless @instance_context
209
+ @instance_context = PoliciesContext.new(@version, @params['sid'], )
210
+ end
211
+ @instance_context
212
+ end
213
+
214
+ ##
215
+ # @return [String] The unique string that identifies the Policy resource
216
+ def sid
217
+ @properties['sid']
218
+ end
219
+
220
+ ##
221
+ # @return [String] A human-readable description of the Policy resource
222
+ def friendly_name
223
+ @properties['friendly_name']
163
224
  end
164
225
 
165
226
  ##
166
- # @return [String] Human readable name
167
- def name
168
- @properties['name']
227
+ # @return [Hash] The sid of a Policy object that dictates requirements
228
+ def requirements
229
+ @properties['requirements']
169
230
  end
170
231
 
171
232
  ##
172
- # @return [String] Unique Use Case code
173
- def code
174
- @properties['code']
233
+ # @return [String] The absolute URL of the Policy resource
234
+ def url
235
+ @properties['url']
175
236
  end
176
237
 
177
238
  ##
178
- # @return [String] Description of Use Case
179
- def description
180
- @properties['description']
239
+ # Fetch the PoliciesInstance
240
+ # @return [PoliciesInstance] Fetched PoliciesInstance
241
+ def fetch
242
+ context.fetch
181
243
  end
182
244
 
183
245
  ##
184
246
  # Provide a user friendly representation
185
247
  def to_s
186
- "<Twilio.Messaging.V1.UseCaseInstance>"
248
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
249
+ "<Twilio.Trusthub.V1.PoliciesInstance #{values}>"
187
250
  end
188
251
 
189
252
  ##
190
253
  # Provide a detailed, user friendly representation
191
254
  def inspect
192
- "<Twilio.Messaging.V1.UseCaseInstance>"
255
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
256
+ "<Twilio.Trusthub.V1.PoliciesInstance #{values}>"
193
257
  end
194
258
  end
195
259
  end