twilio-ruby 5.23.1 → 5.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +30 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
  5. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +26 -0
  6. data/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb +437 -0
  7. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
  8. data/lib/twilio-ruby/rest/insights/v1/summary.rb +7 -0
  9. data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +61 -5
  10. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -19
  11. data/lib/twilio-ruby/rest/sync.rb +1 -1
  12. data/lib/twilio-ruby/rest/sync/v1.rb +1 -1
  13. data/lib/twilio-ruby/rest/sync/v1/service.rb +62 -6
  14. data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
  15. data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +416 -0
  16. data/lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb +424 -0
  17. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +6 -1
  18. data/lib/twilio-ruby/twiml/voice_response.rb +3 -3
  19. data/lib/twilio-ruby/version.rb +1 -1
  20. data/spec/integration/api/v2010/account/conference/participant_spec.rb +142 -15
  21. data/spec/integration/api/v2010/account/conference_spec.rb +190 -20
  22. data/spec/integration/api/v2010/account/message_spec.rb +125 -51
  23. data/spec/integration/autopilot/v1/assistant/webhook_spec.rb +246 -0
  24. data/spec/integration/autopilot/v1/assistant_spec.rb +8 -4
  25. data/spec/integration/flex_api/v1/configuration_spec.rb +48 -0
  26. data/spec/integration/insights/v1/summary_spec.rb +1 -0
  27. data/spec/integration/preview/trusted_comms/current_call_spec.rb +9 -1
  28. data/spec/integration/sync/v1/service_spec.rb +12 -4
  29. data/spec/integration/verify/v2/service/rate_limit/bucket_spec.rb +249 -0
  30. data/spec/integration/verify/v2/service/rate_limit_spec.rb +221 -0
  31. data/spec/integration/verify/v2/service/verification_spec.rb +36 -0
  32. data/spec/integration/verify/v2/service_spec.rb +8 -4
  33. metadata +11 -2
@@ -44,7 +44,8 @@ describe 'Assistant' do
44
44
  "queries": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries",
45
45
  "style_sheet": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/StyleSheet",
46
46
  "defaults": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Defaults",
47
- "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues"
47
+ "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues",
48
+ "webhooks": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
48
49
  },
49
50
  "url": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
50
51
  "callback_url": "https://example.com/callback_url",
@@ -119,7 +120,8 @@ describe 'Assistant' do
119
120
  "queries": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries",
120
121
  "style_sheet": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/StyleSheet",
121
122
  "defaults": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Defaults",
122
- "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues"
123
+ "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues",
124
+ "webhooks": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
123
125
  },
124
126
  "url": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
125
127
  "callback_url": "https://example.com/callback_url",
@@ -179,7 +181,8 @@ describe 'Assistant' do
179
181
  "queries": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries",
180
182
  "style_sheet": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/StyleSheet",
181
183
  "defaults": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Defaults",
182
- "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues"
184
+ "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues",
185
+ "webhooks": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
183
186
  },
184
187
  "url": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
185
188
  "callback_url": "https://example.com/callback_url",
@@ -228,7 +231,8 @@ describe 'Assistant' do
228
231
  "queries": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries",
229
232
  "style_sheet": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/StyleSheet",
230
233
  "defaults": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Defaults",
231
- "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues"
234
+ "dialogues": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues",
235
+ "webhooks": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
232
236
  },
233
237
  "url": "https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
234
238
  "callback_url": "https://example.com/callback_url",
@@ -117,6 +117,22 @@ describe 'Configuration' do
117
117
  "agent-logger": "^3.10.5",
118
118
  "typewriter": "^7.0.1"
119
119
  },
120
+ "integrations": [
121
+ {
122
+ "name": "twilio",
123
+ "type": "http",
124
+ "active": true,
125
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}",
126
+ "logo": "logo1",
127
+ "author": "somebody1"
128
+ },
129
+ {
130
+ "name": "twilio-stage",
131
+ "type": "http",
132
+ "active": false,
133
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}"
134
+ }
135
+ ],
120
136
  "url": "https://flex-api.twilio.com/v1/Configuration"
