twilio-ruby 5.22.0 → 5.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +15 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/messaging/v1/session.rb +1 -7
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +34 -32
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +37 -35
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +45 -38
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +38 -34
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +67 -52
- data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +32 -23
- data/lib/twilio-ruby/rest/proxy/v1/service.rb +123 -79
- data/lib/twilio-ruby/rest/proxy/v1.rb +2 -1
- data/lib/twilio-ruby/rest/proxy.rb +2 -1
- data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +366 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +384 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +348 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +358 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +398 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +417 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +366 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +384 -0
- data/lib/twilio-ruby/rest/{verify → serverless}/v1/service.rb +139 -175
- data/lib/twilio-ruby/rest/{verify → serverless}/v1.rb +6 -6
- data/lib/twilio-ruby/rest/serverless.rb +46 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/terminating_sip_domain.rb +419 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +26 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +46 -38
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +24 -20
- data/lib/twilio-ruby/rest/verify/v2/service.rb +59 -57
- data/lib/twilio-ruby/rest/verify/v2.rb +2 -1
- data/lib/twilio-ruby/rest/verify.rb +2 -8
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/flex_api/v1/configuration_spec.rb +15 -0
- data/spec/integration/messaging/v1/session/participant_spec.rb +10 -10
- data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +144 -0
- data/spec/integration/serverless/v1/service/asset_spec.rb +177 -0
- data/spec/integration/serverless/v1/service/build_spec.rb +184 -0
- data/spec/integration/serverless/v1/service/environment/deployment_spec.rb +137 -0
- data/spec/integration/serverless/v1/service/environment/variable_spec.rb +181 -0
- data/spec/integration/serverless/v1/service/environment_spec.rb +143 -0
- data/spec/integration/serverless/v1/service/function/function_version_spec.rb +144 -0
- data/spec/integration/serverless/v1/service/function_spec.rb +177 -0
- data/spec/integration/serverless/v1/service_spec.rb +180 -0
- data/spec/integration/trunking/v1/trunk/terminating_sip_domain_spec.rb +231 -0
- data/spec/integration/trunking/v1/trunk_spec.rb +12 -6
- metadata +34 -12
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +0 -340
- data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +0 -209
- data/spec/integration/verify/v1/service/verification_check_spec.rb +0 -54
- data/spec/integration/verify/v1/service/verification_spec.rb +0 -169
- data/spec/integration/verify/v1/service_spec.rb +0 -231
@@ -19,7 +19,8 @@ module Twilio
|
|
19
19
|
end
|
20
20
|
|
21
21
|
##
|
22
|
-
# @param [String] sid The
|
22
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
23
|
+
# Verification Service resource to fetch.
|
23
24
|
# @return [Twilio::REST::Verify::V2::ServiceContext] if sid was passed.
|
24
25
|
# @return [Twilio::REST::Verify::V2::ServiceList]
|
25
26
|
def services(sid=:unset)
|
@@ -19,16 +19,9 @@ module Twilio
|
|
19
19
|
@port = 443
|
20
20
|
|
21
21
|
# Versions
|
22
|
-
@v1 = nil
|
23
22
|
@v2 = nil
|
24
23
|
end
|
25
24
|
|
26
|
-
##
|
27
|
-
# Version v1 of verify
|
28
|
-
def v1
|
29
|
-
@v1 ||= V1.new self
|
30
|
-
end
|
31
|
-
|
32
25
|
##
|
33
26
|
# Version v2 of verify
|
34
27
|
def v2
|
@@ -36,7 +29,8 @@ module Twilio
|
|
36
29
|
end
|
37
30
|
|
38
31
|
##
|
39
|
-
# @param [String] sid
|
32
|
+
# @param [String] sid The unique string that we created to identify the Service
|
33
|
+
# resource.
|
40
34
|
# @return [Twilio::REST::Verify::V2::ServiceInstance] if sid was passed.
|
41
35
|
# @return [Twilio::REST::Verify::V2::ServiceList]
|
42
36
|
def services(sid=:unset)
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -112,6 +112,11 @@ describe 'Configuration' do
|
|
112
112
|
"public_attributes": {
|
113
113
|
"public": "test"
|
114
114
|
},
|
115
|
+
"plugin_service_enabled": true,
|
116
|
+
"plugin_service_attributes": {
|
117
|
+
"agent-logger": "^3.10.5",
|
118
|
+
"typewriter": "^7.0.1"
|
119
|
+
},
|
115
120
|
"url": "https://flex-api.twilio.com/v1/Configuration"
|
116
121
|
}
|
117
122
|
]
|
@@ -225,6 +230,11 @@ describe 'Configuration' do
|
|
225
230
|
"public_attributes": {
|
226
231
|
"public": "test"
|
227
232
|
},
|
233
|
+
"plugin_service_enabled": true,
|
234
|
+
"plugin_service_attributes": {
|
235
|
+
"agent-logger": "^3.10.5",
|
236
|
+
"typewriter": "^7.0.1"
|
237
|
+
},
|
228
238
|
"url": "https://flex-api.twilio.com/v1/Configuration"
|
229
239
|
}
|
230
240
|
]
|
@@ -338,6 +348,11 @@ describe 'Configuration' do
|
|
338
348
|
"public_attributes": {
|
339
349
|
"public": "test"
|
340
350
|
},
|
351
|
+
"plugin_service_enabled": false,
|
352
|
+
"plugin_service_attributes": {
|
353
|
+
"agent-logger": "^3.10.5",
|
354
|
+
"typewriter": "^7.0.1"
|
355
|
+
},
|
341
356
|
"url": "https://flex-api.twilio.com/v1/Configuration"
|
342
357
|
}
|
343
358
|
]
|
@@ -40,8 +40,8 @@ describe 'Participant' do
|
|
40
40
|
"date_created": "2015-12-16T22:18:37Z",
|
41
41
|
"date_updated": "2015-12-16T22:18:38Z",
|
42
42
|
"type": "chat",
|
43
|
-
"twilio_address": "+
|
44
|
-
"user_address": "+
|
43
|
+
"twilio_address": "+372666555",
|
44
|
+
"user_address": "+372666556",
|
45
45
|
"url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
46
46
|
}
|
47
47
|
]
|
@@ -68,8 +68,8 @@ describe 'Participant' do
|
|
68
68
|
"date_created": "2016-03-24T21:05:50Z",
|
69
69
|
"date_updated": "2016-03-24T21:05:50Z",
|
70
70
|
"type": "chat",
|
71
|
-
"twilio_address": "+
|
72
|
-
"user_address": "+
|
71
|
+
"twilio_address": "+372666555",
|
72
|
+
"user_address": "+372666556",
|
73
73
|
"url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
74
74
|
}
|
75
75
|
]
|
@@ -112,8 +112,8 @@ describe 'Participant' do
|
|
112
112
|
"date_created": "2015-12-16T22:18:37Z",
|
113
113
|
"date_updated": "2015-12-16T22:18:38Z",
|
114
114
|
"type": "chat",
|
115
|
-
"twilio_address": "+
|
116
|
-
"user_address": "+
|
115
|
+
"twilio_address": "+372666555",
|
116
|
+
"user_address": "+372666556",
|
117
117
|
"url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
118
118
|
}
|
119
119
|
]
|
@@ -156,8 +156,8 @@ describe 'Participant' do
|
|
156
156
|
"date_created": "2016-03-24T21:05:50Z",
|
157
157
|
"date_updated": "2016-03-24T21:05:50Z",
|
158
158
|
"type": "chat",
|
159
|
-
"twilio_address": "+
|
160
|
-
"user_address": "+
|
159
|
+
"twilio_address": "+372666555",
|
160
|
+
"user_address": "+372666556",
|
161
161
|
"url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
162
162
|
}
|
163
163
|
]
|
@@ -211,8 +211,8 @@ describe 'Participant' do
|
|
211
211
|
"date_created": "2016-03-24T21:05:50Z",
|
212
212
|
"date_updated": "2016-03-24T21:05:50Z",
|
213
213
|
"type": "chat",
|
214
|
-
"twilio_address": "+
|
215
|
-
"user_address": "+
|
214
|
+
"twilio_address": "+372666555",
|
215
|
+
"user_address": "+372666556",
|
216
216
|
"url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
217
217
|
}
|
218
218
|
]
|
@@ -0,0 +1,144 @@
|
|
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 'AssetVersion' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
18
|
+
.asset_versions.list()
|
19
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
20
|
+
|
21
|
+
values = {}
|
22
|
+
expect(
|
23
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
24
|
+
method: 'get',
|
25
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Versions',
|
26
|
+
))).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "receives read_empty responses" do
|
30
|
+
@holodeck.mock(Twilio::Response.new(
|
31
|
+
200,
|
32
|
+
%q[
|
33
|
+
{
|
34
|
+
"asset_versions": [],
|
35
|
+
"meta": {
|
36
|
+
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions?PageSize=50&Page=0",
|
37
|
+
"key": "asset_versions",
|
38
|
+
"next_page_url": null,
|
39
|
+
"page": 0,
|
40
|
+
"page_size": 50,
|
41
|
+
"previous_page_url": null,
|
42
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions?PageSize=50&Page=0"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
]
|
46
|
+
))
|
47
|
+
|
48
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
49
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
50
|
+
.asset_versions.list()
|
51
|
+
|
52
|
+
expect(actual).to_not eq(nil)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "can fetch" do
|
56
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
57
|
+
|
58
|
+
expect {
|
59
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
60
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
61
|
+
.asset_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
62
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
63
|
+
|
64
|
+
values = {}
|
65
|
+
expect(
|
66
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
67
|
+
method: 'get',
|
68
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Versions/ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
69
|
+
))).to eq(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "receives fetch responses" do
|
73
|
+
@holodeck.mock(Twilio::Response.new(
|
74
|
+
200,
|
75
|
+
%q[
|
76
|
+
{
|
77
|
+
"sid": "ZN00000000000000000000000000000000",
|
78
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
79
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
80
|
+
"asset_sid": "ZH00000000000000000000000000000000",
|
81
|
+
"path": "test-path",
|
82
|
+
"visibility": "public",
|
83
|
+
"pre_signed_upload_url": null,
|
84
|
+
"date_created": "2018-11-10T20:00:00Z",
|
85
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
))
|
89
|
+
|
90
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
91
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
92
|
+
.asset_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
93
|
+
|
94
|
+
expect(actual).to_not eq(nil)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "can create" do
|
98
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
99
|
+
|
100
|
+
expect {
|
101
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
102
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
103
|
+
.asset_versions.create(path: 'path', visibility: 'public')
|
104
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
105
|
+
|
106
|
+
values = {'Path' => 'path', 'Visibility' => 'public', }
|
107
|
+
expect(
|
108
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
109
|
+
method: 'post',
|
110
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Versions',
|
111
|
+
data: values,
|
112
|
+
))).to eq(true)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "receives create responses" do
|
116
|
+
@holodeck.mock(Twilio::Response.new(
|
117
|
+
201,
|
118
|
+
%q[
|
119
|
+
{
|
120
|
+
"sid": "ZN00000000000000000000000000000000",
|
121
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
122
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
123
|
+
"asset_sid": "ZH00000000000000000000000000000000",
|
124
|
+
"path": "/some/sample/path",
|
125
|
+
"visibility": "private",
|
126
|
+
"date_created": "2018-11-10T20:00:00Z",
|
127
|
+
"pre_signed_upload_url": {
|
128
|
+
"url": "https://s3.amazonaws.com/com.twilio.dev.serverless",
|
129
|
+
"expiration": "2019-01-01T00:08:00.000Z",
|
130
|
+
"method": "PUT",
|
131
|
+
"kmsARN": "arn:aws:kms:us-east-1:719084529295:key/2a7bf064-c88c-4fdd-b376-625d7bcd2d98"
|
132
|
+
},
|
133
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000"
|
134
|
+
}
|
135
|
+
]
|
136
|
+
))
|
137
|
+
|
138
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
139
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
140
|
+
.asset_versions.create(path: 'path', visibility: 'public')
|
141
|
+
|
142
|
+
expect(actual).to_not eq(nil)
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,177 @@
|
|
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 'Asset' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.assets.list()
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'get',
|
24
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets',
|
25
|
+
))).to eq(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "receives read_empty responses" do
|
29
|
+
@holodeck.mock(Twilio::Response.new(
|
30
|
+
200,
|
31
|
+
%q[
|
32
|
+
{
|
33
|
+
"assets": [],
|
34
|
+
"meta": {
|
35
|
+
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets?PageSize=50&Page=0",
|
36
|
+
"key": "assets",
|
37
|
+
"next_page_url": null,
|
38
|
+
"page": 0,
|
39
|
+
"page_size": 50,
|
40
|
+
"previous_page_url": null,
|
41
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets?PageSize=50&Page=0"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
48
|
+
.assets.list()
|
49
|
+
|
50
|
+
expect(actual).to_not eq(nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "can fetch" do
|
54
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
55
|
+
|
56
|
+
expect {
|
57
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
58
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
59
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
60
|
+
|
61
|
+
values = {}
|
62
|
+
expect(
|
63
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
64
|
+
method: 'get',
|
65
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
66
|
+
))).to eq(true)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "receives fetch responses" do
|
70
|
+
@holodeck.mock(Twilio::Response.new(
|
71
|
+
200,
|
72
|
+
%q[
|
73
|
+
{
|
74
|
+
"sid": "ZH00000000000000000000000000000000",
|
75
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
76
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
77
|
+
"friendly_name": "test-asset",
|
78
|
+
"date_created": "2018-11-10T20:00:00Z",
|
79
|
+
"date_updated": "2018-11-10T20:00:00Z",
|
80
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
|
81
|
+
"links": {
|
82
|
+
"asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
]
|
86
|
+
))
|
87
|
+
|
88
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
89
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
90
|
+
|
91
|
+
expect(actual).to_not eq(nil)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "can create" do
|
95
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
96
|
+
|
97
|
+
expect {
|
98
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
99
|
+
.assets.create(friendly_name: 'friendly_name')
|
100
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
101
|
+
|
102
|
+
values = {'FriendlyName' => 'friendly_name', }
|
103
|
+
expect(
|
104
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
105
|
+
method: 'post',
|
106
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets',
|
107
|
+
data: values,
|
108
|
+
))).to eq(true)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "receives create responses" do
|
112
|
+
@holodeck.mock(Twilio::Response.new(
|
113
|
+
201,
|
114
|
+
%q[
|
115
|
+
{
|
116
|
+
"sid": "ZH00000000000000000000000000000000",
|
117
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
118
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
119
|
+
"friendly_name": "asset-friendly",
|
120
|
+
"date_created": "2018-11-10T20:00:00Z",
|
121
|
+
"date_updated": "2018-11-10T20:00:00Z",
|
122
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
|
123
|
+
"links": {
|
124
|
+
"asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
]
|
128
|
+
))
|
129
|
+
|
130
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
131
|
+
.assets.create(friendly_name: 'friendly_name')
|
132
|
+
|
133
|
+
expect(actual).to_not eq(nil)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "can update" do
|
137
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
138
|
+
|
139
|
+
expect {
|
140
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
141
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(friendly_name: 'friendly_name')
|
142
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
143
|
+
|
144
|
+
values = {'FriendlyName' => 'friendly_name', }
|
145
|
+
expect(
|
146
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
147
|
+
method: 'post',
|
148
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
149
|
+
data: values,
|
150
|
+
))).to eq(true)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "receives update responses" do
|
154
|
+
@holodeck.mock(Twilio::Response.new(
|
155
|
+
200,
|
156
|
+
%q[
|
157
|
+
{
|
158
|
+
"sid": "ZH00000000000000000000000000000000",
|
159
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
160
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
161
|
+
"friendly_name": "asset-friendly-update",
|
162
|
+
"date_created": "2018-11-10T20:00:00Z",
|
163
|
+
"date_updated": "2018-11-10T20:00:00Z",
|
164
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
|
165
|
+
"links": {
|
166
|
+
"asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
|
167
|
+
}
|
168
|
+
}
|
169
|
+
]
|
170
|
+
))
|
171
|
+
|
172
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
173
|
+
.assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(friendly_name: 'friendly_name')
|
174
|
+
|
175
|
+
expect(actual).to_not eq(nil)
|
176
|
+
end
|
177
|
+
end
|