twilio-ruby 5.19.0 → 5.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api.rb +16 -13
  5. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +85 -88
  6. data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +4 -4
  7. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +135 -146
  8. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +21 -17
  9. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +14 -8
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +150 -166
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +174 -79
  12. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +147 -160
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +174 -79
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +174 -79
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +147 -160
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +174 -79
  17. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +51 -51
  18. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +246 -251
  19. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +31 -26
  20. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +34 -26
  21. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +109 -112
  22. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +108 -112
  23. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +108 -112
  24. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +21 -11
  25. data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +7 -6
  26. data/lib/twilio-ruby/rest/api/v2010/account/new_signing_key.rb +7 -6
  27. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +32 -25
  28. data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +36 -36
  29. data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +2 -1
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +70 -66
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb +10 -10
  32. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping.rb +14 -14
  33. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.rb +26 -23
  34. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.rb +26 -23
  35. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping.rb +12 -12
  36. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.rb +26 -23
  37. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +4 -4
  38. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +4 -4
  39. data/lib/twilio-ruby/rest/api/v2010/account/token.rb +11 -9
  40. data/lib/twilio-ruby/rest/api/v2010/account/usage.rb +2 -1
  41. data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +56 -47
  42. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +59 -44
  43. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +59 -44
  44. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +59 -47
  45. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +59 -44
  46. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +59 -44
  47. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +59 -44
  48. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +59 -44
  49. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +59 -44
  50. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +76 -74
  51. data/lib/twilio-ruby/rest/authy.rb +8 -8
  52. data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
  53. data/lib/twilio-ruby/rest/client.rb +16 -13
  54. data/lib/twilio-ruby/rest/messaging.rb +15 -0
  55. data/lib/twilio-ruby/rest/messaging/v1.rb +23 -0
  56. data/lib/twilio-ruby/rest/messaging/v1/session.rb +482 -0
  57. data/lib/twilio-ruby/rest/messaging/v1/session/message.rb +434 -0
  58. data/lib/twilio-ruby/rest/messaging/v1/session/participant.rb +458 -0
  59. data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +285 -0
  60. data/lib/twilio-ruby/rest/preview.rb +8 -8
  61. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  62. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -2
  63. data/lib/twilio-ruby/rest/video.rb +9 -9
  64. data/lib/twilio-ruby/rest/video/v1.rb +16 -16
  65. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -6
  66. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +37 -21
  67. data/lib/twilio-ruby/rest/video/v1/recording.rb +12 -3
  68. data/lib/twilio-ruby/security/request_validator.rb +2 -2
  69. data/lib/twilio-ruby/version.rb +1 -1
  70. data/spec/integration/messaging/v1/session/message_spec.rb +238 -0
  71. data/spec/integration/messaging/v1/session/participant_spec.rb +256 -0
  72. data/spec/integration/messaging/v1/session_spec.rb +223 -0
  73. data/spec/integration/messaging/v1/webhook_spec.rb +92 -0
  74. data/spec/integration/video/v1/composition_hook_spec.rb +1 -1
  75. data/spec/security/request_validator_spec.rb +5 -7
  76. metadata +14 -2