121
137
  }
122
138
  ]
@@ -235,6 +251,22 @@ describe 'Configuration' do
235
251
  "agent-logger": "^3.10.5",
236
252
  "typewriter": "^7.0.1"
237
253
  },
254
+ "integrations": [
255
+ {
256
+ "name": "twilio",
257
+ "type": "http",
258
+ "active": true,
259
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}",
260
+ "logo": "logo1",
261
+ "author": "somebody1"
262
+ },
263
+ {
264
+ "name": "twilio-stage",
265
+ "type": "http",
266
+ "active": false,
267
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}"
268
+ }
269
+ ],
238
270
  "url": "https://flex-api.twilio.com/v1/Configuration"
239
271
  }
240
272
  ]
@@ -353,6 +385,22 @@ describe 'Configuration' do
353
385
  "agent-logger": "^3.10.5",
354
386
  "typewriter": "^7.0.1"
355
387
  },
388
+ "integrations": [
389
+ {
390
+ "name": "twilio",
391
+ "type": "http",
392
+ "active": true,
393
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}",
394
+ "logo": "logo1",
395
+ "author": "somebody1"
396
+ },
397
+ {
398
+ "name": "twilio-stage",
399
+ "type": "http",
400
+ "active": false,
401
+ "config": "{\\"callback\\":\\"twilio.com/cb\\",\\"allowed_methods\\":[\\"GET\\",\\"POST\\"]}"
402
+ }
403
+ ],
356
404
  "url": "https://flex-api.twilio.com/v1/Configuration"
357
405
  }
358
406
  ]
@@ -49,6 +49,7 @@ describe 'CallSummary' do
49
49
  "tags": [
50
50
  "tags"
51
51
  ],
52
+ "attributes": {},
52
53
  "url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Summary"
53
54
  }
54
55
  ]
@@ -32,8 +32,16 @@ describe 'CurrentCall' do
32
32
  "sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
33
  "from": "+15000000000",
34
34
  "to": "+573000000000",
35
- "reason": "Hello Jhon, your appointment has been confirmed.",
35
+ "status": "ringing",
36
+ "reason": "Hello Jhon, your bank appointment has been confirmed.",
36
37
  "created_at": "2019-05-01T20:00:00Z",
38
+ "caller": "Owl Bank",
39
+ "logo": "https://www.twilio.com/marketing/bundles/company/img/logos/red/twilio-logo-red.png",
40
+ "bg_color": "#fff",
41
+ "font_color": "#f22f46",
42
+ "use_case": "conversational",
43
+ "manager": "Twilio",
44
+ "shield_img": "https://www.twilio.com/marketing/bundles/company/img/badges/red/twilio-badge-red.png",
37
45
  "url": "https://preview.twilio.com/TrustedComms/CurrentCall"
38
46
  }
39
47
  ]
@@ -44,7 +44,9 @@ describe 'Service' do
44
44
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
45
45
  "webhook_url": "http://www.example.com",
46
46
  "reachability_webhooks_enabled": false,
47
- "acl_enabled": false
47
+ "acl_enabled": false,
48
+ "reachability_debouncing_enabled": false,
49
+ "reachability_debouncing_window": 5000
48
50
  }
49
51
  ]
50
52
  ))
@@ -115,7 +117,9 @@ describe 'Service' do
115
117
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
116
118
  "webhook_url": "http://www.example.com",
117
119
  "reachability_webhooks_enabled": false,
118
- "acl_enabled": true
120
+ "acl_enabled": true,
121
+ "reachability_debouncing_enabled": false,
122
+ "reachability_debouncing_window": 5000
119
123
  }
120
124
  ]
121
125
  ))
@@ -195,7 +199,9 @@ describe 'Service' do
195
199
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
196
200
  "webhook_url": "http://www.example.com",
197
201
  "reachability_webhooks_enabled": false,
198
- "acl_enabled": false
202
+ "acl_enabled": false,
203
+ "reachability_debouncing_enabled": false,
204
+ "reachability_debouncing_window": 5000
199
205
  }
