twilio-ruby 5.22.0 → 5.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,143 @@
|
|
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 'Environment' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.environments.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/Environments',
|
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
|
+
"environments": [],
|
34
|
+
"meta": {
|
35
|
+
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments?PageSize=50&Page=0",
|
36
|
+
"key": "environments",
|
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/Environments?PageSize=50&Page=0"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
48
|
+
.environments.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
|
+
.environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').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/Environments/ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
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": "ZE00000000000000000000000000000000",
|
75
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
76
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
77
|
+
"build_sid": "ZB00000000000000000000000000000000",
|
78
|
+
"unique_name": "testing-environment",
|
79
|
+
"domain_suffix": "testing",
|
80
|
+
"domain_name": "foobar-1234-testing.twil.io",
|
81
|
+
"date_created": "2018-11-10T20:00:00Z",
|
82
|
+
"date_updated": "2018-11-10T20:00:00Z",
|
83
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000",
|
84
|
+
"links": {
|
85
|
+
"variables": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Variables",
|
86
|
+
"deployments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
]
|
90
|
+
))
|
91
|
+
|
92
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
93
|
+
.environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
94
|
+
|
95
|
+
expect(actual).to_not eq(nil)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "can create" do
|
99
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
100
|
+
|
101
|
+
expect {
|
102
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
103
|
+
.environments.create(unique_name: 'unique_name')
|
104
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
105
|
+
|
106
|
+
values = {'UniqueName' => 'unique_name', }
|
107
|
+
expect(
|
108
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
109
|
+
method: 'post',
|
110
|
+
url: 'https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments',
|
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": "ZE00000000000000000000000000000000",
|
121
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
122
|
+
"service_sid": "ZS00000000000000000000000000000000",
|
123
|
+
"build_sid": null,
|
124
|
+
"unique_name": "staging",
|
125
|
+
"domain_suffix": "stage",
|
126
|
+
"domain_name": "foobar-1234-stage.twil.io",
|
127
|
+
"date_created": "2018-11-10T20:00:00Z",
|
128
|
+
"date_updated": "2018-11-10T20:00:00Z",
|
129
|
+
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000",
|
130
|
+
"links": {
|
131
|
+
"variables": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Variables",
|
132
|
+
"deployments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments"
|
133
|
+
}
|
134
|
+
}
|
135
|
+
]
|
136
|
+
))
|
137
|
+
|
138
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
139
|
+
.environments.create(unique_name: 'unique_name')
|
140
|
+
|
141
|
+
expect(actual).to_not eq(nil)
|
142
|
+
end
|
143
|
+
end
|
@@ -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 'FunctionVersion' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
18
|
+
.function_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/Functions/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
|
+
"function_versions": [],
|
35
|
+
"meta": {
|
36
|
+
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions?PageSize=50&Page=0",
|
37
|
+
"key": "function_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/Functions/ZH00000000000000000000000000000000/Versions?PageSize=50&Page=0"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
]
|
46
|
+
))
|
47
|
+
|
48
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
49
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
50
|
+
.function_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
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
61
|
+
.function_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/Functions/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
|
+
"function_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/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
))
|
89
|
+
|
90
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
91
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
92
|
+
.function_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
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
103
|
+
.function_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/Functions/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
|
+
"function_sid": "ZH00000000000000000000000000000000",
|
124
|
+
"path": "/some/sample/path",
|
125
|
+
"visibility": "protected",
|
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/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000"
|
134
|
+
}
|
135
|
+
]
|
136
|
+
))
|
137
|
+
|
138
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
139
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
140
|
+
.function_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 'Function' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.functions.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/Functions',
|
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
|
+
"functions": [],
|
34
|
+
"meta": {
|
35
|
+
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions?PageSize=50&Page=0",
|
36
|
+
"key": "functions",
|
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/Functions?PageSize=50&Page=0"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
48
|
+
.functions.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
|
+
.functions('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/Functions/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-function",
|
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/Functions/ZH00000000000000000000000000000000",
|
81
|
+
"links": {
|
82
|
+
"function_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
]
|
86
|
+
))
|
87
|
+
|
88
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
89
|
+
.functions('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
|
+
.functions.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/Functions',
|
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": "function-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/Functions/ZH00000000000000000000000000000000",
|
123
|
+
"links": {
|
124
|
+
"function_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
]
|
128
|
+
))
|
129
|
+
|
130
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
131
|
+
.functions.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
|
+
.functions('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/Functions/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": "function-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/Functions/ZH00000000000000000000000000000000",
|
165
|
+
"links": {
|
166
|
+
"function_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions"
|
167
|
+
}
|
168
|
+
}
|
169
|
+
]
|
170
|
+
))
|
171
|
+
|
172
|
+
actual = @client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
173
|
+
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(friendly_name: 'friendly_name')
|
174
|
+
|
175
|
+
expect(actual).to_not eq(nil)
|
176
|
+
end
|
177
|
+
end
|