twilio-ruby 5.39.3 → 5.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +24 -1
- data/CONTRIBUTING.md +2 -2
- data/README.md +2 -3
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +3 -3
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +12 -2
- data/lib/twilio-ruby/rest/events.rb +54 -0
- data/lib/twilio-ruby/rest/events/v1.rb +58 -0
- data/lib/twilio-ruby/rest/events/v1/sink.rb +379 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +118 -0
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +358 -0
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +322 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +33 -17
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +13 -1
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
- data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
- data/spec/integration/events/v1/sink_spec.rb +217 -0
- data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +212 -0
- data/spec/integration/events/v1/subscription_spec.rb +205 -0
- data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
- metadata +19 -2
@@ -29,8 +29,19 @@ module Twilio
|
|
29
29
|
# Lists UsageRecordInstance records from the API as a list.
|
30
30
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
31
|
# memory before returning.
|
32
|
-
# @param [String] sim SID of a Sim resource. Only show UsageRecords
|
33
|
-
# usage incurred by this Super SIM.
|
32
|
+
# @param [String] sim SID or unique name of a Sim resource. Only show UsageRecords
|
33
|
+
# representing usage incurred by this Super SIM.
|
34
|
+
# @param [String] fleet SID or unique name of a Fleet resource. Only show
|
35
|
+
# UsageRecords representing usage for Super SIMs belonging to this Fleet resource
|
36
|
+
# at the time the usage occurred.
|
37
|
+
# @param [String] network SID of a Network resource. Only show UsageRecords
|
38
|
+
# representing usage on this network.
|
39
|
+
# @param [String] iso_country Alpha-2 ISO Country Code. Only show UsageRecords
|
40
|
+
# representing usage in this country.
|
41
|
+
# @param [usage_record.Group] group Dimension over which to aggregate usage
|
42
|
+
# records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not
|
43
|
+
# aggregate across any of these dimensions, UsageRecords will be aggregated into
|
44
|
+
# the time buckets described by the `Granularity` parameter.
|
34
45
|
# @param [usage_record.Granularity] granularity Time-based grouping that
|
35
46
|
# UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default
|
36
47
|
# is `all`. `all` returns one UsageRecord that describes the usage for the entire
|
@@ -48,9 +59,13 @@ module Twilio
|
|
48
59
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
49
60
|
# efficient page size, i.e. min(limit, 1000)
|
50
61
|
# @return [Array] Array of up to limit results
|
51
|
-
def list(sim: :unset, granularity: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil)
|
62
|
+
def list(sim: :unset, fleet: :unset, network: :unset, iso_country: :unset, group: :unset, granularity: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil)
|
52
63
|
self.stream(
|
53
64
|
sim: sim,
|
65
|
+
fleet: fleet,
|
66
|
+
network: network,
|
67
|
+
iso_country: iso_country,
|
68
|
+
group: group,
|
54
69
|
granularity: granularity,
|
55
70
|
start_time: start_time,
|
56
71
|
end_time: end_time,
|
@@ -63,8 +78,19 @@ module Twilio
|
|
63
78
|
# Streams UsageRecordInstance records from the API as an Enumerable.
|
64
79
|
# This operation lazily loads records as efficiently as possible until the limit
|
65
80
|
# is reached.
|
66
|
-
# @param [String] sim SID of a Sim resource. Only show UsageRecords
|
67
|
-
# usage incurred by this Super SIM.
|
81
|
+
# @param [String] sim SID or unique name of a Sim resource. Only show UsageRecords
|
82
|
+
# representing usage incurred by this Super SIM.
|
83
|
+
# @param [String] fleet SID or unique name of a Fleet resource. Only show
|
84
|
+
# UsageRecords representing usage for Super SIMs belonging to this Fleet resource
|
85
|
+
# at the time the usage occurred.
|
86
|
+
# @param [String] network SID of a Network resource. Only show UsageRecords
|
87
|
+
# representing usage on this network.
|
88
|
+
# @param [String] iso_country Alpha-2 ISO Country Code. Only show UsageRecords
|
89
|
+
# representing usage in this country.
|
90
|
+
# @param [usage_record.Group] group Dimension over which to aggregate usage
|
91
|
+
# records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not
|
92
|
+
# aggregate across any of these dimensions, UsageRecords will be aggregated into
|
93
|
+
# the time buckets described by the `Granularity` parameter.
|
68
94
|
# @param [usage_record.Granularity] granularity Time-based grouping that
|
69
95
|
# UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default
|
70
96
|
# is `all`. `all` returns one UsageRecord that describes the usage for the entire
|
@@ -82,11 +108,15 @@ module Twilio
|
|
82
108
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
83
109
|
# efficient page size, i.e. min(limit, 1000)
|
84
110
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
85
|
-
def stream(sim: :unset, granularity: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil)
|
111
|
+
def stream(sim: :unset, fleet: :unset, network: :unset, iso_country: :unset, group: :unset, granularity: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil)
|
86
112
|
limits = @version.read_limits(limit, page_size)
|
87
113
|
|
88
114
|
page = self.page(
|
89
115
|
sim: sim,
|
116
|
+
fleet: fleet,
|
117
|
+
network: network,
|
118
|
+
iso_country: iso_country,
|
119
|
+
group: group,
|
90
120
|
granularity: granularity,
|
91
121
|
start_time: start_time,
|
92
122
|
end_time: end_time,
|
@@ -113,8 +143,19 @@ module Twilio
|
|
113
143
|
##
|
114
144
|
# Retrieve a single page of UsageRecordInstance records from the API.
|
115
145
|
# Request is executed immediately.
|
116
|
-
# @param [String] sim SID of a Sim resource. Only show UsageRecords
|
117
|
-
# usage incurred by this Super SIM.
|
146
|
+
# @param [String] sim SID or unique name of a Sim resource. Only show UsageRecords
|
147
|
+
# representing usage incurred by this Super SIM.
|
148
|
+
# @param [String] fleet SID or unique name of a Fleet resource. Only show
|
149
|
+
# UsageRecords representing usage for Super SIMs belonging to this Fleet resource
|
150
|
+
# at the time the usage occurred.
|
151
|
+
# @param [String] network SID of a Network resource. Only show UsageRecords
|
152
|
+
# representing usage on this network.
|
153
|
+
# @param [String] iso_country Alpha-2 ISO Country Code. Only show UsageRecords
|
154
|
+
# representing usage in this country.
|
155
|
+
# @param [usage_record.Group] group Dimension over which to aggregate usage
|
156
|
+
# records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not
|
157
|
+
# aggregate across any of these dimensions, UsageRecords will be aggregated into
|
158
|
+
# the time buckets described by the `Granularity` parameter.
|
118
159
|
# @param [usage_record.Granularity] granularity Time-based grouping that
|
119
160
|
# UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default
|
120
161
|
# is `all`. `all` returns one UsageRecord that describes the usage for the entire
|
@@ -129,9 +170,13 @@ module Twilio
|
|
129
170
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
130
171
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
131
172
|
# @return [Page] Page of UsageRecordInstance
|
132
|
-
def page(sim: :unset, granularity: :unset, start_time: :unset, end_time: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
173
|
+
def page(sim: :unset, fleet: :unset, network: :unset, iso_country: :unset, group: :unset, granularity: :unset, start_time: :unset, end_time: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
133
174
|
params = Twilio::Values.of({
|
134
175
|
'Sim' => sim,
|
176
|
+
'Fleet' => fleet,
|
177
|
+
'Network' => network,
|
178
|
+
'IsoCountry' => iso_country,
|
179
|
+
'Group' => group,
|
135
180
|
'Granularity' => granularity,
|
136
181
|
'StartTime' => Twilio.serialize_iso8601_datetime(start_time),
|
137
182
|
'EndTime' => Twilio.serialize_iso8601_datetime(end_time),
|
@@ -211,6 +256,9 @@ module Twilio
|
|
211
256
|
@properties = {
|
212
257
|
'account_sid' => payload['account_sid'],
|
213
258
|
'sim_sid' => payload['sim_sid'],
|
259
|
+
'network_sid' => payload['network_sid'],
|
260
|
+
'fleet_sid' => payload['fleet_sid'],
|
261
|
+
'iso_country' => payload['iso_country'],
|
214
262
|
'period' => payload['period'],
|
215
263
|
'data_upload' => payload['data_upload'].to_i,
|
216
264
|
'data_download' => payload['data_download'].to_i,
|
@@ -230,6 +278,24 @@ module Twilio
|
|
230
278
|
@properties['sim_sid']
|
231
279
|
end
|
232
280
|
|
281
|
+
##
|
282
|
+
# @return [String] SID of the Network resource on which the usage occurred.
|
283
|
+
def network_sid
|
284
|
+
@properties['network_sid']
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# @return [String] SID of the Fleet resource on which the usage occurred.
|
289
|
+
def fleet_sid
|
290
|
+
@properties['fleet_sid']
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# @return [String] Alpha-2 ISO Country Code of the country the usage occurred in.
|
295
|
+
def iso_country
|
296
|
+
@properties['iso_country']
|
297
|
+
end
|
298
|
+
|
233
299
|
##
|
234
300
|
# @return [Hash] The time period for which the usage is reported.
|
235
301
|
def period
|
@@ -12,8 +12,6 @@ module Twilio
|
|
12
12
|
class V1 < Version
|
13
13
|
class RoomContext < InstanceContext
|
14
14
|
class ParticipantContext < InstanceContext
|
15
|
-
##
|
16
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
17
15
|
class SubscribeRulesList < ListResource
|
18
16
|
##
|
19
17
|
# Initialize the SubscribeRulesList
|
@@ -71,8 +69,6 @@ module Twilio
|
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
74
|
-
##
|
75
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
76
72
|
class SubscribeRulesPage < Page
|
77
73
|
##
|
78
74
|
# Initialize the SubscribeRulesPage
|
@@ -107,8 +103,6 @@ module Twilio
|
|
107
103
|
end
|
108
104
|
end
|
109
105
|
|
110
|
-
##
|
111
|
-
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
112
106
|
class SubscribeRulesInstance < InstanceResource
|
113
107
|
##
|
114
108
|
# Initialize the SubscribeRulesInstance
|
@@ -31,10 +31,6 @@ module Twilio
|
|
31
31
|
# Lists DataSessionInstance records from the API as a list.
|
32
32
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
33
|
# memory before returning.
|
34
|
-
# @param [Time] end_ The date that the record ended, given as GMT in [ISO
|
35
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
36
|
-
# @param [Time] start The date that the Data Session started, given as GMT in [ISO
|
37
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
38
34
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
39
35
|
# guarantees to never return more than limit. Default is no limit
|
40
36
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -42,18 +38,14 @@ module Twilio
|
|
42
38
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
43
39
|
# efficient page size, i.e. min(limit, 1000)
|
44
40
|
# @return [Array] Array of up to limit results
|
45
|
-
def list(
|
46
|
-
self.stream(
|
41
|
+
def list(limit: nil, page_size: nil)
|
42
|
+
self.stream(limit: limit, page_size: page_size).entries
|
47
43
|
end
|
48
44
|
|
49
45
|
##
|
50
46
|
# Streams DataSessionInstance records from the API as an Enumerable.
|
51
47
|
# This operation lazily loads records as efficiently as possible until the limit
|
52
48
|
# is reached.
|
53
|
-
# @param [Time] end_ The date that the record ended, given as GMT in [ISO
|
54
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
55
|
-
# @param [Time] start The date that the Data Session started, given as GMT in [ISO
|
56
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
57
49
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
58
50
|
# guarantees to never return more than limit. Default is no limit.
|
59
51
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -61,10 +53,10 @@ module Twilio
|
|
61
53
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
62
54
|
# efficient page size, i.e. min(limit, 1000)
|
63
55
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
64
|
-
def stream(
|
56
|
+
def stream(limit: nil, page_size: nil)
|
65
57
|
limits = @version.read_limits(limit, page_size)
|
66
58
|
|
67
|
-
page = self.page(
|
59
|
+
page = self.page(page_size: limits[:page_size], )
|
68
60
|
|
69
61
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
70
62
|
end
|
@@ -86,18 +78,12 @@ module Twilio
|
|
86
78
|
##
|
87
79
|
# Retrieve a single page of DataSessionInstance records from the API.
|
88
80
|
# Request is executed immediately.
|
89
|
-
# @param [Time] end_ The date that the record ended, given as GMT in [ISO
|
90
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
91
|
-
# @param [Time] start The date that the Data Session started, given as GMT in [ISO
|
92
|
-
# 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
93
81
|
# @param [String] page_token PageToken provided by the API
|
94
82
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
95
83
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
96
84
|
# @return [Page] Page of DataSessionInstance
|
97
|
-
def page(
|
85
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
98
86
|
params = Twilio::Values.of({
|
99
|
-
'End' => Twilio.serialize_iso8601_datetime(end_),
|
100
|
-
'Start' => Twilio.serialize_iso8601_datetime(start),
|
101
87
|
'PageToken' => page_token,
|
102
88
|
'Page' => page_number,
|
103
89
|
'PageSize' => page_size,
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
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 'SinkTest' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.sink_test.create()
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'post',
|
23
|
+
url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Test',
|
24
|
+
))).to eq(true)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "receives create responses" do
|
28
|
+
@holodeck.mock(Twilio::Response.new(
|
29
|
+
201,
|
30
|
+
%q[
|
31
|
+
{
|
32
|
+
"result": "valid"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
))
|
36
|
+
|
37
|
+
actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
38
|
+
.sink_test.create()
|
39
|
+
|
40
|
+
expect(actual).to_not eq(nil)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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 'SinkValidate' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.sink_validate.create(test_id: 'test_id')
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {'TestId' => 'test_id', }
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Validate',
|
25
|
+
data: values,
|
26
|
+
))).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "receives create responses" do
|
30
|
+
@holodeck.mock(Twilio::Response.new(
|
31
|
+
201,
|
32
|
+
%q[
|
33
|
+
{
|
34
|
+
"result": "valid"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
))
|
38
|
+
|
39
|
+
actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
40
|
+
.sink_validate.create(test_id: 'test_id')
|
41
|
+
|
42
|
+
expect(actual).to_not eq(nil)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,217 @@
|
|
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 'Sink' do
|
12
|
+
it "can fetch" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
18
|
+
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'get',
|
22
|
+
url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives fetch responses" do
|
27
|
+
@holodeck.mock(Twilio::Response.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"status": "initialized",
|
32
|
+
"sink_configuration": {},
|
33
|
+
"description": "description",
|
34
|
+
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"date_created": "2015-07-30T20:00:00Z",
|
36
|
+
"sink_type": "kinesis",
|
37
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
38
|
+
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
39
|
+
"links": {
|
40
|
+
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
|
41
|
+
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
48
|
+
|
49
|
+
expect(actual).to_not eq(nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "can create" do
|
53
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
54
|
+
|
55
|
+
expect {
|
56
|
+
@client.events.v1.sinks.create(description: 'description', sink_configuration: {}, sink_type: 'kinesis')
|
57
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
58
|
+
|
59
|
+
values = {
|
60
|
+
'Description' => 'description',
|
61
|
+
'SinkConfiguration' => Twilio.serialize_object({}),
|
62
|
+
'SinkType' => 'kinesis',
|
63
|
+
}
|
64
|
+
expect(
|
65
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
66
|
+
method: 'post',
|
67
|
+
url: 'https://events.twilio.com/v1/Sinks',
|
68
|
+
data: values,
|
69
|
+
))).to eq(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "receives create responses" do
|
73
|
+
@holodeck.mock(Twilio::Response.new(
|
74
|
+
201,
|
75
|
+
%q[
|
76
|
+
{
|
77
|
+
"status": "initialized",
|
78
|
+
"sink_configuration": {
|
79
|
+
"arn": "4242",
|
80
|
+
"role_arn": "abc123",
|
81
|
+
"external_id": "010101"
|
82
|
+
},
|
83
|
+
"description": "description",
|
84
|
+
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
85
|
+
"date_created": "2015-07-30T20:00:00Z",
|
86
|
+
"sink_type": "kinesis",
|
87
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
88
|
+
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
89
|
+
"links": {
|
90
|
+
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
|
91
|
+
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
|
92
|
+
}
|
93
|
+
}
|
94
|
+
]
|
95
|
+
))
|
96
|
+
|
97
|
+
actual = @client.events.v1.sinks.create(description: 'description', sink_configuration: {}, sink_type: 'kinesis')
|
98
|
+
|
99
|
+
expect(actual).to_not eq(nil)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "can delete" do
|
103
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
104
|
+
|
105
|
+
expect {
|
106
|
+
@client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
107
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
108
|
+
|
109
|
+
expect(
|
110
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
111
|
+
method: 'delete',
|
112
|
+
url: 'https://events.twilio.com/v1/Sinks/DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
113
|
+
))).to eq(true)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "receives delete responses" do
|
117
|
+
@holodeck.mock(Twilio::Response.new(
|
118
|
+
204,
|
119
|
+
nil,
|
120
|
+
))
|
121
|
+
|
122
|
+
actual = @client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
123
|
+
|
124
|
+
expect(actual).to eq(true)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "can read" do
|
128
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
129
|
+
|
130
|
+
expect {
|
131
|
+
@client.events.v1.sinks.list()
|
132
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
133
|
+
|
134
|
+
expect(
|
135
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
136
|
+
method: 'get',
|
137
|
+
url: 'https://events.twilio.com/v1/Sinks',
|
138
|
+
))).to eq(true)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "receives read_empty responses" do
|
142
|
+
@holodeck.mock(Twilio::Response.new(
|
143
|
+
200,
|
144
|
+
%q[
|
145
|
+
{
|
146
|
+
"sinks": [],
|
147
|
+
"meta": {
|
148
|
+
"page": 0,
|
149
|
+
"page_size": 10,
|
150
|
+
"first_page_url": "https://events.twilio.com/v1/Sinks?PageSize=10&Page=0",
|
151
|
+
"previous_page_url": null,
|
152
|
+
"url": "https://events.twilio.com/v1/Sinks?PageSize=10&Page=0",
|
153
|
+
"next_page_url": null,
|
154
|
+
"key": "sinks"
|
155
|
+
}
|
156
|
+
}
|
157
|
+
]
|
158
|
+
))
|
159
|
+
|
160
|
+
actual = @client.events.v1.sinks.list()
|
161
|
+
|
162
|
+
expect(actual).to_not eq(nil)
|
163
|
+
end
|
164
|
+
|
165
|
+
it "receives read_results responses" do
|
166
|
+
@holodeck.mock(Twilio::Response.new(
|
167
|
+
200,
|
168
|
+
%q[
|
169
|
+
{
|
170
|
+
"sinks": [
|
171
|
+
{
|
172
|
+
"status": "initialized",
|
173
|
+
"sink_configuration": {},
|
174
|
+
"description": "A Sink",
|
175
|
+
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
176
|
+
"date_created": "2015-07-30T20:00:00Z",
|
177
|
+
"sink_type": "kinesis",
|
178
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
179
|
+
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
180
|
+
"links": {
|
181
|
+
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
|
182
|
+
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
|
183
|
+
}
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"status": "initialized",
|
187
|
+
"sink_configuration": {},
|
188
|
+
"description": "ANOTHER Sink",
|
189
|
+
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
190
|
+
"date_created": "2015-07-30T20:00:00Z",
|
191
|
+
"sink_type": "kinesis",
|
192
|
+
"date_updated": "2015-07-30T20:00:00Z",
|
193
|
+
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
194
|
+
"links": {
|
195
|
+
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test",
|
196
|
+
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate"
|
197
|
+
}
|
198
|
+
}
|
199
|
+
],
|
200
|
+
"meta": {
|
201
|
+
"page": 0,
|
202
|
+
"page_size": 50,
|
203
|
+
"first_page_url": "https://events.twilio.com/v1/Sinks?PageSize=50&Page=0",
|
204
|
+
"previous_page_url": null,
|
205
|
+
"url": "https://events.twilio.com/v1/Sinks?PageSize=50&Page=0",
|
206
|
+
"next_page_url": null,
|
207
|
+
"key": "sinks"
|
208
|
+
}
|
209
|
+
}
|
210
|
+
]
|
211
|
+
))
|
212
|
+
|
213
|
+
actual = @client.events.v1.sinks.list()
|
214
|
+
|
215
|
+
expect(actual).to_not eq(nil)
|
216
|
+
end
|
217
|
+
end
|