twilio-ruby 5.0.0.rc16 → 5.0.0.rc17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS.md +1 -0
  3. data/CHANGES.md +1 -1
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/jwt/access_token.rb +23 -1
  6. data/lib/twilio-ruby/rest/api.rb +2 -2
  7. data/lib/twilio-ruby/rest/api/v2010.rb +2 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account.rb +19 -11
  9. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +29 -5
  10. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
  11. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +25 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +406 -0
  13. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +2 -6
  14. data/lib/twilio-ruby/rest/{notifications.rb → chat.rb} +6 -6
  15. data/lib/twilio-ruby/rest/{notifications → chat}/v1.rb +3 -3
  16. data/lib/twilio-ruby/rest/{notifications → chat}/v1/credential.rb +5 -5
  17. data/lib/twilio-ruby/rest/chat/v1/service.rb +501 -0
  18. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +468 -0
  19. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +351 -0
  20. data/lib/twilio-ruby/rest/{api/v2010/account/sms/sms_message.rb → chat/v1/service/channel/message.rb} +120 -168
  21. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +373 -0
  22. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +378 -0
  23. data/lib/twilio-ruby/rest/client.rb +19 -8
  24. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +3 -1
  25. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -6
  26. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +5 -1
  27. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -0
  28. data/lib/twilio-ruby/rest/notify.rb +44 -0
  29. data/lib/twilio-ruby/rest/notify/v1.rb +44 -0
  30. data/lib/twilio-ruby/rest/notify/v1/credential.rb +375 -0
  31. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service.rb +5 -5
  32. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/binding.rb +5 -5
  33. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/notification.rb +4 -4
  34. data/lib/twilio-ruby/rest/preview.rb +11 -0
  35. data/lib/twilio-ruby/rest/preview/sync.rb +35 -0
  36. data/lib/twilio-ruby/rest/preview/sync/service.rb +458 -0
  37. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +376 -0
  38. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +375 -0
  39. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +409 -0
  40. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +375 -0
  41. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +411 -0
  42. data/lib/twilio-ruby/rest/preview/wireless/device.rb +6 -2
  43. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +55 -3
  44. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +29 -6
  45. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +294 -0
  46. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +32 -0
  47. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +374 -0
  48. data/lib/twilio-ruby/version.rb +1 -1
  49. data/spec/integration/api/v2010/account/conference/participant_spec.rb +6 -6
  50. data/spec/integration/api/v2010/account/recording_spec.rb +10 -1
  51. data/spec/integration/api/v2010/account/{sms/short_code_spec.rb → short_code_spec.rb} +0 -7
  52. data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +3 -7
  53. data/spec/integration/chat/v1/credential_spec.rb +223 -0
  54. data/spec/integration/chat/v1/service/channel/member_spec.rb +213 -0
  55. data/spec/integration/chat/v1/service/channel/message_spec.rb +100 -0
  56. data/spec/integration/chat/v1/service/channel_spec.rb +259 -0
  57. data/spec/integration/chat/v1/service/role_spec.rb +263 -0
  58. data/spec/integration/chat/v1/service/user_spec.rb +242 -0
  59. data/spec/integration/chat/v1/service_spec.rb +263 -0
  60. data/spec/integration/ip_messaging/v1/service/role_spec.rb +2 -3
  61. data/spec/integration/ip_messaging/v1/service/user_spec.rb +2 -3
  62. data/spec/integration/lookups/v1/phone_number_spec.rb +5 -0
  63. data/spec/integration/{notifications → notify}/v1/credential_spec.rb +24 -24
  64. data/spec/integration/{notifications → notify}/v1/service/binding_spec.rb +29 -29
  65. data/spec/integration/{notifications → notify}/v1/service/notification_spec.rb +5 -5
  66. data/spec/integration/{notifications → notify}/v1/service_spec.rb +32 -32
  67. data/spec/integration/preview/sync/service/document_spec.rb +92 -0
  68. data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +100 -0
  69. data/spec/integration/preview/sync/service/sync_list_spec.rb +73 -0
  70. data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +101 -0
  71. data/spec/integration/preview/sync/service/sync_map_spec.rb +73 -0
  72. data/spec/integration/preview/sync/service_spec.rb +84 -0
  73. data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +127 -0
  74. data/spec/integration/taskrouter/v1/workspace/task_spec.rb +8 -0
  75. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +201 -0
  76. data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +2 -3
  77. data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
  78. data/spec/jwt/access_token_spec.rb +27 -0
  79. metadata +84 -42
  80. data/lib/twilio-ruby/rest/api/v2010/account/sms.rb +0 -134
  81. data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -408
  82. data/spec/integration/api/v2010/account/sms/sms_message_spec.rb +0 -275
  83. data/spec/integration/api/v2010/account/sms_spec.rb +0 -10
