twilio-ruby 5.39.2 → 5.40.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGES.md +107 -1
- data/CONTRIBUTING.md +2 -2
- data/ISSUE_TEMPLATE.md +5 -1
- data/PULL_REQUEST_TEMPLATE.md +1 -1
- data/README.md +4 -3
- data/lib/twilio-ruby/framework/version.rb +4 -8
- 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 +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +85 -60
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +8 -1
- data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +3 -1
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +2 -1
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +8 -4
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +11 -4
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +13 -6
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations.rb +39 -3
- data/lib/twilio-ruby/rest/conversations/v1.rb +68 -5
- data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +268 -0
- data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +21 -10
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +34 -19
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +48 -32
- data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
- data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
- data/lib/twilio-ruby/rest/conversations/v1/role.rb +374 -0
- data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +388 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +271 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +549 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +394 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +519 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +457 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +395 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
- data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
- data/lib/twilio-ruby/rest/events.rb +72 -0
- data/lib/twilio-ruby/rest/events/v1.rb +90 -0
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
- data/lib/twilio-ruby/rest/events/v1/schema.rb +226 -0
- data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +290 -0
- data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -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 +119 -0
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +383 -0
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +216 -0
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
- data/lib/twilio-ruby/rest/messaging.rb +6 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +6 -3
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +12 -6
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +10 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +10 -5
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +6 -3
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +1 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +3 -1
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
- data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
- data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
- data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +1 -4
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +6 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +38 -23
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -1
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -1
- data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +201 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -2
- data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -3
- data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +18 -9
- data/lib/twilio-ruby/rest/video/v1/room.rb +2 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +1 -4
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -1
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/version_spec.rb +53 -0
- data/spec/holodeck/holodeck.rb +3 -3
- data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
- data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
- data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
- data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
- data/spec/integration/api/v2010/account/message_spec.rb +37 -0
- data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
- data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
- data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
- data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
- data/spec/integration/conversations/v1/configuration_spec.rb +87 -0
- data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
- data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
- data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
- data/spec/integration/conversations/v1/credential_spec.rb +219 -0
- data/spec/integration/conversations/v1/role_spec.rb +249 -0
- data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
- data/spec/integration/conversations/v1/service/configuration/notification_spec.rb +115 -0
- data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
- data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
- data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
- data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
- data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
- data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
- data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
- data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
- data/spec/integration/conversations/v1/service_spec.rb +174 -0
- data/spec/integration/conversations/v1/user_spec.rb +220 -0
- data/spec/integration/events/v1/event_type_spec.rb +133 -0
- data/spec/integration/events/v1/schema/schema_version_spec.rb +126 -0
- data/spec/integration/events/v1/schema_spec.rb +46 -0
- 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 +91 -0
- data/spec/integration/events/v1/subscription_spec.rb +243 -0
- data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
- data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
- data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
- data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
- data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
- data/spec/integration/supersim/v1/sim_spec.rb +23 -0
- data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
- data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
- data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
- data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
- data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
- data/spec/integration/video/v1/room_spec.rb +37 -0
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +82 -5
- data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -0,0 +1,174 @@
|
|
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 'Service' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.conversations.v1.services.create(friendly_name: 'friendly_name')
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
18
|
+
|
19
|
+
values = {'FriendlyName' => 'friendly_name', }
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'post',
|
23
|
+
url: 'https://conversations.twilio.com/v1/Services',
|
24
|
+
data: values,
|
25
|
+
))).to eq(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "receives create responses" do
|
29
|
+
@holodeck.mock(Twilio::Response.new(
|
30
|
+
201,
|
31
|
+
%q[
|
32
|
+
{
|
33
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"friendly_name": "friendly_name",
|
36
|
+
"date_created": "2015-12-16T22:18:37Z",
|
37
|
+
"date_updated": "2015-12-16T22:18:38Z",
|
38
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
39
|
+
"links": {
|
40
|
+
"conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations",
|
41
|
+
"users": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",
|
42
|
+
"roles": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
43
|
+
"bindings": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
|
44
|
+
"configuration": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
]
|
48
|
+
))
|
49
|
+
|
50
|
+
actual = @client.conversations.v1.services.create(friendly_name: 'friendly_name')
|
51
|
+
|
52
|
+
expect(actual).to_not eq(nil)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "can delete" do
|
56
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
57
|
+
|
58
|
+
expect {
|
59
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
60
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
61
|
+
|
62
|
+
expect(
|
63
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
64
|
+
method: 'delete',
|
65
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
66
|
+
))).to eq(true)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "receives delete responses" do
|
70
|
+
@holodeck.mock(Twilio::Response.new(
|
71
|
+
204,
|
72
|
+
nil,
|
73
|
+
))
|
74
|
+
|
75
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
76
|
+
|
77
|
+
expect(actual).to eq(true)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "can fetch" do
|
81
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
82
|
+
|
83
|
+
expect {
|
84
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
85
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
86
|
+
|
87
|
+
expect(
|
88
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
89
|
+
method: 'get',
|
90
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
91
|
+
))).to eq(true)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "receives fetch responses" do
|
95
|
+
@holodeck.mock(Twilio::Response.new(
|
96
|
+
200,
|
97
|
+
%q[
|
98
|
+
{
|
99
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
100
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
101
|
+
"friendly_name": "My First Service",
|
102
|
+
"date_created": "2015-12-16T22:18:37Z",
|
103
|
+
"date_updated": "2015-12-16T22:18:38Z",
|
104
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
105
|
+
"links": {
|
106
|
+
"conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations",
|
107
|
+
"users": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",
|
108
|
+
"roles": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
109
|
+
"bindings": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
|
110
|
+
"configuration": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration"
|
111
|
+
}
|
112
|
+
}
|
113
|
+
]
|
114
|
+
))
|
115
|
+
|
116
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
117
|
+
|
118
|
+
expect(actual).to_not eq(nil)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "can read" do
|
122
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
123
|
+
|
124
|
+
expect {
|
125
|
+
@client.conversations.v1.services.list()
|
126
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
127
|
+
|
128
|
+
expect(
|
129
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
130
|
+
method: 'get',
|
131
|
+
url: 'https://conversations.twilio.com/v1/Services',
|
132
|
+
))).to eq(true)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "receives read_full responses" do
|
136
|
+
@holodeck.mock(Twilio::Response.new(
|
137
|
+
200,
|
138
|
+
%q[
|
139
|
+
{
|
140
|
+
"services": [
|
141
|
+
{
|
142
|
+
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
143
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
144
|
+
"friendly_name": "Home Service",
|
145
|
+
"date_created": "2015-12-16T22:18:37Z",
|
146
|
+
"date_updated": "2015-12-16T22:18:38Z",
|
147
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
148
|
+
"links": {
|
149
|
+
"conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations",
|
150
|
+
"users": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",
|
151
|
+
"roles": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
|
152
|
+
"bindings": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
|
153
|
+
"configuration": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration"
|
154
|
+
}
|
155
|
+
}
|
156
|
+
],
|
157
|
+
"meta": {
|
158
|
+
"page": 0,
|
159
|
+
"page_size": 50,
|
160
|
+
"first_page_url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
|
161
|
+
"previous_page_url": null,
|
162
|
+
"url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
|
163
|
+
"next_page_url": null,
|
164
|
+
"key": "services"
|
165
|
+
}
|
166
|
+
}
|
167
|
+
]
|
168
|
+
))
|
169
|
+
|
170
|
+
actual = @client.conversations.v1.services.list()
|
171
|
+
|
172
|
+
expect(actual).to_not eq(nil)
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,220 @@
|
|
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 'User' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.conversations.v1.users.create(identity: 'identity')
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
18
|
+
|
19
|
+
values = {'Identity' => 'identity', }
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'post',
|
23
|
+
url: 'https://conversations.twilio.com/v1/Users',
|
24
|
+
data: values,
|
25
|
+
))).to eq(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "receives create responses" do
|
29
|
+
@holodeck.mock(Twilio::Response.new(
|
30
|
+
201,
|
31
|
+
%q[
|
32
|
+
{
|
33
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
34
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"identity": "admin",
|
38
|
+
"friendly_name": "name",
|
39
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
40
|
+
"is_online": null,
|
41
|
+
"date_created": "2019-12-16T22:18:37Z",
|
42
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
43
|
+
"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
44
|
+
}
|
45
|
+
]
|
46
|
+
))
|
47
|
+
|
48
|
+
actual = @client.conversations.v1.users.create(identity: 'identity')
|
49
|
+
|
50
|
+
expect(actual).to_not eq(nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "can update" do
|
54
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
55
|
+
|
56
|
+
expect {
|
57
|
+
@client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
58
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
59
|
+
|
60
|
+
expect(
|
61
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
62
|
+
method: 'post',
|
63
|
+
url: 'https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
64
|
+
))).to eq(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "receives update responses" do
|
68
|
+
@holodeck.mock(Twilio::Response.new(
|
69
|
+
200,
|
70
|
+
%q[
|
71
|
+
{
|
72
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
73
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
74
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
75
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
76
|
+
"identity": "admin",
|
77
|
+
"friendly_name": "new name",
|
78
|
+
"attributes": "{ \\"duty\\": \\"tech\\", \\"team\\": \\"internals\\" }",
|
79
|
+
"is_online": null,
|
80
|
+
"date_created": "2019-12-16T22:18:37Z",
|
81
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
82
|
+
"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
83
|
+
}
|
84
|
+
]
|
85
|
+
))
|
86
|
+
|
87
|
+
actual = @client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
88
|
+
|
89
|
+
expect(actual).to_not eq(nil)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "can delete" do
|
93
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
94
|
+
|
95
|
+
expect {
|
96
|
+
@client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
97
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
98
|
+
|
99
|
+
expect(
|
100
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
101
|
+
method: 'delete',
|
102
|
+
url: 'https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
103
|
+
))).to eq(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "receives delete responses" do
|
107
|
+
@holodeck.mock(Twilio::Response.new(
|
108
|
+
204,
|
109
|
+
nil,
|
110
|
+
))
|
111
|
+
|
112
|
+
actual = @client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
113
|
+
|
114
|
+
expect(actual).to eq(true)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "can fetch" do
|
118
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
119
|
+
|
120
|
+
expect {
|
121
|
+
@client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
122
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
123
|
+
|
124
|
+
expect(
|
125
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
126
|
+
method: 'get',
|
127
|
+
url: 'https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
128
|
+
))).to eq(true)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "receives fetch responses" do
|
132
|
+
@holodeck.mock(Twilio::Response.new(
|
133
|
+
200,
|
134
|
+
%q[
|
135
|
+
{
|
136
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
137
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
138
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
139
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
140
|
+
"identity": "admin",
|
141
|
+
"friendly_name": "name",
|
142
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
143
|
+
"is_online": null,
|
144
|
+
"date_created": "2019-12-16T22:18:37Z",
|
145
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
146
|
+
"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
147
|
+
}
|
148
|
+
]
|
149
|
+
))
|
150
|
+
|
151
|
+
actual = @client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
152
|
+
|
153
|
+
expect(actual).to_not eq(nil)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "can read" do
|
157
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
158
|
+
|
159
|
+
expect {
|
160
|
+
@client.conversations.v1.users.list()
|
161
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
162
|
+
|
163
|
+
expect(
|
164
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
165
|
+
method: 'get',
|
166
|
+
url: 'https://conversations.twilio.com/v1/Users',
|
167
|
+
))).to eq(true)
|
168
|
+
end
|
169
|
+
|
170
|
+
it "receives read_full responses" do
|
171
|
+
@holodeck.mock(Twilio::Response.new(
|
172
|
+
200,
|
173
|
+
%q[
|
174
|
+
{
|
175
|
+
"meta": {
|
176
|
+
"page": 0,
|
177
|
+
"page_size": 50,
|
178
|
+
"first_page_url": "https://conversations.twilio.com/v1/Users?PageSize=50&Page=0",
|
179
|
+
"previous_page_url": null,
|
180
|
+
"url": "https://conversations.twilio.com/v1/Users?PageSize=50&Page=0",
|
181
|
+
"next_page_url": null,
|
182
|
+
"key": "users"
|
183
|
+
},
|
184
|
+
"users": [
|
185
|
+
{
|
186
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
187
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
188
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
189
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
190
|
+
"identity": "admin",
|
191
|
+
"friendly_name": "name",
|
192
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
193
|
+
"is_online": null,
|
194
|
+
"date_created": "2019-12-16T22:18:37Z",
|
195
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
196
|
+
"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
200
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
201
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
202
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
203
|
+
"identity": "agent0034",
|
204
|
+
"friendly_name": "John from customs",
|
205
|
+
"attributes": "{ \\"duty\\": \\"agent\\" }",
|
206
|
+
"is_online": false,
|
207
|
+
"date_created": "2020-03-24T20:38:21Z",
|
208
|
+
"date_updated": "2020-03-24T20:38:21Z",
|
209
|
+
"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
210
|
+
}
|
211
|
+
]
|
212
|
+
}
|
213
|
+
]
|
214
|
+
))
|
215
|
+
|
216
|
+
actual = @client.conversations.v1.users.list()
|
217
|
+
|
218
|
+
expect(actual).to_not eq(nil)
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,133 @@
|
|
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 'EventType' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.events.v1.event_types.list()
|
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/Types',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives read_empty responses" do
|
27
|
+
@holodeck.mock(Twilio::Response.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"types": [],
|
32
|
+
"meta": {
|
33
|
+
"page": 0,
|
34
|
+
"page_size": 10,
|
35
|
+
"first_page_url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0",
|
36
|
+
"previous_page_url": null,
|
37
|
+
"url": "https://events.twilio.com/v1/Types?PageSize=10&Page=0",
|
38
|
+
"next_page_url": null,
|
39
|
+
"key": "types"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
))
|
44
|
+
|
45
|
+
actual = @client.events.v1.event_types.list()
|
46
|
+
|
47
|
+
expect(actual).to_not eq(nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "receives read_results responses" do
|
51
|
+
@holodeck.mock(Twilio::Response.new(
|
52
|
+
200,
|
53
|
+
%q[
|
54
|
+
{
|
55
|
+
"types": [
|
56
|
+
{
|
57
|
+
"date_created": "2020-08-13T12:50:18Z",
|
58
|
+
"date_updated": "2020-08-13T13:28:48Z",
|
59
|
+
"type": "com.twilio.test.example",
|
60
|
+
"schema_id": "EventStreams.SampleSchema",
|
61
|
+
"description": "A sample event type",
|
62
|
+
"url": "https://events.twilio.com/v1/Types/com.twilio.test.example",
|
63
|
+
"links": {
|
64
|
+
"schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
|
65
|
+
}
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"date_created": "2020-08-13T12:50:19Z",
|
69
|
+
"date_updated": "2020-08-13T13:28:49Z",
|
70
|
+
"type": "com.twilio.test.example2",
|
71
|
+
"schema_id": "EventStreams.SampleSchema",
|
72
|
+
"description": "Another sample event type",
|
73
|
+
"url": "https://events.twilio.com/v1/Types/com.twilio.test.example2",
|
74
|
+
"links": {
|
75
|
+
"schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"meta": {
|
80
|
+
"page": 0,
|
81
|
+
"page_size": 20,
|
82
|
+
"first_page_url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0",
|
83
|
+
"previous_page_url": null,
|
84
|
+
"url": "https://events.twilio.com/v1/Types?PageSize=20&Page=0",
|
85
|
+
"next_page_url": null,
|
86
|
+
"key": "types"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
]
|
90
|
+
))
|
91
|
+
|
92
|
+
actual = @client.events.v1.event_types.list()
|
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.events.v1.event_types('type').fetch()
|
102
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
103
|
+
|
104
|
+
expect(
|
105
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
106
|
+
method: 'get',
|
107
|
+
url: 'https://events.twilio.com/v1/Types/type',
|
108
|
+
))).to eq(true)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "receives fetch responses" do
|
112
|
+
@holodeck.mock(Twilio::Response.new(
|
113
|
+
200,
|
114
|
+
%q[
|
115
|
+
{
|
116
|
+
"date_created": "2020-08-13T12:50:18Z",
|
117
|
+
"date_updated": "2020-08-13T13:28:48Z",
|
118
|
+
"type": "com.twilio.test.example",
|
119
|
+
"schema_id": "EventStreams.SampleSchema",
|
120
|
+
"description": "A sample subscription",
|
121
|
+
"url": "https://events.twilio.com/v1/Types/com.twilio.test.example",
|
122
|
+
"links": {
|
123
|
+
"schema": "https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
]
|
127
|
+
))
|
128
|
+
|
129
|
+
actual = @client.events.v1.event_types('type').fetch()
|
130
|
+
|
131
|
+
expect(actual).to_not eq(nil)
|
132
|
+
end
|
133
|
+
end
|