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.
- checksums.yaml +4 -4
- data/CHANGES.md +112 -0
- data/README.md +20 -6
- data/lib/twilio-ruby/rest/api.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010.rb +5 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +10 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +4 -4
- data/lib/twilio-ruby/rest/autopilot/v1.rb +5 -4
- data/lib/twilio-ruby/rest/bulkexports/v1.rb +10 -8
- data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +14 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +14 -0
- data/lib/twilio-ruby/rest/chat/v1.rb +10 -8
- data/lib/twilio-ruby/rest/chat/v2.rb +10 -8
- data/lib/twilio-ruby/rest/client.rb +8 -1
- data/lib/twilio-ruby/rest/conversations/v1.rb +25 -20
- data/lib/twilio-ruby/rest/events/v1.rb +20 -16
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +4 -4
- data/lib/twilio-ruby/rest/events/v1/schema.rb +4 -4
- data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +4 -4
- data/lib/twilio-ruby/rest/events/v1/sink.rb +6 -5
- data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +3 -3
- data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +3 -3
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +15 -8
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +133 -6
- data/lib/twilio-ruby/rest/fax/v1.rb +5 -4
- data/lib/twilio-ruby/rest/flex_api/v1.rb +15 -12
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/insights.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v1.rb +11 -9
- data/lib/twilio-ruby/rest/insights/v1/room.rb +55 -43
- data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +22 -22
- data/lib/twilio-ruby/rest/ip_messaging/v1.rb +10 -8
- data/lib/twilio-ruby/rest/ip_messaging/v2.rb +10 -8
- data/lib/twilio-ruby/rest/lookups/v1.rb +5 -4
- data/lib/twilio-ruby/rest/messaging.rb +8 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +21 -4
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +328 -0
- data/lib/twilio-ruby/rest/monitor/v1.rb +10 -8
- data/lib/twilio-ruby/rest/notify/v1.rb +10 -8
- data/lib/twilio-ruby/rest/preview/bulk_exports.rb +10 -8
- data/lib/twilio-ruby/rest/preview/deployed_devices.rb +5 -4
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +10 -8
- data/lib/twilio-ruby/rest/preview/marketplace.rb +10 -8
- data/lib/twilio-ruby/rest/preview/sync.rb +5 -4
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +4 -8
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +5 -4
- data/lib/twilio-ruby/rest/preview/understand.rb +5 -4
- data/lib/twilio-ruby/rest/preview/wireless.rb +15 -12
- data/lib/twilio-ruby/rest/proxy/v1.rb +5 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +1 -1
- data/lib/twilio-ruby/rest/serverless/v1.rb +5 -4
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +11 -1
- data/lib/twilio-ruby/rest/studio/v1.rb +5 -4
- data/lib/twilio-ruby/rest/studio/v2.rb +5 -4
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +4 -12
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +1 -9
- data/lib/twilio-ruby/rest/studio/v2/flow/test_user.rb +10 -16
- data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +6 -11
- data/lib/twilio-ruby/rest/supersim.rb +9 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +41 -20
- data/lib/twilio-ruby/rest/supersim/v1/command.rb +4 -4
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +86 -13
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +4 -4
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +4 -4
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +4 -4
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +4 -4
- data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +371 -0
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +3 -3
- data/lib/twilio-ruby/rest/sync/v1.rb +5 -4
- data/lib/twilio-ruby/rest/sync/v1/service.rb +0 -8
- data/lib/twilio-ruby/rest/sync/v1/service/document.rb +13 -32
- data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +0 -8
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +9 -23
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +38 -45
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +0 -8
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +9 -23
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +38 -47
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +0 -8
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +9 -23
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +0 -6
- data/lib/twilio-ruby/rest/taskrouter/v1.rb +5 -4
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +12 -8
- data/lib/twilio-ruby/rest/trunking/v1.rb +5 -4
- data/lib/twilio-ruby/rest/trusthub.rb +100 -0
- data/lib/twilio-ruby/rest/trusthub/v1.rb +146 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +523 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +359 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb +330 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb +328 -0
- data/lib/twilio-ruby/rest/trusthub/v1/end_user.rb +356 -0
- data/lib/twilio-ruby/rest/trusthub/v1/end_user_type.rb +271 -0
- data/lib/twilio-ruby/rest/trusthub/v1/policies.rb +262 -0
- data/lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb +369 -0
- data/lib/twilio-ruby/rest/trusthub/v1/supporting_document_type.rb +271 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +523 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +359 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb +330 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb +328 -0
- data/lib/twilio-ruby/rest/verify.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +26 -8
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +4 -3
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +64 -13
- data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +329 -0
- data/lib/twilio-ruby/rest/video/v1.rb +20 -16
- data/lib/twilio-ruby/rest/video/v1/room.rb +4 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +0 -6
- data/lib/twilio-ruby/rest/voice/v1.rb +20 -16
- data/lib/twilio-ruby/rest/wireless/v1.rb +15 -12
- data/lib/twilio-ruby/twiml/voice_response.rb +38 -8
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference_spec.rb +302 -44
- data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +4 -16
- data/spec/integration/api/v2010/account/message_spec.rb +37 -0
- data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +6 -2
- data/spec/integration/bulkexports/v1/export/job_spec.rb +3 -1
- data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +134 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +24 -0
- data/spec/integration/messaging/v1/brand_registration_spec.rb +143 -0
- data/spec/integration/preview/sync/service/document_spec.rb +1 -3
- data/spec/integration/serverless/v1/service/build_spec.rb +12 -2
- data/spec/integration/supersim/v1/fleet_spec.rb +20 -0
- data/spec/integration/supersim/v1/sms_command_spec.rb +184 -0
- data/spec/integration/sync/v1/service/document_spec.rb +1 -3
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +3 -1
- data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment_spec.rb +192 -0
- data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_entity_assignments_spec.rb +186 -0
- data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_evaluations_spec.rb +615 -0
- data/spec/integration/trusthub/v1/customer_profiles_spec.rb +255 -0
- data/spec/integration/trusthub/v1/end_user_spec.rb +247 -0
- data/spec/integration/trusthub/v1/end_user_type_spec.rb +176 -0
- data/spec/integration/trusthub/v1/policies_spec.rb +252 -0
- data/spec/integration/trusthub/v1/supporting_document_spec.rb +235 -0
- data/spec/integration/trusthub/v1/supporting_document_type_spec.rb +159 -0
- data/spec/integration/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment_spec.rb +192 -0
- data/spec/integration/trusthub/v1/trust_products/trust_products_entity_assignments_spec.rb +186 -0
- data/spec/integration/trusthub/v1/trust_products/trust_products_evaluations_spec.rb +615 -0
- data/spec/integration/trusthub/v1/trust_products_spec.rb +255 -0
- data/spec/integration/verify/v2/service/entity/factor_spec.rb +3 -3
- data/spec/integration/verify/v2/verification_attempt_spec.rb +146 -0
- data/spec/integration/video/v1/room_spec.rb +39 -0
- metadata +52 -2
@@ -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
|
@@ -0,0 +1,262 @@
|
|
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 PoliciesList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the PoliciesList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [PoliciesList] PoliciesList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/Policies"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Lists PoliciesInstance 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 PoliciesInstance 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 PoliciesInstance 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 PoliciesInstance 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 PoliciesInstance
|
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
|
+
PoliciesPage.new(@version, response, @solution)
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Retrieve a single page of PoliciesInstance 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 PoliciesInstance
|
98
|
+
def get_page(target_url)
|
99
|
+
response = @version.domain.request(
|
100
|
+
'GET',
|
101
|
+
target_url
|
102
|
+
)
|
103
|
+
PoliciesPage.new(@version, response, @solution)
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Provide a user friendly representation
|
108
|
+
def to_s
|
109
|
+
'#<Twilio.Trusthub.V1.PoliciesList>'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class PoliciesPage < Page
|
114
|
+
##
|
115
|
+
# Initialize the PoliciesPage
|
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 [PoliciesPage] PoliciesPage
|
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 PoliciesInstance
|
129
|
+
# @param [Hash] payload Payload response from the API
|
130
|
+
# @return [PoliciesInstance] PoliciesInstance
|
131
|
+
def get_instance(payload)
|
132
|
+
PoliciesInstance.new(@version, payload, )
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Provide a user friendly representation
|
137
|
+
def to_s
|
138
|
+
'<Twilio.Trusthub.V1.PoliciesPage>'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class PoliciesContext < InstanceContext
|
143
|
+
##
|
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
|
183
|
+
# @param [Version] version Version that contains the resource
|
184
|
+
# @param [Hash] payload payload that contains response from Twilio
|
185
|
+
# @param [String] sid The unique string that identifies the Policy resource.
|
186
|
+
# @return [PoliciesInstance] PoliciesInstance
|
187
|
+
def initialize(version, payload, sid: nil)
|
188
|
+
super(version)
|
189
|
+
|
190
|
+
# Marshaled Properties
|
191
|
+
@properties = {
|
192
|
+
'sid' => payload['sid'],
|
193
|
+
'friendly_name' => payload['friendly_name'],
|
194
|
+
'requirements' => payload['requirements'],
|
195
|
+
'url' => payload['url'],
|
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']
|
224
|
+
end
|
225
|
+
|
226
|
+
##
|
227
|
+
# @return [Hash] The sid of a Policy object that dictates requirements
|
228
|
+
def requirements
|
229
|
+
@properties['requirements']
|
230
|
+
end
|
231
|
+
|
232
|
+
##
|
233
|
+
# @return [String] The absolute URL of the Policy resource
|
234
|
+
def url
|
235
|
+
@properties['url']
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# Fetch the PoliciesInstance
|
240
|
+
# @return [PoliciesInstance] Fetched PoliciesInstance
|
241
|
+
def fetch
|
242
|
+
context.fetch
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# Provide a user friendly representation
|
247
|
+
def to_s
|
248
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
249
|
+
"<Twilio.Trusthub.V1.PoliciesInstance #{values}>"
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Provide a detailed, user friendly representation
|
254
|
+
def inspect
|
255
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
256
|
+
"<Twilio.Trusthub.V1.PoliciesInstance #{values}>"
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|