@@ -0,0 +1,100 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Message' do
10
+ it "can fetch" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
16
+ .messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
17
+ }.to raise_exception(Twilio::REST::TwilioException)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "can create" do
28
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
29
+
30
+ expect {
31
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
32
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
33
+ .messages.create(body: "body")
34
+ }.to raise_exception(Twilio::REST::TwilioException)
35
+
36
+ values = {
37
+ 'Body' => "body",
38
+ }
39
+ expect(
40
+ @holodeck.has_request?(Holodeck::Request.new(
41
+ method: 'post',
42
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
43
+ data: values,
44
+ ))).to eq(true)
45
+ end
46
+
47
+ it "can read" do
48
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
49
+
50
+ expect {
51
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
52
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
53
+ .messages.list()
54
+ }.to raise_exception(Twilio::REST::TwilioException)
55
+
56
+ values = {}
57
+ expect(
58
+ @holodeck.has_request?(Holodeck::Request.new(
59
+ method: 'get',
60
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
61
+ ))).to eq(true)
62
+ end
63
+
64
+ it "can delete" do
65
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
66
+
67
+ expect {
68
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
69
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
70
+ .messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
71
+ }.to raise_exception(Twilio::REST::TwilioException)
72
+
73
+ values = {}
74
+ expect(
75
+ @holodeck.has_request?(Holodeck::Request.new(
76
+ method: 'delete',
77
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
78
+ ))).to eq(true)
79
+ end
80
+
81
+ it "can update" do
82
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
83
+
84
+ expect {
85
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
86
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
87
+ .messages("IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(body: "body")
88
+ }.to raise_exception(Twilio::REST::TwilioException)
89
+
90
+ values = {
91
+ 'Body' => "body",
92
+ }
93
+ expect(
94
+ @holodeck.has_request?(Holodeck::Request.new(
95
+ method: 'post',
96
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
97
+ data: values,
98
+ ))).to eq(true)
99
+ end
100
+ end
@@ -0,0 +1,259 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Channel' do
10
+ it "can fetch" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
16
+ }.to raise_exception(Twilio::REST::TwilioException)
17
+
18
+ values = {}
19
+ expect(
20
+ @holodeck.has_request?(Holodeck::Request.new(
21
+ method: 'get',
22
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
23
+ ))).to eq(true)
24
+ end
25
+
26
+ it "receives fetch responses" do
27
+ @holodeck.mock(Twilio::TwilioResponse.new(
28
+ 200,
29
+ %q[
30
+ {
31
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "friendly_name": "d816d8da-51c0-44e1-928a-44822f49bc95",
35
+ "unique_name": "c64ad6b0-0090-4cfc-b574-b1ce5208ac0b",
36
+ "attributes": null,
37
+ "type": "public",
38
+ "date_created": "2015-12-16T22:18:37Z",
39
+ "date_updated": "2015-12-16T22:18:37Z",
40
+ "created_by": "system",
41
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42
+ "links": {
43
+ "members": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members",
44
+ "messages": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
45
+ }
46
+ }
47
+ ]
48
+ ))
49
+
50
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
51
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
52
+
53
+ expect(actual).to_not eq(nil)
54
+ end
55
+
56
+ it "can delete" do
57
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
58
+
59
+ expect {
60
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
61
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
62
+ }.to raise_exception(Twilio::REST::TwilioException)
63
+
64
+ values = {}
65
+ expect(
66
+ @holodeck.has_request?(Holodeck::Request.new(
67
+ method: 'delete',
68
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
69
+ ))).to eq(true)
70
+ end
71
+
72
+ it "receives delete responses" do
73
+ @holodeck.mock(Twilio::TwilioResponse.new(
74
+ 204,
75
+ nil,
76
+ ))
77
+
78
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
79
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
80
+
81
+ expect(actual).to eq(true)
82
+ end
83
+
84
+ it "can create" do
85
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
86
+
87
+ expect {
88
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
89
+ .channels.create()
90
+ }.to raise_exception(Twilio::REST::TwilioException)
91
+
92
+ values = {}
93
+ expect(
94
+ @holodeck.has_request?(Holodeck::Request.new(
95
+ method: 'post',
96
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels',
97
+ ))).to eq(true)
98
+ end
99
+
100
+ it "receives create responses" do
101
+ @holodeck.mock(Twilio::TwilioResponse.new(
102
+ 201,
103
+ %q[
104
+ {
105
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
106
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
107
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
108
+ "friendly_name": "d816d8da-51c0-44e1-928a-44822f49bc95",
109
+ "unique_name": "c64ad6b0-0090-4cfc-b574-b1ce5208ac0b",
110
+ "attributes": null,
111
+ "type": "public",
112
+ "date_created": "2015-12-16T22:18:37Z",
113
+ "date_updated": "2015-12-16T22:18:37Z",
114
+ "created_by": "system",
115
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
116
+ "links": {
117
+ "members": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members",
118
+ "messages": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
119
+ }
120
+ }
121
+ ]
122
+ ))
123
+
124
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
125
+ .channels.create()
126
+
127
+ expect(actual).to_not eq(nil)
128
+ end
129
+
130
+ it "can read" do
131
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
132
+
133
+ expect {
134
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
135
+ .channels.list()
136
+ }.to raise_exception(Twilio::REST::TwilioException)
137
+
138
+ values = {}
139
+ expect(
140
+ @holodeck.has_request?(Holodeck::Request.new(
141
+ method: 'get',
142
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels',
143
+ ))).to eq(true)
144
+ end
145
+
146
+ it "receives read_full responses" do
147
+ @holodeck.mock(Twilio::TwilioResponse.new(
148
+ 200,
149
+ %q[
150
+ {
151
+ "channels": [
152
+ {
153
+ "sid": "CHc12e6f1419b244fe8da312bc2cdebebc",
154
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
155
+ "service_sid": "IS034e4a0c83f94e10a2ab4a3c19a16a86",
156
+ "friendly_name": "d816d8da-51c0-44e1-928a-44822f49bc95",
157
+ "unique_name": "c64ad6b0-0090-4cfc-b574-b1ce5208ac0b",
158
+ "attributes": null,
159
+ "type": "public",
160
+ "date_created": "2015-12-16T22:18:37Z",
161
+ "date_updated": "2015-12-16T22:18:37Z",
162
+ "created_by": "system",
163
+ "url": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels/CHc12e6f1419b244fe8da312bc2cdebebc",
164
+ "links": {
165
+ "members": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels/CHc12e6f1419b244fe8da312bc2cdebebc/Members",
166
+ "messages": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels/CHc12e6f1419b244fe8da312bc2cdebebc/Messages"
167
+ }
168
+ }
169
+ ],
170
+ "meta": {
171
+ "page": 0,
172
+ "page_size": 1,
173
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels?PageSize=1&Page=0",
174
+ "previous_page_url": null,
175
+ "url": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels?PageSize=1&Page=0",
176
+ "next_page_url": null,
177
+ "key": "channels"
178
+ }
179
+ }
180
+ ]
181
+ ))
182
+
183
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
184
+ .channels.list()
185
+
186
+ expect(actual).to_not eq(nil)
187
+ end
188
+
189
+ it "receives read_empty responses" do
190
+ @holodeck.mock(Twilio::TwilioResponse.new(
191
+ 200,
192
+ %q[
193
+ {
194
+ "channels": [],
195
+ "meta": {
196
+ "page": 0,
197
+ "page_size": 1,
198
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels?PageSize=1&Page=0",
199
+ "previous_page_url": null,
200
+ "url": "https://ip-messaging.twilio.com/v1/Services/IS034e4a0c83f94e10a2ab4a3c19a16a86/Channels?PageSize=1&Page=0",
201
+ "next_page_url": null,
202
+ "key": "channels"
203
+ }
204
+ }
205
+ ]
206
+ ))
207
+
208
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
209
+ .channels.list()
210
+
211
+ expect(actual).to_not eq(nil)
212
+ end
213
+
214
+ it "can update" do
215
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
216
+
217
+ expect {
218
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
219
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
220
+ }.to raise_exception(Twilio::REST::TwilioException)
221
+
222
+ values = {}
223
+ expect(
224
+ @holodeck.has_request?(Holodeck::Request.new(
225
+ method: 'post',
226
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
227
+ ))).to eq(true)
228
+ end
229
+
230
+ it "receives update responses" do
231
+ @holodeck.mock(Twilio::TwilioResponse.new(
232
+ 200,
233
+ %q[
234
+ {
235
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
236
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
237
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
238
+ "friendly_name": "d816d8da-51c0-44e1-928a-44822f49bc95",
239
+ "unique_name": "c64ad6b0-0090-4cfc-b574-b1ce5208ac0b",
240
+ "attributes": null,
241
+ "type": "public",
242
+ "date_created": "2015-12-16T22:18:37Z",
243
+ "date_updated": "2015-12-16T22:18:37Z",
244
+ "created_by": "system",
245
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
246
+ "links": {
247
+ "members": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members",
248
+ "messages": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
249
+ }
250
+ }
251
+ ]
252
+ ))
253
+
254
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
255
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
256
+
257
+ expect(actual).to_not eq(nil)
258
+ end
259
+ end
@@ -0,0 +1,263 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Role' do
10
+ it "can fetch" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
16
+ }.to raise_exception(Twilio::REST::TwilioException)
17
+
18
+ values = {}
19
+ expect(
20
+ @holodeck.has_request?(Holodeck::Request.new(
21
+ method: 'get',
22
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
23
+ ))).to eq(true)
24
+ end
25
+
26
+ it "receives fetch responses" do
27
+ @holodeck.mock(Twilio::TwilioResponse.new(
28
+ 200,
29
+ %q[
30
+ {
31
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "friendly_name": "channel user",
35
+ "type": "channel",
36
+ "permissions": [
37
+ "sendMessage",
38
+ "leaveChannel",
39
+ "editOwnMessage",
40
+ "deleteOwnMessage"
41
+ ],
42
+ "date_created": "2016-03-03T19:47:15Z",
43
+ "date_updated": "2016-03-03T19:47:15Z",
44
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
45
+ }
46
+ ]
47
+ ))
48
+
49
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
50
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can delete" do
56
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
57
+
58
+ expect {
59
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
60
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
61
+ }.to raise_exception(Twilio::REST::TwilioException)
62
+
63
+ values = {}
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'delete',
67
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
68
+ ))).to eq(true)
69
+ end
70
+
71
+ it "receives delete responses" do
72
+ @holodeck.mock(Twilio::TwilioResponse.new(
73
+ 204,
74
+ nil,
75
+ ))
76
+
77
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
78
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
79
+
80
+ expect(actual).to eq(true)
81
+ end
82
+
83
+ it "can create" do
84
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
85
+
86
+ expect {
87
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
88
+ .roles.create(friendly_name: "friendly_name", type: "channel", permission: ['permission'])
89
+ }.to raise_exception(Twilio::REST::TwilioException)
90
+
91
+ values = {
92
+ 'FriendlyName' => "friendly_name",
93
+ 'Type' => "channel",
94
+ 'Permission' => ['permission'],
95
+ }
96
+ expect(
97
+ @holodeck.has_request?(Holodeck::Request.new(
98
+ method: 'post',
99
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles',
100
+ data: values,
101
+ ))).to eq(true)
102
+ end
103
+
104
+ it "receives create responses" do
105
+ @holodeck.mock(Twilio::TwilioResponse.new(
106
+ 201,
107
+ %q[
108
+ {
109
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
110
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
111
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112
+ "friendly_name": "channel user",
113
+ "type": "channel",
114
+ "permissions": [
115
+ "sendMessage",
116
+ "leaveChannel",
117
+ "editOwnMessage",
118
+ "deleteOwnMessage"
119
+ ],
120
+ "date_created": "2016-03-03T19:47:15Z",
121
+ "date_updated": "2016-03-03T19:47:15Z",
122
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
123
+ }
124
+ ]
125
+ ))
126
+
127
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
128
+ .roles.create(friendly_name: "friendly_name", type: "channel", permission: ['permission'])
129
+
130
+ expect(actual).to_not eq(nil)
131
+ end
132
+
133
+ it "can read" do
134
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
135
+
136
+ expect {
137
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
138
+ .roles.list()
139
+ }.to raise_exception(Twilio::REST::TwilioException)
140
+
141
+ values = {}
142
+ expect(
143
+ @holodeck.has_request?(Holodeck::Request.new(
144
+ method: 'get',
145
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles',
146
+ ))).to eq(true)
147
+ end
148
+
149
+ it "receives read_full responses" do
150
+ @holodeck.mock(Twilio::TwilioResponse.new(
151
+ 200,
152
+ %q[
153
+ {
154
+ "meta": {
155
+ "page": 0,
156
+ "page_size": 1,
157
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=1&Page=0",
158
+ "previous_page_url": null,
159
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=1&Page=0",
160
+ "next_page_url": null,
161
+ "key": "roles"
162
+ },
163
+ "roles": [
164
+ {
165
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
166
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
167
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
168
+ "friendly_name": "channel user",
169
+ "type": "channel",
170
+ "permissions": [
171
+ "sendMessage",
172
+ "leaveChannel",
173
+ "editOwnMessage",
174
+ "deleteOwnMessage"
175
+ ],
176
+ "date_created": "2016-03-03T19:47:15Z",
177
+ "date_updated": "2016-03-03T19:47:15Z",
178
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ ))
184
+
185
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
186
+ .roles.list()
187
+
188
+ expect(actual).to_not eq(nil)
189
+ end
190
+
191
+ it "receives read_empty responses" do
192
+ @holodeck.mock(Twilio::TwilioResponse.new(
193
+ 200,
194
+ %q[
195
+ {
196
+ "meta": {
197
+ "page": 0,
198
+ "page_size": 1,
199
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=1&Page=0",
200
+ "previous_page_url": null,
201
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=1&Page=0",
202
+ "next_page_url": null,
203
+ "key": "roles"
204
+ },
205
+ "roles": []
206
+ }
207
+ ]
208
+ ))
209
+
210
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
211
+ .roles.list()
212
+
213
+ expect(actual).to_not eq(nil)
214
+ end
215
+
216
+ it "can update" do
217
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
218
+
219
+ expect {
220
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
221
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(permission: ['permission'])
222
+ }.to raise_exception(Twilio::REST::TwilioException)
223
+
224
+ values = {
225
+ 'Permission' => ['permission'],
226
+ }
227
+ expect(
228
+ @holodeck.has_request?(Holodeck::Request.new(
229
+ method: 'post',
230
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
231
+ data: values,
232
+ ))).to eq(true)
233
+ end
234
+
235
+ it "receives update responses" do
236
+ @holodeck.mock(Twilio::TwilioResponse.new(
237
+ 200,
238
+ %q[
239
+ {
240
+ "sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
241
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
242
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
243
+ "friendly_name": "channel user",
244
+ "type": "channel",
245
+ "permissions": [
246
+ "sendMessage",
247
+ "leaveChannel",
248
+ "editOwnMessage",
249
+ "deleteOwnMessage"
250
+ ],
251
+ "date_created": "2016-03-03T19:47:15Z",
252
+ "date_updated": "2016-03-03T19:47:15Z",
253
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
254
+ }
255
+ ]
256
+ ))
257
+
258
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
259
+ .roles("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(permission: ['permission'])
260
+
261
+ expect(actual).to_not eq(nil)
262
+ end
263
+ end