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
@@ -35,6 +35,11 @@ describe 'Recording' do
35
35
  "date_updated": "Wed, 01 Sep 2010 15:15:41 +0000",
36
36
  "duration": "6",
37
37
  "sid": "REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "price": "0.04",
39
+ "price_unit": "USD",
40
+ "status": "completed",
41
+ "channels": 1,
42
+ "source": "Trunking",
38
43
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
39
44
  }
40
45
  ]
@@ -111,8 +116,12 @@ describe 'Recording' do
111
116
  "date_created": "Wed, 22 Aug 2012 20:58:45 +0000",
112
117
  "date_updated": "Wed, 22 Aug 2012 20:58:45 +0000",
113
118
  "duration": null,
114
- "price": null,
119
+ "price": "0.04",
115
120
  "sid": "REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
121
+ "price_unit": "USD",
122
+ "status": "completed",
123
+ "channels": 1,
124
+ "source": "Trunking",
116
125
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
117
126
  }
118
127
  ],
@@ -12,7 +12,6 @@ describe 'ShortCode' do
12
12
 
13
13
  expect {
14
14
  @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
- .sms \
16
15
  .short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
17
16
  }.to raise_exception(Twilio::REST::TwilioException)
18
17
 
@@ -46,7 +45,6 @@ describe 'ShortCode' do
46
45
  ))
47
46
 
48
47
  actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
49
- .sms \
50
48
  .short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
51
49
 
52
50
  expect(actual).to_not eq(nil)
@@ -57,7 +55,6 @@ describe 'ShortCode' do
57
55
 
58
56
  expect {
59
57
  @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
60
- .sms \
61
58
  .short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
62
59
  }.to raise_exception(Twilio::REST::TwilioException)
63
60
 
@@ -91,7 +88,6 @@ describe 'ShortCode' do
91
88
  ))
92
89
 
93
90
  actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
94
- .sms \
95
91
  .short_codes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
96
92
 
97
93
  expect(actual).to_not eq(nil)
@@ -102,7 +98,6 @@ describe 'ShortCode' do
102
98
 
103
99
  expect {
104
100
  @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
105
- .sms \
106
101
  .short_codes.list()
107
102
  }.to raise_exception(Twilio::REST::TwilioException)
108
103
 
@@ -151,7 +146,6 @@ describe 'ShortCode' do
151
146
  ))
152
147
 
153
148
  actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
154
- .sms \
155
149
  .short_codes.list()
156
150
 
157
151
  expect(actual).to_not eq(nil)
@@ -179,7 +173,6 @@ describe 'ShortCode' do
179
173
  ))
180
174
 
181
175
  actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
182
- .sms \
183
176
  .short_codes.list()
184
177
 
185
178
  expect(actual).to_not eq(nil)
@@ -188,18 +188,14 @@ describe 'Credential' do
188
188
  @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
189
189
  .sip \
190
190
  .credential_lists("CLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
191
- .credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(username: "username", password: "password")
191
+ .credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
192
192
  }.to raise_exception(Twilio::REST::TwilioException)
193
193
 
194
- values = {
195
- 'Username' => "username",
196
- 'Password' => "password",
197
- }
194
+ values = {}
198
195
  expect(
199
196
  @holodeck.has_request?(Holodeck::Request.new(
200
197
  method: 'post',
201
198
  url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/CredentialLists/CLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json',
202
- data: values,
203
199
  ))).to eq(true)
204
200
  end
205
201
 
@@ -222,7 +218,7 @@ describe 'Credential' do
222
218
  actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
223
219
  .sip \
