twilio-ruby 5.40.1 → 5.40.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +27 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/framework/version.rb +2 -7
  5. data/lib/twilio-ruby/rest/conversations.rb +52 -0
  6. data/lib/twilio-ruby/rest/conversations/v1.rb +88 -1
  7. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +258 -0
  8. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +15 -4
  9. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +19 -10
  10. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  11. data/lib/twilio-ruby/rest/conversations/v1/notification.rb +310 -0
  12. data/lib/twilio-ruby/rest/conversations/v1/role.rb +372 -0
  13. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  14. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +385 -0
  15. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +259 -0
  16. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  17. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +546 -0
  18. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +388 -0
  19. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +513 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +454 -0
  21. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +393 -0
  22. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  23. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  24. data/lib/twilio-ruby/rest/events.rb +8 -0
  25. data/lib/twilio-ruby/rest/events/v1.rb +15 -0
  26. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  27. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +2 -2
  28. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  29. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +27 -24
  30. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +12 -11
  31. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  32. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  33. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  34. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  35. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  36. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  37. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  38. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  39. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  40. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  41. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
  42. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  43. data/lib/twilio-ruby/version.rb +1 -1
  44. data/spec/framework/version_spec.rb +42 -0
  45. data/spec/holodeck/holodeck.rb +3 -3
  46. data/spec/integration/conversations/v1/configuration_spec.rb +85 -0
  47. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  48. data/spec/integration/conversations/v1/conversation/participant_spec.rb +6 -6
  49. data/spec/integration/conversations/v1/conversation_spec.rb +5 -0
  50. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  51. data/spec/integration/conversations/v1/notification_spec.rb +107 -0
  52. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  53. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  54. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  55. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  56. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  57. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  58. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  59. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  60. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  61. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  62. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  63. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  64. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  65. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  66. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  67. metadata +50 -2
@@ -34,7 +34,7 @@ describe 'Participant' do
34
34
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
35
  "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
36
  "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
- "identity": "null",
37
+ "identity": null,
38
38
  "attributes": "{ \\"role\\": \\"driver\\" }",