200
206
  ]
201
207
  }
@@ -242,7 +248,9 @@ describe 'Service' do
242
248
  "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
243
249
  "webhook_url": "http://www.example.com",
244
250
  "reachability_webhooks_enabled": false,
245
- "acl_enabled": true
251
+ "acl_enabled": true,
252
+ "reachability_debouncing_enabled": false,
253
+ "reachability_debouncing_window": 5000
246
254
  }
247
255
  ]
248
256
  ))
@@ -0,0 +1,249 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'Bucket' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
18
+ .buckets.create(max: 1, interval: 1)
19
+ }.to raise_exception(Twilio::REST::TwilioError)
20
+
21
+ values = {'Max' => 1, 'Interval' => 1, }
22
+ expect(
23
+ @holodeck.has_request?(Holodeck::Request.new(
24
+ method: 'post',
25
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Buckets',
26
+ data: values,
27
+ ))).to eq(true)
28
+ end
29
+
30
+ it "receives create_bucket responses" do
31
+ @holodeck.mock(Twilio::Response.new(
32
+ 201,
33
+ %q[
34
+ {
35
+ "sid": "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "rate_limit_sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39
+ "max": 5,
40
+ "interval": 60,
41
+ "date_created": "2015-07-30T20:00:00Z",
42
+ "date_updated": "2015-07-30T20:00:00Z",
43
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets/BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
44
+ }
45
+ ]
46
+ ))
47
+
48
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
49
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
50
+ .buckets.create(max: 1, interval: 1)
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can update" do
56
+ @holodeck.mock(Twilio::Response.new(500, ''))
57
+
58
+ expect {
59
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
60
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
61
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
62
+ }.to raise_exception(Twilio::REST::TwilioError)
63
+
64
+ values = {}
65
+ expect(
66
+ @holodeck.has_request?(Holodeck::Request.new(
67
+ method: 'post',
68
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Buckets/BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
69
+ ))).to eq(true)
70
+ end
71
+
72
+ it "receives update_bucket responses" do
73
+ @holodeck.mock(Twilio::Response.new(
74
+ 200,
75
+ %q[
76
+ {
77
+ "sid": "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "rate_limit_sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
80
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
81
+ "max": 5,
82
+ "interval": 60,
83
+ "date_created": "2015-07-30T20:00:00Z",
84
+ "date_updated": "2015-07-30T20:00:00Z",
85
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets/BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
86
+ }
87
+ ]
88
+ ))
89
+
90
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
91
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
92
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
93
+
94
+ expect(actual).to_not eq(nil)
95
+ end
96
+
97
+ it "can fetch" do
98
+ @holodeck.mock(Twilio::Response.new(500, ''))
99
+
100
+ expect {
101
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
102
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
103
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
104
+ }.to raise_exception(Twilio::REST::TwilioError)
105
+
106
+ values = {}
107
+ expect(
108
+ @holodeck.has_request?(Holodeck::Request.new(
109
+ method: 'get',
110
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Buckets/BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
111
+ ))).to eq(true)
112
+ end
113
+
114
+ it "receives fetch_bucket responses" do
115
+ @holodeck.mock(Twilio::Response.new(
116
+ 200,
117
+ %q[
118
+ {
119
+ "sid": "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
120
+ "rate_limit_sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
121
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
122
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
123
+ "max": 5,
124
+ "interval": 60,
125
+ "date_created": "2015-07-30T20:00:00Z",
126
+ "date_updated": "2015-07-30T20:00:00Z",
127
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets/BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
128
+ }
129
+ ]
130
+ ))
131
+
132
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
133
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
134
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
135
+
136
+ expect(actual).to_not eq(nil)
137
+ end
138
+
139
+ it "can read" do
140
+ @holodeck.mock(Twilio::Response.new(500, ''))
141
+
142
+ expect {
143
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
144
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
145
+ .buckets.list()
146
+ }.to raise_exception(Twilio::REST::TwilioError)
147
+
148
+ values = {}
149
+ expect(
150
+ @holodeck.has_request?(Holodeck::Request.new(
151
+ method: 'get',
152
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Buckets',
153
+ ))).to eq(true)
154
+ end
155
+
156
+ it "receives read_empty responses" do
157
+ @holodeck.mock(Twilio::Response.new(
158
+ 200,
159
+ %q[
160
+ {
161
+ "buckets": [],
162
+ "meta": {
163
+ "page": 0,
164
+ "page_size": 50,
165
+ "first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets?PageSize=50&Page=0",
166
+ "previous_page_url": null,
167
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets?PageSize=50&Page=0",
168
+ "next_page_url": null,
169
+ "key": "buckets"
170
+ }
171
+ }
172
+ ]
173
+ ))
174
+
175
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
176
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
177
+ .buckets.list()
178
+
179
+ expect(actual).to_not eq(nil)
180
+ end
181
+
182
+ it "receives read_full responses" do
183
+ @holodeck.mock(Twilio::Response.new(
184
+ 200,
185
+ %q[
186
+ {
187
+ "buckets": [
188
+ {
189
+ "sid": "BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
190
+ "rate_limit_sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
191
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
192
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
193
+ "max": 5,
194
+ "interval": 60,
195
+ "date_created": "2015-07-30T20:00:00Z",
196
+ "date_updated": "2015-07-30T20:00:00Z",
197
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets/BLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
198
+ }
199
+ ],
200
+ "meta": {
201
+ "page": 0,
202
+ "page_size": 50,
203
+ "first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets?PageSize=50&Page=0",
204
+ "previous_page_url": null,
205
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets?PageSize=50&Page=0",
206
+ "next_page_url": null,
207
+ "key": "buckets"
208
+ }
209
+ }
210
+ ]
211
+ ))
212
+
213
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
214
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
215
+ .buckets.list()
216
+
217
+ expect(actual).to_not eq(nil)
218
+ end
219
+
220
+ it "can delete" do
221
+ @holodeck.mock(Twilio::Response.new(500, ''))
222
+
223
+ expect {
224
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
225
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
226
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
227
+ }.to raise_exception(Twilio::REST::TwilioError)
228
+
229
+ values = {}
230
+ expect(
231
+ @holodeck.has_request?(Holodeck::Request.new(
232
+ method: 'delete',
233
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Buckets/BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
234
+ ))).to eq(true)
235
+ end
236
+
237
+ it "receives delete responses" do
238
+ @holodeck.mock(Twilio::Response.new(
239
+ 204,
240
+ nil,
241
+ ))
242
+
243
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
244
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
245
+ .buckets('BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
246
+
247
+ expect(actual).to eq(true)
248
+ end
249
+ end
@@ -0,0 +1,221 @@
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 'RateLimit' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .rate_limits.create(unique_name: 'unique_name')
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {'UniqueName' => 'unique_name', }
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'post',
24
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits',
25
+ data: values,
26
+ ))).to eq(true)
27
+ end
28
+
29
+ it "receives create_rate_limit responses" do
30
+ @holodeck.mock(Twilio::Response.new(
31
+ 201,
32
+ %q[
33
+ {
34
+ "sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "unique_name": "unique.name",
38
+ "description": "Description",
39
+ "date_created": "2015-07-30T20:00:00Z",
40
+ "date_updated": "2015-07-30T20:00:00Z",
41
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42
+ "links": {
43
+ "buckets": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets"
44
+ }
45
+ }
46
+ ]
47
+ ))
48
+
49
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
50
+ .rate_limits.create(unique_name: 'unique_name')
51
+
52
+ expect(actual).to_not eq(nil)
53
+ end
54
+
55
+ it "can update" do
56
+ @holodeck.mock(Twilio::Response.new(500, ''))
57
+
58
+ expect {
59
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
60
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
61
+ }.to raise_exception(Twilio::REST::TwilioError)
62
+
63
+ values = {}
64
+ expect(
65
+ @holodeck.has_request?(Holodeck::Request.new(
66
+ method: 'post',
67
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
68
+ ))).to eq(true)
69
+ end
70
+
71
+ it "receives update_rate_limit responses" do
72
+ @holodeck.mock(Twilio::Response.new(
73
+ 200,
74
+ %q[
75
+ {
76
+ "sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
77
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
+ "unique_name": "unique.name",
80
+ "description": "Description",
81
+ "date_created": "2015-07-30T20:00:00Z",
82
+ "date_updated": "2015-07-30T20:00:00Z",
83
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
84
+ "links": {
85
+ "buckets": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets"
86
+ }
87
+ }
88
+ ]
89
+ ))
90
+
91
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
92
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
93
+
94
+ expect(actual).to_not eq(nil)
95
+ end
96
+
97
+ it "can fetch" do
98
+ @holodeck.mock(Twilio::Response.new(500, ''))
99
+
100
+ expect {
101
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
102
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
103
+ }.to raise_exception(Twilio::REST::TwilioError)
104
+
105
+ values = {}
106
+ expect(
107
+ @holodeck.has_request?(Holodeck::Request.new(
108
+ method: 'get',
109
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
110
+ ))).to eq(true)
111
+ end
112
+
113
+ it "receives fetch_rate_limit responses" do
114
+ @holodeck.mock(Twilio::Response.new(
115
+ 200,
116
+ %q[
117
+ {
118
+ "sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
119
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
120
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
121
+ "unique_name": "unique.name",
122
+ "description": "Description",
123
+ "date_created": "2015-07-30T20:00:00Z",
124
+ "date_updated": "2015-07-30T20:00:00Z",
125
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
126
+ "links": {
127
+ "buckets": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets"
128
+ }
129
+ }
130
+ ]
131
+ ))
132
+
133
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
134
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
135
+
136
+ expect(actual).to_not eq(nil)
137
+ end
138
+
139
+ it "can read" do
140
+ @holodeck.mock(Twilio::Response.new(500, ''))
141
+
142
+ expect {
143
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
144
+ .rate_limits.list()
145
+ }.to raise_exception(Twilio::REST::TwilioError)
146
+
147
+ values = {}
148
+ expect(
149
+ @holodeck.has_request?(Holodeck::Request.new(
150
+ method: 'get',
151
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits',
152
+ ))).to eq(true)
153
+ end
154
+
155
+ it "receives read_all responses" do
156
+ @holodeck.mock(Twilio::Response.new(
157
+ 200,
158
+ %q[
159
+ {
160
+ "meta": {
161
+ "page": 0,
162
+ "page_size": 50,
163
+ "first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits?PageSize=50&Page=0",
164
+ "previous_page_url": null,
165
+ "next_page_url": null,
166
+ "key": "rate_limits",
167
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits?PageSize=50&Page=0"
168
+ },
169
+ "rate_limits": [
170
+ {
171
+ "sid": "RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
172
+ "service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
173
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
174
+ "unique_name": "unique.name",
175
+ "description": "Description",
176
+ "date_created": "2015-07-30T20:00:00Z",
177
+ "date_updated": "2015-07-30T20:00:00Z",
178
+ "url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
179
+ "links": {
180
+ "buckets": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits/RKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Buckets"
181
+ }
182
+ }
183
+ ]
184
+ }
185
+ ]
186
+ ))
187
+
188
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
189
+ .rate_limits.list()
190
+
191
+ expect(actual).to_not eq(nil)
192
+ end
193
+
194
+ it "can delete" do
195
+ @holodeck.mock(Twilio::Response.new(500, ''))
196
+
197
+ expect {
198
+ @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
199
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
200
+ }.to raise_exception(Twilio::REST::TwilioError)
201
+
202
+ values = {}
203
+ expect(
204
+ @holodeck.has_request?(Holodeck::Request.new(
205
+ method: 'delete',
206
+ url: 'https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
207
+ ))).to eq(true)
208
+ end
209
+
210
+ it "receives delete responses" do
211
+ @holodeck.mock(Twilio::Response.new(
212
+ 204,
213
+ nil,
214
+ ))
215
+
216
+ actual = @client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
217
+ .rate_limits('RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
218
+
219
+ expect(actual).to eq(true)
220
+ end
221
+ end