twilio-ruby 5.39.1 → 5.40.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +101 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/Makefile +1 -1
  7. data/PULL_REQUEST_TEMPLATE.md +1 -1
  8. data/README.md +4 -3
  9. data/lib/twilio-ruby/framework/version.rb +2 -7
  10. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +3 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +79 -60
  13. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  14. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  15. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  16. data/lib/twilio-ruby/rest/client.rb +7 -0
  17. data/lib/twilio-ruby/rest/conversations.rb +52 -0
  18. data/lib/twilio-ruby/rest/conversations/v1.rb +88 -1
  19. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +258 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +15 -4
  21. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +19 -10
  22. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +12 -2
  23. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  24. data/lib/twilio-ruby/rest/conversations/v1/notification.rb +310 -0
  25. data/lib/twilio-ruby/rest/conversations/v1/role.rb +372 -0
  26. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  27. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +385 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +259 -0
  29. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  30. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +546 -0
  31. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +388 -0
  32. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +513 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +454 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +393 -0
  35. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  36. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  37. data/lib/twilio-ruby/rest/events.rb +63 -0
  38. data/lib/twilio-ruby/rest/events/v1.rb +74 -0
  39. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  40. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  41. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  42. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  43. data/lib/twilio-ruby/rest/events/v1/subscription.rb +363 -0
  44. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +322 -0
  45. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  46. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  47. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  48. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  49. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  50. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  51. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  52. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  53. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  54. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  55. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  56. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  57. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  58. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  59. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  60. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  62. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  63. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  64. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +39 -9
  65. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  66. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  67. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +25 -3
  68. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  69. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  70. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -1
  71. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  72. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  73. data/lib/twilio-ruby/version.rb +1 -1
  74. data/spec/framework/version_spec.rb +42 -0
  75. data/spec/holodeck/holodeck.rb +3 -3
  76. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  77. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  78. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  79. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  80. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  81. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  82. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  83. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  84. data/spec/integration/conversations/v1/configuration_spec.rb +85 -0
  85. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  86. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  87. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  88. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  89. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  90. data/spec/integration/conversations/v1/notification_spec.rb +107 -0
  91. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  92. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  93. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  94. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  95. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  96. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  97. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  98. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  99. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  100. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  101. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  102. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  103. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  104. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  105. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  106. data/spec/integration/events/v1/sink_spec.rb +217 -0
  107. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +212 -0
  108. data/spec/integration/events/v1/subscription_spec.rb +205 -0
  109. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  110. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  111. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  112. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  113. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  114. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  115. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  116. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  117. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  118. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  119. data/spec/integration/video/v1/room_spec.rb +37 -0
  120. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  121. data/spec/spec_helper.rb +1 -1
  122. metadata +70 -2
