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,260 @@
|
|
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 'Role' do
|
12
|
+
it "can create" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.roles.create(friendly_name: 'friendly_name', type: 'conversation', permission: ['permission'])
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {
|
21
|
+
'FriendlyName' => 'friendly_name',
|
22
|
+
'Type' => 'conversation',
|
23
|
+
'Permission' => Twilio.serialize_list(['permission']) { |e| e },
|
24
|
+
}
|
25
|
+
expect(
|
26
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
27
|
+
method: 'post',
|
28
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles',
|
29
|
+
data: values,
|
30
|
+
))).to eq(true)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "receives create responses" do
|
34
|
+
@holodeck.mock(Twilio::Response.new(
|
35
|
+
201,
|
36
|
+
%q[
|
37
|
+
{
|
38
|
+
"sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
39
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
40
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
41
|
+
"friendly_name": "Conversation Role",
|
42
|
+
"type": "conversation",
|
43
|
+
"permissions": [
|
44
|
+
"sendMessage",
|
45
|
+
"leaveConversation",
|
46
|
+
"editOwnMessage",
|
47
|
+
"deleteOwnMessage"
|
48
|
+
],
|
49
|
+
"date_created": "2016-03-03T19:47:15Z",
|
50
|
+
"date_updated": "2016-03-03T19:47:15Z",
|
51
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
52
|
+
}
|
53
|
+
]
|
54
|
+
))
|
55
|
+
|
56
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
57
|
+
.roles.create(friendly_name: 'friendly_name', type: 'conversation', permission: ['permission'])
|
58
|
+
|
59
|
+
expect(actual).to_not eq(nil)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "can update" do
|
63
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
64
|
+
|
65
|
+
expect {
|
66
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
67
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(permission: ['permission'])
|
68
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
69
|
+
|
70
|
+
values = {'Permission' => Twilio.serialize_list(['permission']) { |e| e }, }
|
71
|
+
expect(
|
72
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
73
|
+
method: 'post',
|
74
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
75
|
+
data: values,
|
76
|
+
))).to eq(true)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "receives update responses" do
|
80
|
+
@holodeck.mock(Twilio::Response.new(
|
81
|
+
200,
|
82
|
+
%q[
|
83
|
+
{
|
84
|
+
"sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
85
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
86
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
87
|
+
"friendly_name": "Conversation Role",
|
88
|
+
"type": "conversation",
|
89
|
+
"permissions": [
|
90
|
+
"sendMessage",
|
91
|
+
"leaveConversation",
|
92
|
+
"editOwnMessage",
|
93
|
+
"deleteOwnMessage"
|
94
|
+
],
|
95
|
+
"date_created": "2016-03-03T19:47:15Z",
|
96
|
+
"date_updated": "2016-03-03T19:47:15Z",
|
97
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
98
|
+
}
|
99
|
+
]
|
100
|
+
))
|
101
|
+
|
102
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
103
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(permission: ['permission'])
|
104
|
+
|
105
|
+
expect(actual).to_not eq(nil)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "can delete" do
|
109
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
110
|
+
|
111
|
+
expect {
|
112
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
113
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
114
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
115
|
+
|
116
|
+
expect(
|
117
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
118
|
+
method: 'delete',
|
119
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
120
|
+
))).to eq(true)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "receives delete responses" do
|
124
|
+
@holodeck.mock(Twilio::Response.new(
|
125
|
+
204,
|
126
|
+
nil,
|
127
|
+
))
|
128
|
+
|
129
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
130
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
131
|
+
|
132
|
+
expect(actual).to eq(true)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "can fetch" do
|
136
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
137
|
+
|
138
|
+
expect {
|
139
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
140
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
141
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
142
|
+
|
143
|
+
expect(
|
144
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
145
|
+
method: 'get',
|
146
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
147
|
+
))).to eq(true)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "receives fetch responses" do
|
151
|
+
@holodeck.mock(Twilio::Response.new(
|
152
|
+
200,
|
153
|
+
%q[
|
154
|
+
{
|
155
|
+
"sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
156
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
157
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
158
|
+
"friendly_name": "Conversation Role",
|
159
|
+
"type": "conversation",
|
160
|
+
"permissions": [
|
161
|
+
"sendMessage",
|
162
|
+
"leaveConversation",
|
163
|
+
"editOwnMessage",
|
164
|
+
"deleteOwnMessage"
|
165
|
+
],
|
166
|
+
"date_created": "2016-03-03T19:47:15Z",
|
167
|
+
"date_updated": "2016-03-03T19:47:15Z",
|
168
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
169
|
+
}
|
170
|
+
]
|
171
|
+
))
|
172
|
+
|
173
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
174
|
+
.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
175
|
+
|
176
|
+
expect(actual).to_not eq(nil)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "can read" do
|
180
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
181
|
+
|
182
|
+
expect {
|
183
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
184
|
+
.roles.list()
|
185
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
186
|
+
|
187
|
+
expect(
|
188
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
189
|
+
method: 'get',
|
190
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles',
|
191
|
+
))).to eq(true)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "receives read_full responses" do
|
195
|
+
@holodeck.mock(Twilio::Response.new(
|
196
|
+
200,
|
197
|
+
%q[
|
198
|
+
{
|
199
|
+
"meta": {
|
200
|
+
"page": 0,
|
201
|
+
"page_size": 50,
|
202
|
+
"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=50&Page=0",
|
203
|
+
"previous_page_url": null,
|
204
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=50&Page=0",
|
205
|
+
"next_page_url": null,
|
206
|
+
"key": "roles"
|
207
|
+
},
|
208
|
+
"roles": [
|
209
|
+
{
|
210
|
+
"sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
211
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
212
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
213
|
+
"friendly_name": "Conversation Role",
|
214
|
+
"type": "conversation",
|
215
|
+
"permissions": [
|
216
|
+
"sendMessage",
|
217
|
+
"leaveConversation",
|
218
|
+
"editOwnMessage",
|
219
|
+
"deleteOwnMessage"
|
220
|
+
],
|
221
|
+
"date_created": "2016-03-03T19:47:15Z",
|
222
|
+
"date_updated": "2016-03-03T19:47:15Z",
|
223
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
224
|
+
}
|
225
|
+
]
|
226
|
+
}
|
227
|
+
]
|
228
|
+
))
|
229
|
+
|
230
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
231
|
+
.roles.list()
|
232
|
+
|
233
|
+
expect(actual).to_not eq(nil)
|
234
|
+
end
|
235
|
+
|
236
|
+
it "receives read_empty responses" do
|
237
|
+
@holodeck.mock(Twilio::Response.new(
|
238
|
+
200,
|
239
|
+
%q[
|
240
|
+
{
|
241
|
+
"meta": {
|
242
|
+
"page": 0,
|
243
|
+
"page_size": 50,
|
244
|
+
"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=50&Page=0",
|
245
|
+
"previous_page_url": null,
|
246
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles?PageSize=50&Page=0",
|
247
|
+
"next_page_url": null,
|
248
|
+
"key": "roles"
|
249
|
+
},
|
250
|
+
"roles": []
|
251
|
+
}
|
252
|
+
]
|
253
|
+
))
|
254
|
+
|
255
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
256
|
+
.roles.list()
|
257
|
+
|
258
|
+
expect(actual).to_not eq(nil)
|
259
|
+
end
|
260
|
+
end
|
@@ -0,0 +1,230 @@
|
|
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.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
17
|
+
.users.create(identity: 'identity')
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {'Identity' => 'identity', }
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'post',
|
24
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users',
|
25
|
+
data: values,
|
26
|
+
))).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "receives create responses" do
|
30
|
+
@holodeck.mock(Twilio::Response.new(
|
31
|
+
201,
|
32
|
+
%q[
|
33
|
+
{
|
34
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"identity": "admin",
|
39
|
+
"friendly_name": "name",
|
40
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
41
|
+
"is_online": null,
|
42
|
+
"date_created": "2019-12-16T22:18:37Z",
|
43
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
44
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
))
|
48
|
+
|
49
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
50
|
+
.users.create(identity: 'identity')
|
51
|
+
|
52
|
+
expect(actual).to_not eq(nil)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "can update" do
|
56
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
57
|
+
|
58
|
+
expect {
|
59
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
60
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
61
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
62
|
+
|
63
|
+
expect(
|
64
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
65
|
+
method: 'post',
|
66
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
67
|
+
))).to eq(true)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "receives update responses" do
|
71
|
+
@holodeck.mock(Twilio::Response.new(
|
72
|
+
200,
|
73
|
+
%q[
|
74
|
+
{
|
75
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
76
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
77
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
78
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
79
|
+
"identity": "admin",
|
80
|
+
"friendly_name": "new name",
|
81
|
+
"attributes": "{ \\"duty\\": \\"tech\\", \\"team\\": \\"internals\\" }",
|
82
|
+
"is_online": null,
|
83
|
+
"date_created": "2019-12-16T22:18:37Z",
|
84
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
85
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
))
|
89
|
+
|
90
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
91
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
|
92
|
+
|
93
|
+
expect(actual).to_not eq(nil)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can delete" do
|
97
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
98
|
+
|
99
|
+
expect {
|
100
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
101
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
102
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
103
|
+
|
104
|
+
expect(
|
105
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
106
|
+
method: 'delete',
|
107
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
108
|
+
))).to eq(true)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "receives delete responses" do
|
112
|
+
@holodeck.mock(Twilio::Response.new(
|
113
|
+
204,
|
114
|
+
nil,
|
115
|
+
))
|
116
|
+
|
117
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
118
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
119
|
+
|
120
|
+
expect(actual).to eq(true)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "can fetch" do
|
124
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
125
|
+
|
126
|
+
expect {
|
127
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
128
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
129
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
130
|
+
|
131
|
+
expect(
|
132
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
133
|
+
method: 'get',
|
134
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
135
|
+
))).to eq(true)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "receives fetch responses" do
|
139
|
+
@holodeck.mock(Twilio::Response.new(
|
140
|
+
200,
|
141
|
+
%q[
|
142
|
+
{
|
143
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
144
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
145
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
146
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
147
|
+
"identity": "admin",
|
148
|
+
"friendly_name": "name",
|
149
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
150
|
+
"is_online": null,
|
151
|
+
"date_created": "2019-12-16T22:18:37Z",
|
152
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
153
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
154
|
+
}
|
155
|
+
]
|
156
|
+
))
|
157
|
+
|
158
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
159
|
+
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
160
|
+
|
161
|
+
expect(actual).to_not eq(nil)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "can read" do
|
165
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
166
|
+
|
167
|
+
expect {
|
168
|
+
@client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
169
|
+
.users.list()
|
170
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
171
|
+
|
172
|
+
expect(
|
173
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
174
|
+
method: 'get',
|
175
|
+
url: 'https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users',
|
176
|
+
))).to eq(true)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "receives read_full responses" do
|
180
|
+
@holodeck.mock(Twilio::Response.new(
|
181
|
+
200,
|
182
|
+
%q[
|
183
|
+
{
|
184
|
+
"meta": {
|
185
|
+
"page": 0,
|
186
|
+
"page_size": 50,
|
187
|
+
"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=50&Page=0",
|
188
|
+
"previous_page_url": null,
|
189
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users?PageSize=50&Page=0",
|
190
|
+
"next_page_url": null,
|
191
|
+
"key": "users"
|
192
|
+
},
|
193
|
+
"users": [
|
194
|
+
{
|
195
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
196
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
197
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
198
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
199
|
+
"identity": "admin",
|
200
|
+
"friendly_name": "name",
|
201
|
+
"attributes": "{ \\"duty\\": \\"tech\\" }",
|
202
|
+
"is_online": null,
|
203
|
+
"date_created": "2019-12-16T22:18:37Z",
|
204
|
+
"date_updated": "2019-12-16T22:18:38Z",
|
205
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
206
|
+
},
|
207
|
+
{
|
208
|
+
"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
209
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
210
|
+
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
211
|
+
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
212
|
+
"identity": "agent0034",
|
213
|
+
"friendly_name": "John from customs",
|
214
|
+
"attributes": "{ \\"duty\\": \\"agent\\" }",
|
215
|
+
"is_online": false,
|
216
|
+
"date_created": "2020-03-24T20:38:21Z",
|
217
|
+
"date_updated": "2020-03-24T20:38:21Z",
|
218
|
+
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
219
|
+
}
|
220
|
+
]
|
221
|
+
}
|
222
|
+
]
|
223
|
+
))
|
224
|
+
|
225
|
+
actual = @client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
226
|
+
.users.list()
|
227
|
+
|
228
|
+
expect(actual).to_not eq(nil)
|
229
|
+
end
|
230
|
+
end
|