39
39
  "messaging_binding": {
40
40
  "type": "sms",
@@ -144,13 +144,13 @@ describe 'Participant' do
144
144
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
145
145
  "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
146
146
  "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
147
- "identity": "null",
147
+ "identity": null,
148
148
  "attributes": "{}",
149
149
  "messaging_binding": {
150
150
  "type": "sms",
151
151
  "address": "+15017122661"
152
152
  },
153
- "role_sid": "null",
153
+ "role_sid": null,
154
154
  "date_created": "2020-07-01T22:18:37Z",
155
155
  "date_updated": "2020-07-01T22:18:37Z",
156
156
  "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -189,7 +189,7 @@ describe 'Participant' do
189
189
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
190
190
  "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
191
191
  "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
192
- "identity": "null",
192
+ "identity": null,
193
193
  "attributes": "{ \\"role\\": \\"driver\\" }",
194
194
  "messaging_binding": {
195
195
  "type": "sms",
@@ -290,7 +290,7 @@ describe 'Participant' do
290
290
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
291
291
  "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
292
292
  "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
293
- "identity": "null",
293
+ "identity": null,
294
294
  "attributes": "{ \\"role\\": \\"driver\\" }",
295
295
  "messaging_binding": {
296
296
  "type": "sms",
@@ -345,7 +345,7 @@ describe 'Participant' do
345
345
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
346
346
  "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
347
347
  "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
348
- "identity": "null",
348
+ "identity": null,
349
349
  "attributes": "{ \\"role\\": \\"driver\\" }",
350
350
  "messaging_binding": {
351
351
  "type": "sms",
@@ -35,6 +35,7 @@ describe 'Conversation' do
35
35
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
36
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
37
  "friendly_name": "friendly_name",
38
+ "unique_name": "unique_name",
38
39
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
39
40
  "date_created": "2015-12-16T22:18:37Z",
40
41
  "date_updated": "2015-12-16T22:18:38Z",
@@ -68,6 +69,7 @@ describe 'Conversation' do
68
69
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
69
70
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
70
71
  "friendly_name": "friendly_name",
72
+ "unique_name": null,
71
73
  "attributes": "{}",
72
74
  "date_created": "2020-07-01T22:18:37Z",
73
75
  "date_updated": "2020-07-01T22:18:37Z",
@@ -114,6 +116,7 @@ describe 'Conversation' do
114
116
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
115
117
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
116
118
  "friendly_name": "friendly_name",
119
+ "unique_name": null,
117
120
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
118
121
  "date_created": "2015-12-16T22:18:37Z",
119
122
  "date_updated": "2015-12-16T22:18:38Z",
@@ -188,6 +191,7 @@ describe 'Conversation' do
188
191
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
189
192
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
190
193
  "friendly_name": "My First Conversation",
194
+ "unique_name": "first_conversation",
191
195
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
192
196
  "date_created": "2015-12-16T22:18:37Z",
193
197
  "date_updated": "2015-12-16T22:18:38Z",
@@ -237,6 +241,7 @@ describe 'Conversation' do
237
241
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
238
242
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
239
243
  "friendly_name": "Home Repair Visit",
244
+ "unique_name": null,
240
245
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
241
246
  "date_created": "2015-12-16T22:18:37Z",
242
247
  "date_updated": "2015-12-16T22:18:38Z",
@@ -0,0 +1,219 @@
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 'Credential' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.conversations.v1.credentials.create(type: 'apn')
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {'Type' => 'apn', }
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'post',
23
+ url: 'https://conversations.twilio.com/v1/Credentials',
24
+ data: values,
25
+ ))).to eq(true)
26
+ end
27
+
28
+ it "receives create responses" do
29
+ @holodeck.mock(Twilio::Response.new(
30
+ 201,
31
+ %q[
32
+ {
33
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "friendly_name": "Test slow create",
36
+ "type": "apn",
37
+ "sandbox": "False",
38
+ "date_created": "2015-10-07T17:50:01Z",
39
+ "date_updated": "2015-10-07T17:50:01Z",
40
+ "url": "https://conversations.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
41
+ }
42
+ ]
43
+ ))
44
+
45
+ actual = @client.conversations.v1.credentials.create(type: 'apn')
46
+
47
+ expect(actual).to_not eq(nil)
48
+ end
49
+
50
+ it "can update" do
51
+ @holodeck.mock(Twilio::Response.new(500, ''))
52
+
53
+ expect {
54
+ @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
55
+ }.to raise_exception(Twilio::REST::TwilioError)
56
+
57
+ expect(
58
+ @holodeck.has_request?(Holodeck::Request.new(
59
+ method: 'post',
60
+ url: 'https://conversations.twilio.com/v1/Credentials/CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
61
+ ))).to eq(true)
62
+ end
63
+
64
+ it "receives update responses" do
65
+ @holodeck.mock(Twilio::Response.new(
66
+ 200,
67
+ %q[
68
+ {
69
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
70
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
71
+ "friendly_name": "Test slow create",
72
+ "type": "apn",
73
+ "sandbox": "False",
74
+ "date_created": "2015-10-07T17:50:01Z",
75
+ "date_updated": "2015-10-07T17:50:01Z",
76
+ "url": "https://conversations.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
77
+ }
78
+ ]
79
+ ))
80
+
81
+ actual = @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
82
+
83
+ expect(actual).to_not eq(nil)
84
+ end
85
+
86
+ it "can delete" do
87
+ @holodeck.mock(Twilio::Response.new(500, ''))
88
+
89
+ expect {
90
+ @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
91
+ }.to raise_exception(Twilio::REST::TwilioError)
92
+
93
+ expect(
94
+ @holodeck.has_request?(Holodeck::Request.new(
95
+ method: 'delete',
96
+ url: 'https://conversations.twilio.com/v1/Credentials/CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
97
+ ))).to eq(true)
98
+ end
99
+
100
+ it "receives delete responses" do
101
+ @holodeck.mock(Twilio::Response.new(
102
+ 204,
103
+ nil,
104
+ ))
105
+
106
+ actual = @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
107
+
108
+ expect(actual).to eq(true)
109
+ end
110
+
111
+ it "can fetch" do
112
+ @holodeck.mock(Twilio::Response.new(500, ''))
113
+
114
+ expect {
115
+ @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
116
+ }.to raise_exception(Twilio::REST::TwilioError)
117
+
118
+ expect(
119
+ @holodeck.has_request?(Holodeck::Request.new(
120
+ method: 'get',
121
+ url: 'https://conversations.twilio.com/v1/Credentials/CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
122
+ ))).to eq(true)
123
+ end
124
+
125
+ it "receives fetch responses" do
126
+ @holodeck.mock(Twilio::Response.new(
127
+ 200,
128
+ %q[
129
+ {
130
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
131
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
132
+ "friendly_name": "Test slow create",
133
+ "type": "apn",
134
+ "sandbox": "False",
135
+ "date_created": "2015-10-07T17:50:01Z",
136
+ "date_updated": "2015-10-07T17:50:01Z",
137
+ "url": "https://conversations.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
138
+ }
139
+ ]
140
+ ))
141
+
142
+ actual = @client.conversations.v1.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
143
+
144
+ expect(actual).to_not eq(nil)
145
+ end
146
+
147
+ it "can read" do
148
+ @holodeck.mock(Twilio::Response.new(500, ''))
149
+
150
+ expect {
151
+ @client.conversations.v1.credentials.list()
152
+ }.to raise_exception(Twilio::REST::TwilioError)
153
+
154
+ expect(
155
+ @holodeck.has_request?(Holodeck::Request.new(
156
+ method: 'get',
157
+ url: 'https://conversations.twilio.com/v1/Credentials',
158
+ ))).to eq(true)
159
+ end
160
+
161
+ it "receives read_full responses" do
162
+ @holodeck.mock(Twilio::Response.new(
163
+ 200,
164
+ %q[
165
+ {
166
+ "credentials": [
167
+ {
168
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
169
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
170
+ "friendly_name": "Test slow create",
171
+ "type": "apn",
172
+ "sandbox": "False",
173
+ "date_created": "2015-10-07T17:50:01Z",
174
+ "date_updated": "2015-10-07T17:50:01Z",
175
+ "url": "https://conversations.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
176
+ }
177
+ ],
178
+ "meta": {
179
+ "page": 0,
180
+ "page_size": 50,
181
+ "first_page_url": "https://conversations.twilio.com/v1/Credentials?PageSize=50&Page=0",
182
+ "previous_page_url": null,
183
+ "url": "https://conversations.twilio.com/v1/Credentials?PageSize=50&Page=0",
184
+ "next_page_url": null,
185
+ "key": "credentials"
186
+ }
187
+ }
188
+ ]
189
+ ))
190
+
191
+ actual = @client.conversations.v1.credentials.list()
192
+
193
+ expect(actual).to_not eq(nil)
194
+ end
195
+
196
+ it "receives read_empty responses" do
197
+ @holodeck.mock(Twilio::Response.new(
198
+ 200,
199
+ %q[
200
+ {
201
+ "credentials": [],
202
+ "meta": {
203
+ "page": 0,
204
+ "page_size": 50,
205
+ "first_page_url": "https://conversations.twilio.com/v1/Credentials?PageSize=50&Page=0",
206
+ "previous_page_url": null,
207
+ "url": "https://conversations.twilio.com/v1/Credentials?PageSize=50&Page=0",
208
+ "next_page_url": null,
209
+ "key": "credentials"
210
+ }
211
+ }
212
+ ]
213
+ ))
214
+
215
+ actual = @client.conversations.v1.credentials.list()
216
+
217
+ expect(actual).to_not eq(nil)
218
+ end
219
+ end
@@ -0,0 +1,107 @@
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 'Notification' do
12
+ it "can update" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.conversations.v1.notifications('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ expect(
20
+ @holodeck.has_request?(Holodeck::Request.new(
21
+ method: 'post',
22
+ url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration/Notifications',
23
+ ))).to eq(true)
24
+ end
25
+
26
+ it "receives update responses" do
27
+ @holodeck.mock(Twilio::Response.new(
28
+ 200,
29
+ %q[
30
+ {
31
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "log_enabled": true,
34
+ "added_to_conversation": {
35
+ "enabled": false,
36
+ "template": "notifications.added_to_conversation.template",
37
+ "sound": "ring"
38
+ },
39
+ "new_message": {
40
+ "enabled": false,
41
+ "template": "notifications.new_message.template",
42
+ "badge_count_enabled": true,
43
+ "sound": "ring"
44
+ },
45
+ "removed_from_conversation": {
46
+ "enabled": false,
47
+ "template": "notifications.removed_from_conversation.template",
48
+ "sound": "ring"
49
+ },
50
+ "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications"
51
+ }
52
+ ]
53
+ ))
54
+
55
+ actual = @client.conversations.v1.notifications('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
56
+
57
+ expect(actual).to_not eq(nil)
58
+ end
59
+
60
+ it "can fetch" do
61
+ @holodeck.mock(Twilio::Response.new(500, ''))
62
+
63
+ expect {
64
+ @client.conversations.v1.notifications('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
65
+ }.to raise_exception(Twilio::REST::TwilioError)
66
+
67
+ expect(
68
+ @holodeck.has_request?(Holodeck::Request.new(
69
+ method: 'get',
70
+ url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration/Notifications',
71
+ ))).to eq(true)
72
+ end
73
+
74
+ it "receives fetch responses" do
75
+ @holodeck.mock(Twilio::Response.new(
76
+ 200,
77
+ %q[
78
+ {
79
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
80
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
81
+ "log_enabled": false,
82
+ "added_to_conversation": {
83
+ "enabled": true,
84
+ "template": "notifications.added_to_conversation.template",
85
+ "sound": "ring"
86
+ },
87
+ "new_message": {
88
+ "enabled": true,
89
+ "template": "notifications.new_message.template",
90
+ "badge_count_enabled": false,
91
+ "sound": "ring"
92
+ },
93
+ "removed_from_conversation": {
94
+ "enabled": true,
95
+ "template": "notifications.removed_from_conversation.template",
96
+ "sound": "ring"
97
+ },
98
+ "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications"
99
+ }
100
+ ]
101
+ ))
102
+
103
+ actual = @client.conversations.v1.notifications('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
104
+
105
+ expect(actual).to_not eq(nil)
106
+ end
107
+ end
@@ -0,0 +1,249 @@
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 'Role' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.conversations.v1.roles.create(friendly_name: 'friendly_name', type: 'conversation', permission: ['permission'])
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {
20
+ 'FriendlyName' => 'friendly_name',
21
+ 'Type' => 'conversation',
22
+ 'Permission' => Twilio.serialize_list(['permission']) { |e| e },
23
+ }
24
+ expect(
25
+ @holodeck.has_request?(Holodeck::Request.new(
26
+ method: 'post',
27
+ url: 'https://conversations.twilio.com/v1/Roles',
28
+ data: values,
29
+ ))).to eq(true)
30
+ end
31
+
32
+ it "receives create responses" do
33
+ @holodeck.mock(Twilio::Response.new(
34
+ 201,
35
+ %q[
36
+ {
37
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
40
+ "friendly_name": "Conversation Role",
41
+ "type": "conversation",
42
+ "permissions": [
43
+ "sendMessage",
44
+ "leaveConversation",
45
+ "editOwnMessage",
46
+ "deleteOwnMessage"
47
+ ],
48
+ "date_created": "2016-03-03T19:47:15Z",
49
+ "date_updated": "2016-03-03T19:47:15Z",
50
+ "url": "https://conversations.twilio.com/v1/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
51
+ }
52
+ ]
53
+ ))
54
+
55
+ actual = @client.conversations.v1.roles.create(friendly_name: 'friendly_name', type: 'conversation', permission: ['permission'])
56
+
57
+ expect(actual).to_not eq(nil)
58
+ end
59
+
60
+ it "can update" do
61
+ @holodeck.mock(Twilio::Response.new(500, ''))
62
+
63
+ expect {
64
+ @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(permission: ['permission'])
65
+ }.to raise_exception(Twilio::REST::TwilioError)
66
+
67
+ values = {'Permission' => Twilio.serialize_list(['permission']) { |e| e }, }
68
+ expect(
69
+ @holodeck.has_request?(Holodeck::Request.new(
70
+ method: 'post',
71
+ url: 'https://conversations.twilio.com/v1/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
72
+ data: values,
73
+ ))).to eq(true)
74
+ end
75
+
76
+ it "receives update responses" do
77
+ @holodeck.mock(Twilio::Response.new(
78
+ 200,
79
+ %q[
80
+ {
81
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
82
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
83
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
84
+ "friendly_name": "Conversation Role",
85
+ "type": "conversation",
86
+ "permissions": [
87
+ "sendMessage",
88
+ "leaveConversation",
89
+ "editOwnMessage",
90
+ "deleteOwnMessage"
91
+ ],
92
+ "date_created": "2016-03-03T19:47:15Z",
93
+ "date_updated": "2016-03-03T19:47:15Z",
94
+ "url": "https://conversations.twilio.com/v1/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
95
+ }
96
+ ]
97
+ ))
98
+
99
+ actual = @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(permission: ['permission'])
100
+
101
+ expect(actual).to_not eq(nil)
102
+ end
103
+
104
+ it "can delete" do
105
+ @holodeck.mock(Twilio::Response.new(500, ''))
106
+
107
+ expect {
108
+ @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
109
+ }.to raise_exception(Twilio::REST::TwilioError)
110
+
111
+ expect(
112
+ @holodeck.has_request?(Holodeck::Request.new(
113
+ method: 'delete',
114
+ url: 'https://conversations.twilio.com/v1/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
115
+ ))).to eq(true)
116
+ end
117
+
118
+ it "receives delete responses" do
119
+ @holodeck.mock(Twilio::Response.new(
120
+ 204,
121
+ nil,
122
+ ))
123
+
124
+ actual = @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
125
+
126
+ expect(actual).to eq(true)
127
+ end
128
+
129
+ it "can fetch" do
130
+ @holodeck.mock(Twilio::Response.new(500, ''))
131
+
132
+ expect {
133
+ @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
134
+ }.to raise_exception(Twilio::REST::TwilioError)
135
+
136
+ expect(
137
+ @holodeck.has_request?(Holodeck::Request.new(
138
+ method: 'get',
139
+ url: 'https://conversations.twilio.com/v1/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
140
+ ))).to eq(true)
141
+ end
142
+
143
+ it "receives fetch responses" do
144
+ @holodeck.mock(Twilio::Response.new(
145
+ 200,
146
+ %q[
147
+ {
148
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
149
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
150
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
151
+ "friendly_name": "Conversation Role",
152
+ "type": "conversation",
153
+ "permissions": [
154
+ "sendMessage",
155
+ "leaveConversation",
156
+ "editOwnMessage",
157
+ "deleteOwnMessage"
158
+ ],
159
+ "date_created": "2016-03-03T19:47:15Z",
160
+ "date_updated": "2016-03-03T19:47:15Z",
161
+ "url": "https://conversations.twilio.com/v1/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
162
+ }
163
+ ]
164
+ ))
165
+
166
+ actual = @client.conversations.v1.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
167
+
168
+ expect(actual).to_not eq(nil)
169
+ end
170
+
171
+ it "can read" do
172
+ @holodeck.mock(Twilio::Response.new(500, ''))
173
+
174
+ expect {
175
+ @client.conversations.v1.roles.list()
176
+ }.to raise_exception(Twilio::REST::TwilioError)
177
+
178
+ expect(
179
+ @holodeck.has_request?(Holodeck::Request.new(
180
+ method: 'get',
181
+ url: 'https://conversations.twilio.com/v1/Roles',
182
+ ))).to eq(true)
183
+ end
184
+
185
+ it "receives read_full responses" do
186
+ @holodeck.mock(Twilio::Response.new(
187
+ 200,
188
+ %q[
189
+ {
190
+ "meta": {
191
+ "page": 0,
192
+ "page_size": 50,
193
+ "first_page_url": "https://conversations.twilio.com/v1/Roles?PageSize=50&Page=0",
194
+ "previous_page_url": null,
195
+ "url": "https://conversations.twilio.com/v1/Roles?PageSize=50&Page=0",
196
+ "next_page_url": null,
197
+ "key": "roles"
198
+ },
199
+ "roles": [
200
+ {
201
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
202
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
203
+ "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
204
+ "friendly_name": "Conversation Role",
205
+ "type": "conversation",
206
+ "permissions": [
207
+ "sendMessage",
208
+ "leaveConversation",
209
+ "editOwnMessage",
210
+ "deleteOwnMessage"
211
+ ],
212
+ "date_created": "2016-03-03T19:47:15Z",
213
+ "date_updated": "2016-03-03T19:47:15Z",
214
+ "url": "https://conversations.twilio.com/v1/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ ))
220
+
221
+ actual = @client.conversations.v1.roles.list()
222
+
223
+ expect(actual).to_not eq(nil)
224
+ end
225
+
226
+ it "receives read_empty responses" do
227
+ @holodeck.mock(Twilio::Response.new(
228
+ 200,
229
+ %q[
230
+ {
231
+ "meta": {
232
+ "page": 0,
233
+ "page_size": 50,
234
+ "first_page_url": "https://conversations.twilio.com/v1/Roles?PageSize=50&Page=0",
235
+ "previous_page_url": null,
236
+ "url": "https://conversations.twilio.com/v1/Roles?PageSize=50&Page=0",
237
+ "next_page_url": null,
238
+ "key": "roles"
239
+ },
240
+ "roles": []
241
+ }
242
+ ]
243
+ ))
244
+
245
+ actual = @client.conversations.v1.roles.list()
246
+
247
+ expect(actual).to_not eq(nil)
248
+ end
249
+ end