224
220
  .credential_lists("CLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
225
- .credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(username: "username", password: "password")
221
+ .credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
226
222
 
227
223
  expect(actual).to_not eq(nil)
228
224
  end
@@ -0,0 +1,223 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Credential' do
10
+ it "can read" do
11
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
12
+
13
+ expect {
14
+ @client.chat.v1.credentials.list()
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/Credentials',
22
+ ))).to eq(true)
23
+ end
24
+
25
+ it "receives read_full responses" do
26
+ @holodeck.mock(Twilio::TwilioResponse.new(
27
+ 200,
28
+ %q[
29
+ {
30
+ "credentials": [
31
+ {
32
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "friendly_name": "Test slow create",
35
+ "type": "apn",
36
+ "sandbox": "False",
37
+ "date_created": "2015-10-07T17:50:01Z",
38
+ "date_updated": "2015-10-07T17:50:01Z",
39
+ "url": "https://ip-messaging.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
40
+ }
41
+ ],
42
+ "meta": {
43
+ "page": 0,
44
+ "page_size": 1,
45
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Credentials?PageSize=1&Page=0",
46
+ "previous_page_url": null,
47
+ "url": "https://ip-messaging.twilio.com/v1/Credentials?PageSize=1&Page=0",
48
+ "next_page_url": null,
49
+ "key": "credentials"
50
+ }
51
+ }
52
+ ]
53
+ ))
54
+
55
+ actual = @client.chat.v1.credentials.list()
56
+
57
+ expect(actual).to_not eq(nil)
58
+ end
59
+
60
+ it "receives read_empty responses" do
61
+ @holodeck.mock(Twilio::TwilioResponse.new(
62
+ 200,
63
+ %q[
64
+ {
65
+ "credentials": [],
66
+ "meta": {
67
+ "page": 0,
68
+ "page_size": 1,
69
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Credentials?PageSize=1&Page=0",
70
+ "previous_page_url": null,
71
+ "url": "https://ip-messaging.twilio.com/v1/Credentials?PageSize=1&Page=0",
72
+ "next_page_url": null,
73
+ "key": "credentials"
74
+ }
75
+ }
76
+ ]
77
+ ))
78
+
79
+ actual = @client.chat.v1.credentials.list()
80
+
81
+ expect(actual).to_not eq(nil)
82
+ end
83
+
84
+ it "can create" do
85
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
86
+
87
+ expect {
88
+ @client.chat.v1.credentials.create(type: "gcm")
89
+ }.to raise_exception(Twilio::REST::TwilioException)
90
+
91
+ values = {
92
+ 'Type' => "gcm",
93
+ }
94
+ expect(
95
+ @holodeck.has_request?(Holodeck::Request.new(
96
+ method: 'post',
97
+ url: 'https://chat.twilio.com/v1/Credentials',
98
+ data: values,
99
+ ))).to eq(true)
100
+ end
101
+
102
+ it "receives create responses" do
103
+ @holodeck.mock(Twilio::TwilioResponse.new(
104
+ 201,
105
+ %q[
106
+ {
107
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
108
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
109
+ "friendly_name": "Test slow create",
110
+ "type": "apn",
111
+ "sandbox": "False",
112
+ "date_created": "2015-10-07T17:50:01Z",
113
+ "date_updated": "2015-10-07T17:50:01Z",
114
+ "url": "https://ip-messaging.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
115
+ }
116
+ ]
117
+ ))
118
+
119
+ actual = @client.chat.v1.credentials.create(type: "gcm")
120
+
121
+ expect(actual).to_not eq(nil)
122
+ end
123
+
124
+ it "can fetch" do
125
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
126
+
127
+ expect {
128
+ @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
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/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
136
+ ))).to eq(true)
137
+ end
138
+
139
+ it "receives fetch responses" do
140
+ @holodeck.mock(Twilio::TwilioResponse.new(
141
+ 200,
142
+ %q[
143
+ {
144
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
145
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
146
+ "friendly_name": "Test slow create",
147
+ "type": "apn",
148
+ "sandbox": "False",
149
+ "date_created": "2015-10-07T17:50:01Z",
150
+ "date_updated": "2015-10-07T17:50:01Z",
151
+ "url": "https://ip-messaging.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
152
+ }
153
+ ]
154
+ ))
155
+
156
+ actual = @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
157
+
158
+ expect(actual).to_not eq(nil)
159
+ end
160
+
161
+ it "can update" do
162
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
163
+
164
+ expect {
165
+ @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
166
+ }.to raise_exception(Twilio::REST::TwilioException)
167
+
168
+ values = {}
169
+ expect(
170
+ @holodeck.has_request?(Holodeck::Request.new(
171
+ method: 'post',
172
+ url: 'https://chat.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
173
+ ))).to eq(true)
174
+ end
175
+
176
+ it "receives update responses" do
177
+ @holodeck.mock(Twilio::TwilioResponse.new(
178
+ 200,
179
+ %q[
180
+ {
181
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
182
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
183
+ "friendly_name": "Test slow create",
184
+ "type": "apn",
185
+ "sandbox": "False",
186
+ "date_created": "2015-10-07T17:50:01Z",
187
+ "date_updated": "2015-10-07T17:50:01Z",
188
+ "url": "https://ip-messaging.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
189
+ }
190
+ ]
191
+ ))
192
+
193
+ actual = @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
194
+
195
+ expect(actual).to_not eq(nil)
196
+ end
197
+
198
+ it "can delete" do
199
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
200
+
201
+ expect {
202
+ @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
203
+ }.to raise_exception(Twilio::REST::TwilioException)
204
+
205
+ values = {}
206
+ expect(
207
+ @holodeck.has_request?(Holodeck::Request.new(
208
+ method: 'delete',
209
+ url: 'https://chat.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
210
+ ))).to eq(true)
211
+ end
212
+
213
+ it "receives delete responses" do
214
+ @holodeck.mock(Twilio::TwilioResponse.new(
215
+ 204,
216
+ nil,
217
+ ))
218
+
219
+ actual = @client.chat.v1.credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
220
+
221
+ expect(actual).to eq(true)
222
+ end
223
+ end
@@ -0,0 +1,213 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Member' 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
+ .members("MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").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/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives fetch responses" do
28
+ @holodeck.mock(Twilio::TwilioResponse.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "identity": "jing",
37
+ "role_sid": "RL003876fe89d744dfa576824b53c26784",
38
+ "last_consumed_message_index": null,
39
+ "last_consumption_timestamp": null,
40
+ "date_created": "2016-03-24T21:05:50Z",
41
+ "date_updated": "2016-03-24T21:05:50Z",
42
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
43
+ }
44
+ ]
45
+ ))
46
+
47
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
48
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
49
+ .members("MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
50
+
51
+ expect(actual).to_not eq(nil)
52
+ end
53
+
54
+ it "can create" do
55
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
56
+
57
+ expect {
58
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
59
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
60
+ .members.create(identity: "identity")
61
+ }.to raise_exception(Twilio::REST::TwilioException)
62
+
63
+ values = {
64
+ 'Identity' => "identity",
65
+ }
66
+ expect(
67
+ @holodeck.has_request?(Holodeck::Request.new(
68
+ method: 'post',
69
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members',
70
+ data: values,
71
+ ))).to eq(true)
72
+ end
73
+
74
+ it "receives create responses" do
75
+ @holodeck.mock(Twilio::TwilioResponse.new(
76
+ 201,
77
+ %q[
78
+ {
79
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
80
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
81
+ "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
82
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
83
+ "identity": "jing",
84
+ "role_sid": "RL003876fe89d744dfa576824b53c26784",
85
+ "last_consumed_message_index": null,
86
+ "last_consumption_timestamp": null,
87
+ "date_created": "2016-03-24T21:05:50Z",
88
+ "date_updated": "2016-03-24T21:05:50Z",
89
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
90
+ }
91
+ ]
92
+ ))
93
+
94
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
95
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
96
+ .members.create(identity: "identity")
97
+
98
+ expect(actual).to_not eq(nil)
99
+ end
100
+
101
+ it "can read" do
102
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
103
+
104
+ expect {
105
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
106
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
107
+ .members.list()
108
+ }.to raise_exception(Twilio::REST::TwilioException)
109
+
110
+ values = {}
111
+ expect(
112
+ @holodeck.has_request?(Holodeck::Request.new(
113
+ method: 'get',
114
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members',
115
+ ))).to eq(true)
116
+ end
117
+
118
+ it "receives read_full responses" do
119
+ @holodeck.mock(Twilio::TwilioResponse.new(
120
+ 200,
121
+ %q[
122
+ {
123
+ "meta": {
124
+ "page": 0,
125
+ "page_size": 1,
126
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=1&Page=0",
127
+ "previous_page_url": null,
128
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=1&Page=0",
129
+ "next_page_url": null,
130
+ "key": "members"
131
+ },
132
+ "members": [
133
+ {
134
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
135
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
136
+ "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
137
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
138
+ "identity": "jing",
139
+ "role_sid": "RL003876fe89d744dfa576824b53c26784",
140
+ "last_consumed_message_index": null,
141
+ "last_consumption_timestamp": null,
142
+ "date_created": "2016-03-24T21:05:50Z",
143
+ "date_updated": "2016-03-24T21:05:50Z",
144
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
145
+ }
146
+ ]
147
+ }
148
+ ]
149
+ ))
150
+
151
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
152
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
153
+ .members.list()
154
+
155
+ expect(actual).to_not eq(nil)
156
+ end
157
+
158
+ it "receives read_empty responses" do
159
+ @holodeck.mock(Twilio::TwilioResponse.new(
160
+ 200,
161
+ %q[
162
+ {
163
+ "meta": {
164
+ "page": 0,
165
+ "page_size": 1,
166
+ "first_page_url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=1&Page=0",
167
+ "previous_page_url": null,
168
+ "url": "https://ip-messaging.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=1&Page=0",
169
+ "next_page_url": null,
170
+ "key": "members"
171
+ },
172
+ "members": []
173
+ }
174
+ ]
175
+ ))
176
+
177
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
178
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
179
+ .members.list()
180
+
181
+ expect(actual).to_not eq(nil)
182
+ end
183
+
184
+ it "can delete" do
185
+ @holodeck.mock(Twilio::TwilioResponse.new(500, ''))
186
+
187
+ expect {
188
+ @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
189
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
190
+ .members("MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
191
+ }.to raise_exception(Twilio::REST::TwilioException)
192
+
193
+ values = {}
194
+ expect(
195
+ @holodeck.has_request?(Holodeck::Request.new(
196
+ method: 'delete',
197
+ url: 'https://chat.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
198
+ ))).to eq(true)
199
+ end
200
+
201
+ it "receives delete responses" do
202
+ @holodeck.mock(Twilio::TwilioResponse.new(
203
+ 204,
204
+ nil,
205
+ ))
206
+
207
+ actual = @client.chat.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
208
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
209
+ .members("MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
210
+
211
+ expect(actual).to eq(true)
212
+ end
213
+ end