@@ -0,0 +1,256 @@
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 'Participant' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .participants.create()
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {}
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'post',
24
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants',
25
+ ))).to eq(true)
26
+ end
27
+
28
+ it "receives create_identity responses" do
29
+ @holodeck.mock(Twilio::Response.new(
30
+ 201,
31
+ %q[
32
+ {
33
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "identity": "Twilio",
39
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
40
+ "date_created": "2015-12-16T22:18:37Z",
41
+ "date_updated": "2015-12-16T22:18:38Z",
42
+ "type": "chat",
43
+ "twilio_address": "+111111",
44
+ "user_address": "+999999",
45
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
46
+ }
47
+ ]
48
+ ))
49
+
50
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
51
+ .participants.create()
52
+
53
+ expect(actual).to_not eq(nil)
54
+ end
55
+
56
+ it "receives create_address responses" do
57
+ @holodeck.mock(Twilio::Response.new(
58
+ 201,
59
+ %q[
60
+ {
61
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
62
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
63
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
64
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
65
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
66
+ "identity": null,
67
+ "attributes": "{}",
68
+ "date_created": "2016-03-24T21:05:50Z",
69
+ "date_updated": "2016-03-24T21:05:50Z",
70
+ "type": "chat",
71
+ "twilio_address": "+111111",
72
+ "user_address": "+999999",
73
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
74
+ }
75
+ ]
76
+ ))
77
+
78
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
79
+ .participants.create()
80
+
81
+ expect(actual).to_not eq(nil)
82
+ end
83
+
84
+ it "can update" do
85
+ @holodeck.mock(Twilio::Response.new(500, ''))
86
+
87
+ expect {
88
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
89
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
90
+ }.to raise_exception(Twilio::REST::TwilioError)
91
+
92
+ values = {}
93
+ expect(
94
+ @holodeck.has_request?(Holodeck::Request.new(
95
+ method: 'post',
96
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
97
+ ))).to eq(true)
98
+ end
99
+
100
+ it "receives update responses" do
101
+ @holodeck.mock(Twilio::Response.new(
102
+ 200,
103
+ %q[
104
+ {
105
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
106
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
107
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
108
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
109
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
110
+ "identity": "Twilio",
111
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
112
+ "date_created": "2015-12-16T22:18:37Z",
113
+ "date_updated": "2015-12-16T22:18:38Z",
114
+ "type": "chat",
115
+ "twilio_address": "+111111",
116
+ "user_address": "+999999",
117
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
118
+ }
119
+ ]
120
+ ))
121
+
122
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
123
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
124
+
125
+ expect(actual).to_not eq(nil)
126
+ end
127
+
128
+ it "can fetch" do
129
+ @holodeck.mock(Twilio::Response.new(500, ''))
130
+
131
+ expect {
132
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
133
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
134
+ }.to raise_exception(Twilio::REST::TwilioError)
135
+
136
+ values = {}
137
+ expect(
138
+ @holodeck.has_request?(Holodeck::Request.new(
139
+ method: 'get',
140
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
141
+ ))).to eq(true)
142
+ end
143
+
144
+ it "receives fetch responses" do
145
+ @holodeck.mock(Twilio::Response.new(
146
+ 200,
147
+ %q[
148
+ {
149
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
150
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
151
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
152
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
153
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
154
+ "identity": "Twilio",
155
+ "attributes": "{}",
156
+ "date_created": "2016-03-24T21:05:50Z",
157
+ "date_updated": "2016-03-24T21:05:50Z",
158
+ "type": "chat",
159
+ "twilio_address": "+111111",
160
+ "user_address": "+999999",
161
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
162
+ }
163
+ ]
164
+ ))
165
+
166
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
167
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
168
+
169
+ expect(actual).to_not eq(nil)
170
+ end
171
+
172
+ it "can read" do
173
+ @holodeck.mock(Twilio::Response.new(500, ''))
174
+
175
+ expect {
176
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
177
+ .participants.list()
178
+ }.to raise_exception(Twilio::REST::TwilioError)
179
+
180
+ values = {}
181
+ expect(
182
+ @holodeck.has_request?(Holodeck::Request.new(
183
+ method: 'get',
184
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants',
185
+ ))).to eq(true)
186
+ end
187
+
188
+ it "receives read responses" do
189
+ @holodeck.mock(Twilio::Response.new(
190
+ 200,
191
+ %q[
192
+ {
193
+ "meta": {
194
+ "page": 0,
195
+ "page_size": 50,
196
+ "first_page_url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
197
+ "previous_page_url": null,
198
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
199
+ "next_page_url": null,
200
+ "key": "participants"
201
+ },
202
+ "participants": [
203
+ {
204
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
205
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
206
+ "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
207
+ "session_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
208
+ "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
209
+ "identity": "Twilio",
210
+ "attributes": "{}",
211
+ "date_created": "2016-03-24T21:05:50Z",
212
+ "date_updated": "2016-03-24T21:05:50Z",
213
+ "type": "chat",
214
+ "twilio_address": "+111111",
215
+ "user_address": "+999999",
216
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
217
+ }
218
+ ]
219
+ }
220
+ ]
221
+ ))
222
+
223
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
224
+ .participants.list()
225
+
226
+ expect(actual).to_not eq(nil)
227
+ end
228
+
229
+ it "can delete" do
230
+ @holodeck.mock(Twilio::Response.new(500, ''))
231
+
232
+ expect {
233
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
234
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
235
+ }.to raise_exception(Twilio::REST::TwilioError)
236
+
237
+ values = {}
238
+ expect(
239
+ @holodeck.has_request?(Holodeck::Request.new(
240
+ method: 'delete',
241
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
242
+ ))).to eq(true)
243
+ end
244
+
245
+ it "receives delete responses" do
246
+ @holodeck.mock(Twilio::Response.new(
247
+ 204,
248
+ nil,
249
+ ))
250
+
251
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
252
+ .participants('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
253
+
254
+ expect(actual).to eq(true)
255
+ end
256
+ end
@@ -0,0 +1,223 @@
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 'Session' do
12
+ it "can fetch" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives fetch responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
36
+ "friendly_name": "friendly_name",
37
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
38
+ "date_created": "2015-12-16T22:18:37Z",
39
+ "date_updated": "2015-12-16T22:18:38Z",
40
+ "created_by": "creator",
41
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42
+ "links": {
43
+ "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
44
+ "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
45
+ }
46
+ }
47
+ ]
48
+ ))
49
+
50
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can delete" do
56
+ @holodeck.mock(Twilio::Response.new(500, ''))
57
+
58
+ expect {
59
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
60
+ }.to raise_exception(Twilio::REST::TwilioError)
61
+
62
+ values = {}
63
+ expect(
64
+ @holodeck.has_request?(Holodeck::Request.new(
65
+ method: 'delete',
66
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
67
+ ))).to eq(true)
68
+ end
69
+
70
+ it "receives delete responses" do
71
+ @holodeck.mock(Twilio::Response.new(
72
+ 204,
73
+ nil,
74
+ ))
75
+
76
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
77
+
78
+ expect(actual).to eq(true)
79
+ end
80
+
81
+ it "can create" do
82
+ @holodeck.mock(Twilio::Response.new(500, ''))
83
+
84
+ expect {
85
+ @client.messaging.v1.sessions.create(messaging_service_sid: 'messaging_service_sid')
86
+ }.to raise_exception(Twilio::REST::TwilioError)
87
+
88
+ values = {'MessagingServiceSid' => 'messaging_service_sid', }
89
+ expect(
90
+ @holodeck.has_request?(Holodeck::Request.new(
91
+ method: 'post',
92
+ url: 'https://messaging.twilio.com/v1/Sessions',
93
+ data: values,
94
+ ))).to eq(true)
95
+ end
96
+
97
+ it "receives create responses" do
98
+ @holodeck.mock(Twilio::Response.new(
99
+ 201,
100
+ %q[
101
+ {
102
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
103
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
104
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
105
+ "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
106
+ "friendly_name": "friendly_name",
107
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
108
+ "date_created": "2015-12-16T22:18:37Z",
109
+ "date_updated": "2015-12-16T22:18:38Z",
110
+ "created_by": "creator",
111
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112
+ "links": {
113
+ "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
114
+ "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
115
+ }
116
+ }
117
+ ]
118
+ ))
119
+
120
+ actual = @client.messaging.v1.sessions.create(messaging_service_sid: 'messaging_service_sid')
121
+
122
+ expect(actual).to_not eq(nil)
123
+ end
124
+
125
+ it "can update" do
126
+ @holodeck.mock(Twilio::Response.new(500, ''))
127
+
128
+ expect {
129
+ @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
130
+ }.to raise_exception(Twilio::REST::TwilioError)
131
+
132
+ values = {}
133
+ expect(
134
+ @holodeck.has_request?(Holodeck::Request.new(
135
+ method: 'post',
136
+ url: 'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
137
+ ))).to eq(true)
138
+ end
139
+
140
+ it "receives update responses" do
141
+ @holodeck.mock(Twilio::Response.new(
142
+ 200,
143
+ %q[
144
+ {
145
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
146
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
147
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
148
+ "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
149
+ "friendly_name": "friendly_name",
150
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
151
+ "date_created": "2015-12-16T22:18:37Z",
152
+ "date_updated": "2015-12-16T22:18:38Z",
153
+ "created_by": "creator",
154
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
155
+ "links": {
156
+ "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
157
+ "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
158
+ }
159
+ }
160
+ ]
161
+ ))
162
+
163
+ actual = @client.messaging.v1.sessions('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
164
+
165
+ expect(actual).to_not eq(nil)
166
+ end
167
+
168
+ it "can read" do
169
+ @holodeck.mock(Twilio::Response.new(500, ''))
170
+
171
+ expect {
172
+ @client.messaging.v1.sessions.list()
173
+ }.to raise_exception(Twilio::REST::TwilioError)
174
+
175
+ values = {}
176
+ expect(
177
+ @holodeck.has_request?(Holodeck::Request.new(
178
+ method: 'get',
179
+ url: 'https://messaging.twilio.com/v1/Sessions',
180
+ ))).to eq(true)
181
+ end
182
+
183
+ it "receives read_full responses" do
184
+ @holodeck.mock(Twilio::Response.new(
185
+ 200,
186
+ %q[
187
+ {
188
+ "sessions": [
189
+ {
190
+ "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
191
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
192
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
193
+ "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
194
+ "friendly_name": "friendly_name",
195
+ "attributes": "{ \\"foo\\": \\"bar\\" }",
196
+ "date_created": "2015-12-16T22:18:37Z",
197
+ "date_updated": "2015-12-16T22:18:38Z",
198
+ "created_by": "creator",
199
+ "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
200
+ "links": {
201
+ "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
202
+ "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
203
+ }
204
+ }
205
+ ],
206
+ "meta": {
207
+ "page": 0,
208
+ "page_size": 50,
209
+ "first_page_url": "https://messaging.twilio.com/v1/Sessions?PageSize=50&Page=0",
210
+ "previous_page_url": null,
211
+ "url": "https://messaging.twilio.com/v1/Sessions?PageSize=50&Page=0",
212
+ "next_page_url": null,
213
+ "key": "sessions"
214
+ }
215
+ }
216
+ ]
217
+ ))
218
+
219
+ actual = @client.messaging.v1.sessions.list()
220
+
221
+ expect(actual).to_not eq(nil)
222
+ end
223
+ end