twilio-ruby 5.0.0.rc20 → 5.0.0.rc21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -3
- data/README.md +2 -2
- data/lib/twilio-ruby/http/http_client.rb +0 -1
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +196 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +197 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +232 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports.rb +44 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +517 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +35 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +336 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +393 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +409 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +479 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +506 -0
- data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +336 -0
- data/lib/twilio-ruby/rest/preview/proxy/service.rb +467 -0
- data/lib/twilio-ruby/rest/preview/proxy.rb +35 -0
- data/lib/twilio-ruby/rest/preview.rb +34 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
- data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
- data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
- data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +277 -0
- data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
- data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
- data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
- data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
- data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
- data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
- data/spec/integration/preview/proxy/service_spec.rb +200 -0
- metadata +38 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Preview
|
10
|
+
class Proxy < Version
|
11
|
+
##
|
12
|
+
# Initialize the Proxy version of Preview
|
13
|
+
def initialize(domain)
|
14
|
+
super
|
15
|
+
@version = 'Proxy'
|
16
|
+
@services = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def services(sid=:unset)
|
20
|
+
if sid == :unset
|
21
|
+
@services ||= ServiceList.new self
|
22
|
+
else
|
23
|
+
ServiceContext.new(self, sid)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'<Twilio::REST::Preview::Proxy>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -20,6 +20,9 @@ module Twilio
|
|
20
20
|
@sync = nil
|
21
21
|
@wireless = nil
|
22
22
|
@marketplace = nil
|
23
|
+
@bulk_exports = nil
|
24
|
+
@proxy = nil
|
25
|
+
@hosted_numbers = nil
|
23
26
|
end
|
24
27
|
|
25
28
|
##
|
@@ -40,8 +43,26 @@ module Twilio
|
|
40
43
|
@marketplace ||= Marketplace.new self
|
41
44
|
end
|
42
45
|
|
46
|
+
##
|
47
|
+
# Version bulk_exports of preview
|
48
|
+
def bulk_exports
|
49
|
+
@bulk_exports ||= BulkExports.new self
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Version proxy of preview
|
54
|
+
def proxy
|
55
|
+
@proxy ||= Proxy.new self
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Version hosted_numbers of preview
|
60
|
+
def hosted_numbers
|
61
|
+
@hosted_numbers ||= HostedNumbers.new self
|
62
|
+
end
|
63
|
+
|
43
64
|
def services
|
44
|
-
self.
|
65
|
+
self.proxy.services
|
45
66
|
end
|
46
67
|
|
47
68
|
def commands
|
@@ -64,6 +85,18 @@ module Twilio
|
|
64
85
|
self.marketplace.installed_add_ons
|
65
86
|
end
|
66
87
|
|
88
|
+
def exports
|
89
|
+
self.bulk_exports.exports
|
90
|
+
end
|
91
|
+
|
92
|
+
def export_configuration
|
93
|
+
self.bulk_exports.export_configuration
|
94
|
+
end
|
95
|
+
|
96
|
+
def hosted_number_orders
|
97
|
+
self.hosted_numbers.hosted_number_orders
|
98
|
+
end
|
99
|
+
|
67
100
|
##
|
68
101
|
# Provide a user friendly representation
|
69
102
|
def to_s
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Day' do
|
10
|
+
it "can read" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.bulk_exports.exports("resource_type") \
|
15
|
+
.days.list()
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
17
|
+
|
18
|
+
values = {}
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'get',
|
22
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type/Days',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives read responses" do
|
27
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"days": [
|
32
|
+
{
|
33
|
+
"day": "2017-05-01",
|
34
|
+
"size": 1234,
|
35
|
+
"resource_type": "Calls"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"meta": {
|
39
|
+
"key": "days",
|
40
|
+
"page_size": 50,
|
41
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Calls/Days?PageSize=50&Page=0",
|
42
|
+
"page": 0,
|
43
|
+
"first_page_url": "https://preview.twilio.com/BulkExports/Exports/Calls/Days?PageSize=50&Page=0",
|
44
|
+
"previous_page_url": null,
|
45
|
+
"next_page_url": null
|
46
|
+
}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
))
|
50
|
+
|
51
|
+
actual = @client.preview.bulk_exports.exports("resource_type") \
|
52
|
+
.days.list()
|
53
|
+
|
54
|
+
expect(actual).to_not eq(nil)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'ExportConfiguration' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.bulk_exports.export_configuration("resource_type").fetch()
|
15
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
16
|
+
|
17
|
+
values = {}
|
18
|
+
expect(
|
19
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
20
|
+
method: 'get',
|
21
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type/Configuration',
|
22
|
+
))).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "receives fetch responses" do
|
26
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
27
|
+
200,
|
28
|
+
%q[
|
29
|
+
{
|
30
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Calls/Configuration",
|
31
|
+
"enabled": true,
|
32
|
+
"webhook_url": "",
|
33
|
+
"webhook_method": "",
|
34
|
+
"resource_type": "Calls",
|
35
|
+
"email": ""
|
36
|
+
}
|
37
|
+
]
|
38
|
+
))
|
39
|
+
|
40
|
+
actual = @client.preview.bulk_exports.export_configuration("resource_type").fetch()
|
41
|
+
|
42
|
+
expect(actual).to_not eq(nil)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "can update" do
|
46
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
47
|
+
|
48
|
+
expect {
|
49
|
+
@client.preview.bulk_exports.export_configuration("resource_type").update()
|
50
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
51
|
+
|
52
|
+
values = {}
|
53
|
+
expect(
|
54
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
55
|
+
method: 'post',
|
56
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type/Configuration',
|
57
|
+
))).to eq(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "receives update responses" do
|
61
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
62
|
+
200,
|
63
|
+
%q[
|
64
|
+
{
|
65
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Calls/Configuration",
|
66
|
+
"enabled": true,
|
67
|
+
"email": "bogus@twilio.com",
|
68
|
+
"webhook_url": "",
|
69
|
+
"resource_type": "Calls",
|
70
|
+
"webhook_method": ""
|
71
|
+
}
|
72
|
+
]
|
73
|
+
))
|
74
|
+
|
75
|
+
actual = @client.preview.bulk_exports.export_configuration("resource_type").update()
|
76
|
+
|
77
|
+
expect(actual).to_not eq(nil)
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'Export' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.bulk_exports.exports("resource_type").fetch()
|
15
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
16
|
+
|
17
|
+
values = {}
|
18
|
+
expect(
|
19
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
20
|
+
method: 'get',
|
21
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type',
|
22
|
+
))).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "receives fetch responses" do
|
26
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
27
|
+
200,
|
28
|
+
%q[
|
29
|
+
{
|
30
|
+
"resource_type": "Calls",
|
31
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Calls",
|
32
|
+
"links": {
|
33
|
+
"days": "https://preview.twilio.com/BulkExports/Exports/Calls/Days"
|
34
|
+
}
|
35
|
+
}
|
36
|
+
]
|
37
|
+
))
|
38
|
+
|
39
|
+
actual = @client.preview.bulk_exports.exports("resource_type").fetch()
|
40
|
+
|
41
|
+
expect(actual).to_not eq(nil)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'HostedNumberOrder' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
15
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
16
|
+
|
17
|
+
values = {}
|
18
|
+
expect(
|
19
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
20
|
+
method: 'get',
|
21
|
+
url: 'https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
22
|
+
))).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "receives fetch responses" do
|
26
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
27
|
+
200,
|
28
|
+
%q[
|
29
|
+
{
|
30
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
31
|
+
"address_sid": "AD11111111111111111111111111111111",
|
32
|
+
"capabilities": {
|
33
|
+
"sms": true,
|
34
|
+
"voice": false
|
35
|
+
},
|
36
|
+
"cc_emails": [
|
37
|
+
"aaa@twilio.com",
|
38
|
+
"bbb@twilio.com"
|
39
|
+
],
|
40
|
+
"date_created": "2017-03-28T20:06:39Z",
|
41
|
+
"date_updated": "2017-03-28T20:06:39Z",
|
42
|
+
"email": "test@twilio.com",
|
43
|
+
"friendly_name": "friendly_name",
|
44
|
+
"incoming_phone_number_sid": "PN11111111111111111111111111111111",
|
45
|
+
"phone_number": "+14153608311",
|
46
|
+
"sid": "HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
47
|
+
"signing_document_sid": "PX11111111111111111111111111111111",
|
48
|
+
"status": "received",
|
49
|
+
"unique_name": "foobar",
|
50
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
))
|
54
|
+
|
55
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
56
|
+
|
57
|
+
expect(actual).to_not eq(nil)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "can delete" do
|
61
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
62
|
+
|
63
|
+
expect {
|
64
|
+
@client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
65
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
66
|
+
|
67
|
+
values = {}
|
68
|
+
expect(
|
69
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
70
|
+
method: 'delete',
|
71
|
+
url: 'https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
72
|
+
))).to eq(true)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "receives delete responses" do
|
76
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
77
|
+
204,
|
78
|
+
nil,
|
79
|
+
))
|
80
|
+
|
81
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
82
|
+
|
83
|
+
expect(actual).to eq(true)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "can update" do
|
87
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
88
|
+
|
89
|
+
expect {
|
90
|
+
@client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
91
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
92
|
+
|
93
|
+
values = {}
|
94
|
+
expect(
|
95
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
96
|
+
method: 'post',
|
97
|
+
url: 'https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
98
|
+
))).to eq(true)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "receives update responses" do
|
102
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
103
|
+
200,
|
104
|
+
%q[
|
105
|
+
{
|
106
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
107
|
+
"address_sid": "AD11111111111111111111111111111111",
|
108
|
+
"capabilities": {
|
109
|
+
"sms": true,
|
110
|
+
"voice": false
|
111
|
+
},
|
112
|
+
"cc_emails": [
|
113
|
+
"test1@twilio.com",
|
114
|
+
"test2@twilio.com"
|
115
|
+
],
|
116
|
+
"date_created": "2017-03-28T20:06:39Z",
|
117
|
+
"date_updated": "2017-03-28T20:06:39Z",
|
118
|
+
"email": "test+hosted@twilio.com",
|
119
|
+
"friendly_name": "new friendly name",
|
120
|
+
"incoming_phone_number_sid": "PN11111111111111111111111111111111",
|
121
|
+
"phone_number": "+14153608311",
|
122
|
+
"sid": "HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
123
|
+
"signing_document_sid": "PX11111111111111111111111111111111",
|
124
|
+
"status": "pending-loa",
|
125
|
+
"unique_name": "new unique name",
|
126
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
127
|
+
}
|
128
|
+
]
|
129
|
+
))
|
130
|
+
|
131
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders("HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
132
|
+
|
133
|
+
expect(actual).to_not eq(nil)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "can read" do
|
137
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
138
|
+
|
139
|
+
expect {
|
140
|
+
@client.preview.hosted_numbers.hosted_number_orders.list()
|
141
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
142
|
+
|
143
|
+
values = {}
|
144
|
+
expect(
|
145
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
146
|
+
method: 'get',
|
147
|
+
url: 'https://preview.twilio.com/HostedNumbers/HostedNumberOrders',
|
148
|
+
))).to eq(true)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "receives read_empty responses" do
|
152
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
153
|
+
200,
|
154
|
+
%q[
|
155
|
+
{
|
156
|
+
"meta": {
|
157
|
+
"first_page_url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders?PageSize=50&Page=0",
|
158
|
+
"key": "items",
|
159
|
+
"next_page_url": null,
|
160
|
+
"page": 0,
|
161
|
+
"page_size": 50,
|
162
|
+
"previous_page_url": null,
|
163
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders?PageSize=50&Page=0"
|
164
|
+
},
|
165
|
+
"items": []
|
166
|
+
}
|
167
|
+
]
|
168
|
+
))
|
169
|
+
|
170
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders.list()
|
171
|
+
|
172
|
+
expect(actual).to_not eq(nil)
|
173
|
+
end
|
174
|
+
|
175
|
+
it "receives read_full responses" do
|
176
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
177
|
+
200,
|
178
|
+
%q[
|
179
|
+
{
|
180
|
+
"meta": {
|
181
|
+
"first_page_url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders?PageSize=50&Page=0",
|
182
|
+
"key": "items",
|
183
|
+
"next_page_url": null,
|
184
|
+
"page": 0,
|
185
|
+
"page_size": 50,
|
186
|
+
"previous_page_url": null,
|
187
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders?PageSize=50&Page=0"
|
188
|
+
},
|
189
|
+
"items": [
|
190
|
+
{
|
191
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
192
|
+
"address_sid": "AD11111111111111111111111111111111",
|
193
|
+
"capabilities": {
|
194
|
+
"sms": true,
|
195
|
+
"voice": false
|
196
|
+
},
|
197
|
+
"cc_emails": [
|
198
|
+
"aaa@twilio.com",
|
199
|
+
"bbb@twilio.com"
|
200
|
+
],
|
201
|
+
"date_created": "2017-03-28T20:06:39Z",
|
202
|
+
"date_updated": "2017-03-28T20:06:39Z",
|
203
|
+
"email": "test@twilio.com",
|
204
|
+
"friendly_name": "friendly_name",
|
205
|
+
"incoming_phone_number_sid": "PN11111111111111111111111111111111",
|
206
|
+
"phone_number": "+14153608311",
|
207
|
+
"sid": "HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
208
|
+
"signing_document_sid": "PX11111111111111111111111111111111",
|
209
|
+
"status": "received",
|
210
|
+
"unique_name": "foobar",
|
211
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
212
|
+
}
|
213
|
+
]
|
214
|
+
}
|
215
|
+
]
|
216
|
+
))
|
217
|
+
|
218
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders.list()
|
219
|
+
|
220
|
+
expect(actual).to_not eq(nil)
|
221
|
+
end
|
222
|
+
|
223
|
+
it "can create" do
|
224
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
225
|
+
|
226
|
+
expect {
|
227
|
+
@client.preview.hosted_numbers.hosted_number_orders.create(address_sid: "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", phone_number: "+987654321", type: "local", iso_country: "iso_country", sms_capability: true, email: "email")
|
228
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
229
|
+
|
230
|
+
values = {
|
231
|
+
'AddressSid' => "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
232
|
+
'PhoneNumber' => "+987654321",
|
233
|
+
'Type' => "local",
|
234
|
+
'IsoCountry' => "iso_country",
|
235
|
+
'SmsCapability' => true,
|
236
|
+
'Email' => "email",
|
237
|
+
}
|
238
|
+
expect(
|
239
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
240
|
+
method: 'post',
|
241
|
+
url: 'https://preview.twilio.com/HostedNumbers/HostedNumberOrders',
|
242
|
+
data: values,
|
243
|
+
))).to eq(true)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "receives create responses" do
|
247
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
248
|
+
201,
|
249
|
+
%q[
|
250
|
+
{
|
251
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
252
|
+
"address_sid": "AD11111111111111111111111111111111",
|
253
|
+
"capabilities": {
|
254
|
+
"sms": true,
|
255
|
+
"voice": false
|
256
|
+
},
|
257
|
+
"cc_emails": [],
|
258
|
+
"date_created": "2017-03-28T20:06:39Z",
|
259
|
+
"date_updated": "2017-03-28T20:06:39Z",
|
260
|
+
"email": "test@twilio.com",
|
261
|
+
"friendly_name": null,
|
262
|
+
"incoming_phone_number_sid": "PN11111111111111111111111111111111",
|
263
|
+
"phone_number": "+14153608311",
|
264
|
+
"sid": "HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
265
|
+
"signing_document_sid": null,
|
266
|
+
"status": "received",
|
267
|
+
"unique_name": null,
|
268
|
+
"url": "https://preview.twilio.com/HostedNumbers/HostedNumberOrders/HRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
269
|
+
}
|
270
|
+
]
|
271
|
+
))
|
272
|
+
|
273
|
+
actual = @client.preview.hosted_numbers.hosted_number_orders.create(address_sid: "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", phone_number: "+987654321", type: "local", iso_country: "iso_country", sms_capability: true, email: "email")
|
274
|
+
|
275
|
+
expect(actual).to_not eq(nil)
|
276
|
+
end
|
277
|
+
end
|