@@ -0,0 +1,133 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'EventType' do
12
+ it "can read" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.events.v1.event_types.list()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ expect(
20
+ @holodeck.has_request?(Holodeck::Request.new(
21
+ method: 'get',
22
+ url: 'https://events.twilio.com/v1/Types',
23
+ ))).to eq(true)
24
+ end
25
+
26
+ it "receives read_empty responses" do
27
+ @holodeck.mock(Twilio::Response.new(
28
+ 200,
29
+ %q[
30
+ {
31
+ "types": [],
32
+ "meta": {
33
+ "page": 0,
34
+ "page_size": 10,
35
+ "first_page_url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0",
36
+ "previous_page_url": null,
37
+ "url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0",
38
+ "next_page_url": null,
39
+ "key": "types"
40
+ }
41
+ }
42
+ ]
43
+ ))
44
+
45
+ actual = @client.events.v1.event_types.list()
46
+
47
+ expect(actual).to_not eq(nil)
48
+ end
49
+
50
+ it "receives read_results responses" do
51
+ @holodeck.mock(Twilio::Response.new(
52
+ 200,
53
+ %q[
54
+ {
55
+ "types": [
56
+ {
57
+ "date_created": "2020-08-13T12:50:18Z",
58
+ "date_updated": "2020-08-13T13:28:48Z",
59
+ "type": "com.twilio.test.example",
60
+ "schema_id": "EventStreams.SampleSchema",
61
+ "description": "A sample event type",
62
+ "url": "https://events.twilio.com/v1/Types/com.twilio.test.example",
63
+ "links": {
64
+ "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
65
+ }
66
+ },
67
+ {
68
+ "date_created": "2020-08-13T12:50:19Z",
69
+ "date_updated": "2020-08-13T13:28:49Z",
70
+ "type": "com.twilio.test.example2",
71
+ "schema_id": "EventStreams.SampleSchema",
72
+ "description": "Another sample event type",
73
+ "url": "https://events.twilio.com/v1/Types/com.twilio.test.example2",
74
+ "links": {
75
+ "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
76
+ }
77
+ }
78
+ ],
79
+ "meta": {
80
+ "page": 0,
81
+ "page_size": 20,
82
+ "first_page_url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0",
83
+ "previous_page_url": null,
84
+ "url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0",
85
+ "next_page_url": null,
86
+ "key": "types"
87
+ }
88
+ }
89
+ ]
90
+ ))
91
+
92
+ actual = @client.events.v1.event_types.list()
93
+
94
+ expect(actual).to_not eq(nil)
95
+ end
96
+
97
+ it "can fetch" do
98
+ @holodeck.mock(Twilio::Response.new(500, ''))
99
+
100
+ expect {
101
+ @client.events.v1.event_types('type').fetch()
102
+ }.to raise_exception(Twilio::REST::TwilioError)
103
+
104
+ expect(
105
+ @holodeck.has_request?(Holodeck::Request.new(
106
+ method: 'get',
107
+ url: 'https://events.twilio.com/v1/Types/type',
108
+ ))).to eq(true)
109
+ end
110
+
111
+ it "receives fetch responses" do
112
+ @holodeck.mock(Twilio::Response.new(
113
+ 200,
114
+ %q[
115
+ {
116
+ "date_created": "2020-08-13T12:50:18Z",
117
+ "date_updated": "2020-08-13T13:28:48Z",
118
+ "type": "com.twilio.test.example",
119
+ "schema_id": "EventStreams.SampleSchema",
120
+ "description": "A sample subscription",
121
+ "url": "https://events.twilio.com/v1/Types/com.twilio.test.example",
122
+ "links": {
123
+ "schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
124
+ }
125
+ }
126
+ ]
127
+ ))
128
+
129
+ actual = @client.events.v1.event_types('type').fetch()
130
+
131
+ expect(actual).to_not eq(nil)
132
+ end
133
+ end
@@ -0,0 +1,42 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'SinkTest' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .sink_test.create()
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'post',
23
+ url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Test',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives create responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 201,
30
+ %q[
31
+ {
32
+ "result": "valid"
33
+ }
34
+ ]
35
+ ))
36
+
37
+ actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
38
+ .sink_test.create()
39
+
40
+ expect(actual).to_not eq(nil)
41
+ end
42
+ end
@@ -0,0 +1,44 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'SinkValidate' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .sink_validate.create(test_id: 'test_id')
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {'TestId' => 'test_id', }
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'post',
24
+ url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Validate',
25
+ data: values,
26
+ ))).to eq(true)
27
+ end
28
+
29
+ it "receives create responses" do
30
+ @holodeck.mock(Twilio::Response.new(
31
+ 201,
32
+ %q[
33
+ {
34
+ "result": "valid"
35
+ }
36
+ ]
37
+ ))
38
+
39
+ actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
40
+ .sink_validate.create(test_id: 'test_id')
41
+
42
+ expect(actual).to_not eq(nil)
43
+ end
44
+ end
@@ -0,0 +1,217 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'Sink' do
12
+ it "can fetch" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ expect(
20
+ @holodeck.has_request?(Holodeck::Request.new(
21
+ method: 'get',
22
+ url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
23
+ ))).to eq(true)
24
+ end
25
+
26
+ it "receives fetch responses" do
27
+ @holodeck.mock(Twilio::Response.new(
28
+ 200,
29
+ %q[
30
+ {
31
+ "status": "initialized",
32
+ "sink_configuration": {},
33
+ "description": "description",
34
+ "sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "date_created": "2015-07-30T20:00:00Z",
36
+ "sink_type": "kinesis",
37
+ "date_updated": "2015-07-30T20:00:00Z",
38
+ "url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39
+ "links": {
40
+ "sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
41
+ "sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
42
+ }
43
+ }
44
+ ]
45
+ ))
46
+
47
+ actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
48
+
49
+ expect(actual).to_not eq(nil)
50
+ end
51
+
52
+ it "can create" do
53
+ @holodeck.mock(Twilio::Response.new(500, ''))
54
+
55
+ expect {
56
+ @client.events.v1.sinks.create(description: 'description', sink_configuration: {}, sink_type: 'kinesis')
57
+ }.to raise_exception(Twilio::REST::TwilioError)
58
+
59
+ values = {
60
+ 'Description' => 'description',
61
+ 'SinkConfiguration' => Twilio.serialize_object({}),
62
+ 'SinkType' => 'kinesis',
63
+ }
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'post',
67
+ url: 'https://events.twilio.com/v1/Sinks',
68
+ data: values,
69
+ ))).to eq(true)
70
+ end
71
+
72
+ it "receives create responses" do
73
+ @holodeck.mock(Twilio::Response.new(
74
+ 201,
75
+ %q[
76
+ {
77
+ "status": "initialized",
78
+ "sink_configuration": {
79
+ "arn": "4242",
80
+ "role_arn": "abc123",
81
+ "external_id": "010101"
82
+ },
83
+ "description": "description",
84
+ "sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
85
+ "date_created": "2015-07-30T20:00:00Z",
86
+ "sink_type": "kinesis",
87
+ "date_updated": "2015-07-30T20:00:00Z",
88
+ "url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
89
+ "links": {
90
+ "sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
91
+ "sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
92
+ }
93
+ }
94
+ ]
95
+ ))
96
+
97
+ actual = @client.events.v1.sinks.create(description: 'description', sink_configuration: {}, sink_type: 'kinesis')
98
+
99
+ expect(actual).to_not eq(nil)
100
+ end
101
+
102
+ it "can delete" do
103
+ @holodeck.mock(Twilio::Response.new(500, ''))
104
+
105
+ expect {
106
+ @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
107
+ }.to raise_exception(Twilio::REST::TwilioError)
108
+
109
+ expect(
110
+ @holodeck.has_request?(Holodeck::Request.new(
111
+ method: 'delete',
112
+ url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
113
+ ))).to eq(true)
114
+ end
115
+
116
+ it "receives delete responses" do
117
+ @holodeck.mock(Twilio::Response.new(
118
+ 204,
119
+ nil,
120
+ ))
121
+
122
+ actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
123
+
124
+ expect(actual).to eq(true)
125
+ end
126
+
127
+ it "can read" do
128
+ @holodeck.mock(Twilio::Response.new(500, ''))
129
+
130
+ expect {
131
+ @client.events.v1.sinks.list()
132
+ }.to raise_exception(Twilio::REST::TwilioError)
133
+
134
+ expect(
135
+ @holodeck.has_request?(Holodeck::Request.new(
136
+ method: 'get',
137
+ url: 'https://events.twilio.com/v1/Sinks',
138
+ ))).to eq(true)
139
+ end
140
+
141
+ it "receives read_empty responses" do
142
+ @holodeck.mock(Twilio::Response.new(
143
+ 200,
144
+ %q[
145
+ {
146
+ "sinks": [],
147
+ "meta": {
148
+ "page": 0,
149
+ "page_size": 10,
150
+ "first_page_url": "https://events.twilio.com/v1/Sinks?PageSize=10&Page=0",
151
+ "previous_page_url": null,
152
+ "url": "https://events.twilio.com/v1/Sinks?PageSize=10&Page=0",
153
+ "next_page_url": null,
154
+ "key": "sinks"
155
+ }
156
+ }
157
+ ]
158
+ ))
159
+
160
+ actual = @client.events.v1.sinks.list()
161
+
162
+ expect(actual).to_not eq(nil)
163
+ end
164
+
165
+ it "receives read_results responses" do
166
+ @holodeck.mock(Twilio::Response.new(
167
+ 200,
168
+ %q[
169
+ {
170
+ "sinks": [
171
+ {
172
+ "status": "initialized",
173
+ "sink_configuration": {},
174
+ "description": "A Sink",
175
+ "sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
176
+ "date_created": "2015-07-30T20:00:00Z",
177
+ "sink_type": "kinesis",
178
+ "date_updated": "2015-07-30T20:00:00Z",
179
+ "url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
180
+ "links": {
181
+ "sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
182
+ "sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
183
+ }
184
+ },
185
+ {
186
+ "status": "initialized",
187
+ "sink_configuration": {},
188
+ "description": "ANOTHER Sink",
189
+ "sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
190
+ "date_created": "2015-07-30T20:00:00Z",
191
+ "sink_type": "kinesis",
192
+ "date_updated": "2015-07-30T20:00:00Z",
193
+ "url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
194
+ "links": {
195
+ "sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test",
196
+ "sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate"
197
+ }
198
+ }
199
+ ],
200
+ "meta": {
201
+ "page": 0,
202
+ "page_size": 20,
203
+ "first_page_url": "https://events.twilio.com/v1/Sinks?PageSize=20&Page=0",
204
+ "previous_page_url": null,
205
+ "url": "https://events.twilio.com/v1/Sinks?PageSize=20&Page=0",
206
+ "next_page_url": null,
207
+ "key": "sinks"
208
+ }
209
+ }
210
+ ]
211
+ ))
212
+
213
+ actual = @client.events.v1.sinks.list()
214
+
215
+ expect(actual).to_not eq(nil)
216
+ end
217
+ end
@@ -0,0 +1,212 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'SubscribedEvent' do
12
+ it "can read" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .subscribed_events.list()
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives read_empty responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "types": [],
33
+ "meta": {
34
+ "page": 0,
35
+ "page_size": 10,
36
+ "first_page_url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=10&Page=0",
37
+ "previous_page_url": null,
38
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=10&Page=0",
39
+ "next_page_url": null,
40
+ "key": "types"
41
+ }
42
+ }
43
+ ]
44
+ ))
45
+
46
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
47
+ .subscribed_events.list()
48
+
49
+ expect(actual).to_not eq(nil)
50
+ end
51
+
52
+ it "receives read_results responses" do
53
+ @holodeck.mock(Twilio::Response.new(
54
+ 200,
55
+ %q[
56
+ {
57
+ "types": [
58
+ {
59
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
60
+ "type": "Voice.Calls",
61
+ "version": 2,
62
+ "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
63
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/Voice.Calls"
64
+ },
65
+ {
66
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
67
+ "type": "Video.Rooms",
68
+ "version": 15,
69
+ "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
70
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/Video.Rooms"
71
+ }
72
+ ],
73
+ "meta": {
74
+ "page": 0,
75
+ "page_size": 50,
76
+ "first_page_url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=50&Page=0",
77
+ "previous_page_url": null,
78
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=50&Page=0",
79
+ "next_page_url": null,
80
+ "key": "types"
81
+ }
82
+ }
83
+ ]
84
+ ))
85
+
86
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
87
+ .subscribed_events.list()
88
+
89
+ expect(actual).to_not eq(nil)
90
+ end
91
+
92
+ it "can create" do
93
+ @holodeck.mock(Twilio::Response.new(500, ''))
94
+
95
+ expect {
96
+ @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
97
+ .subscribed_events.create(type: 'type')
98
+ }.to raise_exception(Twilio::REST::TwilioError)
99
+
100
+ values = {'Type' => 'type', }
101
+ expect(
102
+ @holodeck.has_request?(Holodeck::Request.new(
103
+ method: 'post',
104
+ url: 'https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents',
105
+ data: values,
106
+ ))).to eq(true)
107
+ end
108
+
109
+ it "receives create_all_fields responses" do
110
+ @holodeck.mock(Twilio::Response.new(
111
+ 201,
112
+ %q[
113
+ {
114
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
115
+ "type": "com.twilio.voice.call.initiated",
116
+ "version": 5,
117
+ "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
118
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.voice.call.initiated"
119
+ }
120
+ ]
121
+ ))
122
+
123
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
124
+ .subscribed_events.create(type: 'type')
125
+
126
+ expect(actual).to_not eq(nil)
127
+ end
128
+
129
+ it "receives create_no_version responses" do
130
+ @holodeck.mock(Twilio::Response.new(
131
+ 201,
132
+ %q[
133
+ {
134
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
135
+ "type": "com.twilio.voice.call.recorded",
136
+ "version": 2,
137
+ "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
138
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.voice.call.recorded"
139
+ }
140
+ ]
141
+ ))
142
+
143
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
144
+ .subscribed_events.create(type: 'type')
145
+
146
+ expect(actual).to_not eq(nil)
147
+ end
148
+
149
+ it "can update" do
150
+ @holodeck.mock(Twilio::Response.new(500, ''))
151
+
152
+ expect {
153
+ @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
154
+ .subscribed_events('type').update(version: 1)
155
+ }.to raise_exception(Twilio::REST::TwilioError)
156
+
157
+ values = {'Version' => 1, }
158
+ expect(
159
+ @holodeck.has_request?(Holodeck::Request.new(
160
+ method: 'post',
161
+ url: 'https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/type',
162
+ data: values,
163
+ ))).to eq(true)
164
+ end
165
+
166
+ it "receives update responses" do
167
+ @holodeck.mock(Twilio::Response.new(
168
+ 200,
169
+ %q[
170
+ {
171
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
172
+ "type": "com.twilio.voice.call.initiated",
173
+ "version": 6,
174
+ "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
175
+ "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.voice.call.initiated"
176
+ }
177
+ ]
178
+ ))
179
+
180
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
181
+ .subscribed_events('type').update(version: 1)
182
+
183
+ expect(actual).to_not eq(nil)
184
+ end
185
+
186
+ it "can delete" do
187
+ @holodeck.mock(Twilio::Response.new(500, ''))
188
+
189
+ expect {
190
+ @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
191
+ .subscribed_events('type').delete()
192
+ }.to raise_exception(Twilio::REST::TwilioError)
193
+
194
+ expect(
195
+ @holodeck.has_request?(Holodeck::Request.new(
196
+ method: 'delete',
197
+ url: 'https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/type',
198
+ ))).to eq(true)
199
+ end
200
+
201
+ it "receives delete responses" do
202
+ @holodeck.mock(Twilio::Response.new(
203
+ 204,
204
+ nil,
205
+ ))
206
+
207
+ actual = @client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
208
+ .subscribed_events('type').delete()
209
+
210
+ expect(actual).to eq(true)
211
+ end
212
+ end