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