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,242 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'User' do
10
+ it "can fetch" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
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": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "identity": "jing",
36
+ "attributes": null,
37
+ "friendly_name": null,
38
+ "date_created": "2016-03-24T21:05:19Z",
39
+ "date_updated": "2016-03-24T21:05:19Z",
40
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
41
+ }
42
+ ]
43
+ ))
44
+
45
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
46
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
47
+
48
+ expect(actual).to_not eq(nil)
49
+ end
50
+
51
+ it "can delete" do
52
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
53
+
54
+ expect {
55
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
56
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
57
+ }.to raise_exception(Twilio::REST::TwilioException)
58
+
59
+ values = {}
60
+ expect(
61
+ @holodeck.has_request?(Holodeck::Request.new(
62
+ method: 'delete',
63
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
64
+ ))).to eq(true)
65
+ end
66
+
67
+ it "receives delete responses" do
68
+ @holodeck.mock(Twilio::TwilioResponse.new(
69
+ 204,
70
+ nil,
71
+ ))
72
+
73
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
74
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
75
+
76
+ expect(actual).to eq(true)
77
+ end
78
+
79
+ it "can create" do
80
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
81
+
82
+ expect {
83
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
84
+ .users.create(identity: "identity")
85
+ }.to raise_exception(Twilio::REST::TwilioException)
86
+
87
+ values = {
88
+ 'Identity' => "identity",
89
+ }
90
+ expect(
91
+ @holodeck.has_request?(Holodeck::Request.new(
92
+ method: 'post',
93
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users',
94
+ data: values,
95
+ ))).to eq(true)
96
+ end
97
+
98
+ it "receives create responses" do
99
+ @holodeck.mock(Twilio::TwilioResponse.new(
100
+ 201,
101
+ %q[
102
+ {
103
+ "sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
104
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
105
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
106
+ "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
107
+ "identity": "jing",
108
+ "attributes": null,
109
+ "friendly_name": null,
110
+ "date_created": "2016-03-24T21:05:19Z",
111
+ "date_updated": "2016-03-24T21:05:19Z",
112
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
113
+ }
114
+ ]
115
+ ))
116
+
117
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
118
+ .users.create(identity: "identity")
119
+
120
+ expect(actual).to_not eq(nil)
121
+ end
122
+
123
+ it "can read" do
124
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
125
+
126
+ expect {
127
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
128
+ .users.list()
129
+ }.to raise_exception(Twilio::REST::TwilioException)
130
+
131
+ values = {}
132
+ expect(
133
+ @holodeck.has_request?(Holodeck::Request.new(
134
+ method: 'get',
135
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users',
136
+ ))).to eq(true)
137
+ end
138
+
139
+ it "receives read_full responses" do
140
+ @holodeck.mock(Twilio::TwilioResponse.new(
141
+ 200,
142
+ %q[
143
+ {
144
+ "meta": {
145
+ "page": 0,
146
+ "page_size": 1,
147
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=1&Page=0",
148
+ "previous_page_url": null,
149
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=1&Page=0",
150
+ "next_page_url": null,
151
+ "key": "users"
152
+ },
153
+ "users": [
154
+ {
155
+ "sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
156
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
157
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
158
+ "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
159
+ "identity": "jing",
160
+ "attributes": null,
161
+ "friendly_name": null,
162
+ "date_created": "2016-03-24T21:05:19Z",
163
+ "date_updated": "2016-03-24T21:05:19Z",
164
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
165
+ }
166
+ ]
167
+ }
168
+ ]
169
+ ))
170
+
171
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
172
+ .users.list()
173
+
174
+ expect(actual).to_not eq(nil)
175
+ end
176
+
177
+ it "receives read_empty responses" do
178
+ @holodeck.mock(Twilio::TwilioResponse.new(
179
+ 200,
180
+ %q[
181
+ {
182
+ "meta": {
183
+ "page": 0,
184
+ "page_size": 1,
185
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=1&Page=0",
186
+ "previous_page_url": null,
187
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=1&Page=0",
188
+ "next_page_url": null,
189
+ "key": "users"
190
+ },
191
+ "users": []
192
+ }
193
+ ]
194
+ ))
195
+
196
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
197
+ .users.list()
198
+
199
+ expect(actual).to_not eq(nil)
200
+ end
201
+
202
+ it "can update" do
203
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
204
+
205
+ expect {
206
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
207
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
208
+ }.to raise_exception(Twilio::REST::TwilioException)
209
+
210
+ values = {}
211
+ expect(
212
+ @holodeck.has_request?(Holodeck::Request.new(
213
+ method: 'post',
214
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
215
+ ))).to eq(true)
216
+ end
217
+
218
+ it "receives update responses" do
219
+ @holodeck.mock(Twilio::TwilioResponse.new(
220
+ 200,
221
+ %q[
222
+ {
223
+ "sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
224
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
225
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
226
+ "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
227
+ "identity": "jing",
228
+ "attributes": null,
229
+ "friendly_name": null,
230
+ "date_created": "2016-03-24T21:05:19Z",
231
+ "date_updated": "2016-03-24T21:05:19Z",
232
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
233
+ }
234
+ ]
235
+ ))
236
+
237
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
238
+ .users("USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
239
+
240
+ expect(actual).to_not eq(nil)
241
+ end
242
+ 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 'Service' do
10
+ it "can fetch" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
15
+ }.to raise_exception(Twilio::REST::TwilioException)
16
+
17
+ values = {}
18
+ expect(
19
+ @holodeck.has_request?(Holodeck::Request.new(
20
+ method: 'get',
21
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
22
+ ))).to eq(true)
23
+ end
24
+
25
+ it "receives fetch responses" do
26
+ @holodeck.mock(Twilio::TwilioResponse.new(
27
+ 200,
28
+ %q[
29
+ {
30
+ "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
31
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
+ "friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
33
+ "date_created": "2015-12-16T17:53:05Z",
34
+ "date_updated": "2015-12-16T17:53:05Z",
35
+ "default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "read_status_enabled": true,
39
+ "typing_indicator_timeout": 5,
40
+ "consumption_report_interval": 10,
41
+ "webhooks": {},
42
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
43
+ "links": {
44
+ "channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
45
+ "roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
46
+ "users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
47
+ }
48
+ }
49
+ ]
50
+ ))
51
+
52
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
53
+
54
+ expect(actual).to_not eq(nil)
55
+ end
56
+
57
+ it "can delete" do
58
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
59
+
60
+ expect {
61
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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',
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").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.create(friendly_name: "friendly_name")
88
+ }.to raise_exception(Twilio::REST::TwilioException)
89
+
90
+ values = {
91
+ 'FriendlyName' => "friendly_name",
92
+ }
93
+ expect(
94
+ @holodeck.has_request?(Holodeck::Request.new(
95
+ method: 'post',
96
+ url: 'https://chat.twilio.com/v1/Services',
97
+ data: values,
98
+ ))).to eq(true)
99
+ end
100
+
101
+ it "receives create responses" do
102
+ @holodeck.mock(Twilio::TwilioResponse.new(
103
+ 201,
104
+ %q[
105
+ {
106
+ "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
107
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
108
+ "friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
109
+ "date_created": "2015-12-16T17:53:05Z",
110
+ "date_updated": "2015-12-16T17:53:05Z",
111
+ "default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112
+ "default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
113
+ "default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
114
+ "read_status_enabled": true,
115
+ "typing_indicator_timeout": 5,
116
+ "consumption_report_interval": 10,
117
+ "webhooks": {},
118
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
119
+ "links": {
120
+ "channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
121
+ "roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
122
+ "users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
123
+ }
124
+ }
125
+ ]
126
+ ))
127
+
128
+ actual = @client.chat.v1.services.create(friendly_name: "friendly_name")
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.list()
138
+ }.to raise_exception(Twilio::REST::TwilioException)
139
+
140
+ values = {}
141
+ expect(
142
+ @holodeck.has_request?(Holodeck::Request.new(
143
+ method: 'get',
144
+ url: 'https://chat.twilio.com/v1/Services',
145
+ ))).to eq(true)
146
+ end
147
+
148
+ it "receives read_full responses" do
149
+ @holodeck.mock(Twilio::TwilioResponse.new(
150
+ 200,
151
+ %q[
152
+ {
153
+ "meta": {
154
+ "page": 0,
155
+ "page_size": 1,
156
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services?PageSize=1&Page=0",
157
+ "previous_page_url": null,
158
+ "url": "https://ip-messaging.twilio.com/v1/Services?PageSize=1&Page=0",
159
+ "next_page_url": null,
160
+ "key": "services"
161
+ },
162
+ "services": [
163
+ {
164
+ "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
165
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
166
+ "friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
167
+ "date_created": "2015-12-16T17:53:05Z",
168
+ "date_updated": "2015-12-16T17:53:05Z",
169
+ "default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
170
+ "default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
171
+ "default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
172
+ "read_status_enabled": true,
173
+ "typing_indicator_timeout": 5,
174
+ "consumption_report_interval": 10,
175
+ "webhooks": {},
176
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
177
+ "links": {
178
+ "channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
179
+ "roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
180
+ "users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
181
+ }
182
+ }
183
+ ]
184
+ }
185
+ ]
186
+ ))
187
+
188
+ actual = @client.chat.v1.services.list()
189
+
190
+ expect(actual).to_not eq(nil)
191
+ end
192
+
193
+ it "receives read_empty responses" do
194
+ @holodeck.mock(Twilio::TwilioResponse.new(
195
+ 200,
196
+ %q[
197
+ {
198
+ "meta": {
199
+ "page": 0,
200
+ "page_size": 50,
201
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services?PageSize=50&Page=0",
202
+ "previous_page_url": null,
203
+ "url": "https://ip-messaging.twilio.com/v1/Services?PageSize=50&Page=0",
204
+ "next_page_url": null,
205
+ "key": "services"
206
+ },
207
+ "services": []
208
+ }
209
+ ]
210
+ ))
211
+
212
+ actual = @client.chat.v1.services.list()
213
+
214
+ expect(actual).to_not eq(nil)
215
+ end
216
+
217
+ it "can update" do
218
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
219
+
220
+ expect {
221
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
222
+ }.to raise_exception(Twilio::REST::TwilioException)
223
+
224
+ values = {}
225
+ expect(
226
+ @holodeck.has_request?(Holodeck::Request.new(
227
+ method: 'post',
228
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
229
+ ))).to eq(true)
230
+ end
231
+
232
+ it "receives update responses" do
233
+ @holodeck.mock(Twilio::TwilioResponse.new(
234
+ 200,
235
+ %q[
236
+ {
237
+ "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
238
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
239
+ "friendly_name": "216d4a5b-654a-4b60-acea-cf4e42604fb3",
240
+ "date_created": "2015-12-16T17:53:05Z",
241
+ "date_updated": "2015-12-16T17:53:05Z",
242
+ "default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
243
+ "default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
244
+ "default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
245
+ "read_status_enabled": true,
246
+ "typing_indicator_timeout": 5,
247
+ "consumption_report_interval": 10,
248
+ "webhooks": {},
249
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
250
+ "links": {
251
+ "channels": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",
252
+ "roles": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
253
+ "users": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
254
+ }
255
+ }
256
+ ]
257
+ ))
258
+
259
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
260
+
261
+ expect(actual).to_not eq(nil)
262
+ end
263
+ end