twilio-ruby 5.39.2 → 5.40.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,115 @@
|
|
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 SinkContext < 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 SinkTestList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the SinkTestList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] sid A 34 character string that uniquely identifies this Sink.
|
21
|
+
# @return [SinkTestList] SinkTestList
|
22
|
+
def initialize(version, sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {sid: sid}
|
27
|
+
@uri = "/Sinks/#{@solution[:sid]}/Test"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Create the SinkTestInstance
|
32
|
+
# @return [SinkTestInstance] Created SinkTestInstance
|
33
|
+
def create
|
34
|
+
payload = @version.create('POST', @uri)
|
35
|
+
|
36
|
+
SinkTestInstance.new(@version, payload, sid: @solution[:sid], )
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Provide a user friendly representation
|
41
|
+
def to_s
|
42
|
+
'#<Twilio.Events.V1.SinkTestList>'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# 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.
|
48
|
+
class SinkTestPage < Page
|
49
|
+
##
|
50
|
+
# Initialize the SinkTestPage
|
51
|
+
# @param [Version] version Version that contains the resource
|
52
|
+
# @param [Response] response Response from the API
|
53
|
+
# @param [Hash] solution Path solution for the resource
|
54
|
+
# @return [SinkTestPage] SinkTestPage
|
55
|
+
def initialize(version, response, solution)
|
56
|
+
super(version, response)
|
57
|
+
|
58
|
+
# Path Solution
|
59
|
+
@solution = solution
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Build an instance of SinkTestInstance
|
64
|
+
# @param [Hash] payload Payload response from the API
|
65
|
+
# @return [SinkTestInstance] SinkTestInstance
|
66
|
+
def get_instance(payload)
|
67
|
+
SinkTestInstance.new(@version, payload, sid: @solution[:sid], )
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Provide a user friendly representation
|
72
|
+
def to_s
|
73
|
+
'<Twilio.Events.V1.SinkTestPage>'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# 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.
|
79
|
+
class SinkTestInstance < InstanceResource
|
80
|
+
##
|
81
|
+
# Initialize the SinkTestInstance
|
82
|
+
# @param [Version] version Version that contains the resource
|
83
|
+
# @param [Hash] payload payload that contains response from Twilio
|
84
|
+
# @param [String] sid A 34 character string that uniquely identifies this Sink.
|
85
|
+
# @return [SinkTestInstance] SinkTestInstance
|
86
|
+
def initialize(version, payload, sid: nil)
|
87
|
+
super(version)
|
88
|
+
|
89
|
+
# Marshaled Properties
|
90
|
+
@properties = {'result' => payload['result'], }
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# @return [String] Feedback indicating whether the test event was generated.
|
95
|
+
def result
|
96
|
+
@properties['result']
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Provide a user friendly representation
|
101
|
+
def to_s
|
102
|
+
"<Twilio.Events.V1.SinkTestInstance>"
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# Provide a detailed, user friendly representation
|
107
|
+
def inspect
|
108
|
+
"<Twilio.Events.V1.SinkTestInstance>"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,119 @@
|
|
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 SinkContext < 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 SinkValidateList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the SinkValidateList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] sid A 34 character string that uniquely identifies this Sink.
|
21
|
+
# @return [SinkValidateList] SinkValidateList
|
22
|
+
def initialize(version, sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {sid: sid}
|
27
|
+
@uri = "/Sinks/#{@solution[:sid]}/Validate"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Create the SinkValidateInstance
|
32
|
+
# @param [String] test_id A 34 character string that uniquely identifies the test
|
33
|
+
# event for a Sink being validated.
|
34
|
+
# @return [SinkValidateInstance] Created SinkValidateInstance
|
35
|
+
def create(test_id: nil)
|
36
|
+
data = Twilio::Values.of({'TestId' => test_id, })
|
37
|
+
|
38
|
+
payload = @version.create('POST', @uri, data: data)
|
39
|
+
|
40
|
+
SinkValidateInstance.new(@version, payload, sid: @solution[:sid], )
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Provide a user friendly representation
|
45
|
+
def to_s
|
46
|
+
'#<Twilio.Events.V1.SinkValidateList>'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# 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.
|
52
|
+
class SinkValidatePage < Page
|
53
|
+
##
|
54
|
+
# Initialize the SinkValidatePage
|
55
|
+
# @param [Version] version Version that contains the resource
|
56
|
+
# @param [Response] response Response from the API
|
57
|
+
# @param [Hash] solution Path solution for the resource
|
58
|
+
# @return [SinkValidatePage] SinkValidatePage
|
59
|
+
def initialize(version, response, solution)
|
60
|
+
super(version, response)
|
61
|
+
|
62
|
+
# Path Solution
|
63
|
+
@solution = solution
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# Build an instance of SinkValidateInstance
|
68
|
+
# @param [Hash] payload Payload response from the API
|
69
|
+
# @return [SinkValidateInstance] SinkValidateInstance
|
70
|
+
def get_instance(payload)
|
71
|
+
SinkValidateInstance.new(@version, payload, sid: @solution[:sid], )
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Provide a user friendly representation
|
76
|
+
def to_s
|
77
|
+
'<Twilio.Events.V1.SinkValidatePage>'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# 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.
|
83
|
+
class SinkValidateInstance < InstanceResource
|
84
|
+
##
|
85
|
+
# Initialize the SinkValidateInstance
|
86
|
+
# @param [Version] version Version that contains the resource
|
87
|
+
# @param [Hash] payload payload that contains response from Twilio
|
88
|
+
# @param [String] sid A 34 character string that uniquely identifies this Sink.
|
89
|
+
# @return [SinkValidateInstance] SinkValidateInstance
|
90
|
+
def initialize(version, payload, sid: nil)
|
91
|
+
super(version)
|
92
|
+
|
93
|
+
# Marshaled Properties
|
94
|
+
@properties = {'result' => payload['result'], }
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# @return [String] Feedback indicating whether the given Sink was validated.
|
99
|
+
def result
|
100
|
+
@properties['result']
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Provide a user friendly representation
|
105
|
+
def to_s
|
106
|
+
"<Twilio.Events.V1.SinkValidateInstance>"
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Provide a detailed, user friendly representation
|
111
|
+
def inspect
|
112
|
+
"<Twilio.Events.V1.SinkValidateInstance>"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,383 @@
|
|
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 SubscriptionList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the SubscriptionList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [SubscriptionList] SubscriptionList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Subscriptions"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists SubscriptionInstance records from the API as a list.
|
30
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
|
+
# memory before returning.
|
32
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
33
|
+
# guarantees to never return more than limit. Default is no limit
|
34
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
35
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
36
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
37
|
+
# efficient page size, i.e. min(limit, 1000)
|
38
|
+
# @return [Array] Array of up to limit results
|
39
|
+
def list(limit: nil, page_size: nil)
|
40
|
+
self.stream(limit: limit, page_size: page_size).entries
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Streams SubscriptionInstance records from the API as an Enumerable.
|
45
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
46
|
+
# is reached.
|
47
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
48
|
+
# guarantees to never return more than limit. Default is no limit.
|
49
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
50
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
51
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
52
|
+
# efficient page size, i.e. min(limit, 1000)
|
53
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
54
|
+
def stream(limit: nil, page_size: nil)
|
55
|
+
limits = @version.read_limits(limit, page_size)
|
56
|
+
|
57
|
+
page = self.page(page_size: limits[:page_size], )
|
58
|
+
|
59
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# When passed a block, yields SubscriptionInstance records from the API.
|
64
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
+
# is reached.
|
66
|
+
def each
|
67
|
+
limits = @version.read_limits
|
68
|
+
|
69
|
+
page = self.page(page_size: limits[:page_size], )
|
70
|
+
|
71
|
+
@version.stream(page,
|
72
|
+
limit: limits[:limit],
|
73
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Retrieve a single page of SubscriptionInstance records from the API.
|
78
|
+
# Request is executed immediately.
|
79
|
+
# @param [String] page_token PageToken provided by the API
|
80
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
81
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
82
|
+
# @return [Page] Page of SubscriptionInstance
|
83
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
84
|
+
params = Twilio::Values.of({
|
85
|
+
'PageToken' => page_token,
|
86
|
+
'Page' => page_number,
|
87
|
+
'PageSize' => page_size,
|
88
|
+
})
|
89
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
SubscriptionPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of SubscriptionInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of SubscriptionInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
SubscriptionPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Create the SubscriptionInstance
|
110
|
+
# @param [String] description A human readable description for the Subscription
|
111
|
+
# @param [String] sink_sid The SID of the sink that events selected by this
|
112
|
+
# subscription should be sent to. Sink must be active for the subscription to be
|
113
|
+
# created.
|
114
|
+
# @param [Hash] types Contains a dictionary of URL links to nested resources of
|
115
|
+
# this Subscription.
|
116
|
+
# @return [SubscriptionInstance] Created SubscriptionInstance
|
117
|
+
def create(description: nil, sink_sid: nil, types: nil)
|
118
|
+
data = Twilio::Values.of({
|
119
|
+
'Description' => description,
|
120
|
+
'SinkSid' => sink_sid,
|
121
|
+
'Types' => Twilio.serialize_list(types) { |e| Twilio.serialize_object(e) },
|
122
|
+
})
|
123
|
+
|
124
|
+
payload = @version.create('POST', @uri, data: data)
|
125
|
+
|
126
|
+
SubscriptionInstance.new(@version, payload, )
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Provide a user friendly representation
|
131
|
+
def to_s
|
132
|
+
'#<Twilio.Events.V1.SubscriptionList>'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# 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.
|
138
|
+
class SubscriptionPage < Page
|
139
|
+
##
|
140
|
+
# Initialize the SubscriptionPage
|
141
|
+
# @param [Version] version Version that contains the resource
|
142
|
+
# @param [Response] response Response from the API
|
143
|
+
# @param [Hash] solution Path solution for the resource
|
144
|
+
# @return [SubscriptionPage] SubscriptionPage
|
145
|
+
def initialize(version, response, solution)
|
146
|
+
super(version, response)
|
147
|
+
|
148
|
+
# Path Solution
|
149
|
+
@solution = solution
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# Build an instance of SubscriptionInstance
|
154
|
+
# @param [Hash] payload Payload response from the API
|
155
|
+
# @return [SubscriptionInstance] SubscriptionInstance
|
156
|
+
def get_instance(payload)
|
157
|
+
SubscriptionInstance.new(@version, payload, )
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Provide a user friendly representation
|
162
|
+
def to_s
|
163
|
+
'<Twilio.Events.V1.SubscriptionPage>'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# 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.
|
169
|
+
class SubscriptionContext < InstanceContext
|
170
|
+
##
|
171
|
+
# Initialize the SubscriptionContext
|
172
|
+
# @param [Version] version Version that contains the resource
|
173
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
174
|
+
# Subscription.
|
175
|
+
# @return [SubscriptionContext] SubscriptionContext
|
176
|
+
def initialize(version, sid)
|
177
|
+
super(version)
|
178
|
+
|
179
|
+
# Path Solution
|
180
|
+
@solution = {sid: sid, }
|
181
|
+
@uri = "/Subscriptions/#{@solution[:sid]}"
|
182
|
+
|
183
|
+
# Dependents
|
184
|
+
@subscribed_events = nil
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Fetch the SubscriptionInstance
|
189
|
+
# @return [SubscriptionInstance] Fetched SubscriptionInstance
|
190
|
+
def fetch
|
191
|
+
payload = @version.fetch('GET', @uri)
|
192
|
+
|
193
|
+
SubscriptionInstance.new(@version, payload, sid: @solution[:sid], )
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# Update the SubscriptionInstance
|
198
|
+
# @param [String] description A human readable description for the Subscription.
|
199
|
+
# @param [String] sink_sid The SID of the sink that events selected by this
|
200
|
+
# subscription should be sent to. Sink must be active for the subscription to be
|
201
|
+
# created.
|
202
|
+
# @return [SubscriptionInstance] Updated SubscriptionInstance
|
203
|
+
def update(description: :unset, sink_sid: :unset)
|
204
|
+
data = Twilio::Values.of({'Description' => description, 'SinkSid' => sink_sid, })
|
205
|
+
|
206
|
+
payload = @version.update('POST', @uri, data: data)
|
207
|
+
|
208
|
+
SubscriptionInstance.new(@version, payload, sid: @solution[:sid], )
|
209
|
+
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# Delete the SubscriptionInstance
|
213
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
214
|
+
def delete
|
215
|
+
@version.delete('DELETE', @uri)
|
216
|
+
end
|
217
|
+
|
218
|
+
##
|
219
|
+
# Access the subscribed_events
|
220
|
+
# @return [SubscribedEventList]
|
221
|
+
# @return [SubscribedEventContext]
|
222
|
+
def subscribed_events
|
223
|
+
unless @subscribed_events
|
224
|
+
@subscribed_events = SubscribedEventList.new(@version, subscription_sid: @solution[:sid], )
|
225
|
+
end
|
226
|
+
|
227
|
+
@subscribed_events
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Provide a user friendly representation
|
232
|
+
def to_s
|
233
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
234
|
+
"#<Twilio.Events.V1.SubscriptionContext #{context}>"
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Provide a detailed, user friendly representation
|
239
|
+
def inspect
|
240
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
241
|
+
"#<Twilio.Events.V1.SubscriptionContext #{context}>"
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# 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.
|
247
|
+
class SubscriptionInstance < InstanceResource
|
248
|
+
##
|
249
|
+
# Initialize the SubscriptionInstance
|
250
|
+
# @param [Version] version Version that contains the resource
|
251
|
+
# @param [Hash] payload payload that contains response from Twilio
|
252
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
253
|
+
# Subscription.
|
254
|
+
# @return [SubscriptionInstance] SubscriptionInstance
|
255
|
+
def initialize(version, payload, sid: nil)
|
256
|
+
super(version)
|
257
|
+
|
258
|
+
# Marshaled Properties
|
259
|
+
@properties = {
|
260
|
+
'account_sid' => payload['account_sid'],
|
261
|
+
'sid' => payload['sid'],
|
262
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
263
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
264
|
+
'description' => payload['description'],
|
265
|
+
'sink_sid' => payload['sink_sid'],
|
266
|
+
'url' => payload['url'],
|
267
|
+
'links' => payload['links'],
|
268
|
+
}
|
269
|
+
|
270
|
+
# Context
|
271
|
+
@instance_context = nil
|
272
|
+
@params = {'sid' => sid || @properties['sid'], }
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# Generate an instance context for the instance, the context is capable of
|
277
|
+
# performing various actions. All instance actions are proxied to the context
|
278
|
+
# @return [SubscriptionContext] SubscriptionContext for this SubscriptionInstance
|
279
|
+
def context
|
280
|
+
unless @instance_context
|
281
|
+
@instance_context = SubscriptionContext.new(@version, @params['sid'], )
|
282
|
+
end
|
283
|
+
@instance_context
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# @return [String] Account SID.
|
288
|
+
def account_sid
|
289
|
+
@properties['account_sid']
|
290
|
+
end
|
291
|
+
|
292
|
+
##
|
293
|
+
# @return [String] A string that uniquely identifies this Subscription.
|
294
|
+
def sid
|
295
|
+
@properties['sid']
|
296
|
+
end
|
297
|
+
|
298
|
+
##
|
299
|
+
# @return [Time] The date this Subscription was created
|
300
|
+
def date_created
|
301
|
+
@properties['date_created']
|
302
|
+
end
|
303
|
+
|
304
|
+
##
|
305
|
+
# @return [Time] The date this Subscription was updated
|
306
|
+
def date_updated
|
307
|
+
@properties['date_updated']
|
308
|
+
end
|
309
|
+
|
310
|
+
##
|
311
|
+
# @return [String] Subscription description
|
312
|
+
def description
|
313
|
+
@properties['description']
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# @return [String] Sink SID.
|
318
|
+
def sink_sid
|
319
|
+
@properties['sink_sid']
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# @return [String] The URL of this resource.
|
324
|
+
def url
|
325
|
+
@properties['url']
|
326
|
+
end
|
327
|
+
|
328
|
+
##
|
329
|
+
# @return [String] Nested resource URLs.
|
330
|
+
def links
|
331
|
+
@properties['links']
|
332
|
+
end
|
333
|
+
|
334
|
+
##
|
335
|
+
# Fetch the SubscriptionInstance
|
336
|
+
# @return [SubscriptionInstance] Fetched SubscriptionInstance
|
337
|
+
def fetch
|
338
|
+
context.fetch
|
339
|
+
end
|
340
|
+
|
341
|
+
##
|
342
|
+
# Update the SubscriptionInstance
|
343
|
+
# @param [String] description A human readable description for the Subscription.
|
344
|
+
# @param [String] sink_sid The SID of the sink that events selected by this
|
345
|
+
# subscription should be sent to. Sink must be active for the subscription to be
|
346
|
+
# created.
|
347
|
+
# @return [SubscriptionInstance] Updated SubscriptionInstance
|
348
|
+
def update(description: :unset, sink_sid: :unset)
|
349
|
+
context.update(description: description, sink_sid: sink_sid, )
|
350
|
+
end
|
351
|
+
|
352
|
+
##
|
353
|
+
# Delete the SubscriptionInstance
|
354
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
355
|
+
def delete
|
356
|
+
context.delete
|
357
|
+
end
|
358
|
+
|
359
|
+
##
|
360
|
+
# Access the subscribed_events
|
361
|
+
# @return [subscribed_events] subscribed_events
|
362
|
+
def subscribed_events
|
363
|
+
context.subscribed_events
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# Provide a user friendly representation
|
368
|
+
def to_s
|
369
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
370
|
+
"<Twilio.Events.V1.SubscriptionInstance #{values}>"
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# Provide a detailed, user friendly representation
|
375
|
+
def inspect
|
376
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
377
|
+
"<Twilio.Events.V1.SubscriptionInstance #{values}>"
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|