twilio-ruby 5.21.1 → 5.21.2

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +7 -4
  4. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +14 -1
  5. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +6 -4
  6. data/lib/twilio-ruby/rest/chat.rb +2 -2
  7. data/lib/twilio-ruby/rest/chat/v2.rb +4 -2
  8. data/lib/twilio-ruby/rest/chat/v2/credential.rb +50 -45
  9. data/lib/twilio-ruby/rest/chat/v2/service.rb +197 -146
  10. data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +43 -30
  11. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +85 -77
  12. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +48 -46
  13. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +117 -113
  14. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +98 -96
  15. data/lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb +90 -36
  16. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +38 -25
  17. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +49 -51
  18. data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +42 -34
  19. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +37 -31
  20. data/lib/twilio-ruby/rest/flex_api.rb +8 -0
  21. data/lib/twilio-ruby/rest/flex_api/v1.rb +15 -0
  22. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +515 -0
  23. data/lib/twilio-ruby/rest/ip_messaging.rb +2 -2
  24. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +4 -2
  25. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +50 -45
  26. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +197 -146
  27. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +43 -30
  28. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +85 -77
  29. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +48 -46
  30. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +117 -113
  31. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +98 -96
  32. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +90 -36
  33. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +38 -25
  34. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +49 -51
  35. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +42 -34
  36. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +37 -31
  37. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +1 -4
  38. data/lib/twilio-ruby/rest/voice/v1/voice_permission/settings.rb +207 -0
  39. data/lib/twilio-ruby/version.rb +1 -1
  40. data/spec/integration/flex_api/v1/flex_flow_spec.rb +255 -0
  41. data/spec/integration/voice/v1/voice_permission/settings_spec.rb +77 -0
  42. metadata +8 -2
@@ -16,11 +16,11 @@ module Twilio
16
16
  ##
17
17
  # Initialize the UserChannelList
18
18
  # @param [Version] version Version that contains the resource
19
- # @param [String] service_sid The unique id of the
20
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) this channel
21
- # belongs to.
22
- # @param [String] user_sid The unique id of the
23
- # [User](https://www.twilio.com/docs/api/chat/rest/users) this Channel belongs to.
19
+ # @param [String] service_sid The SID of the
20
+ # [Service](https://www.twilio.com/docs/chat/rest/services) the resource is
21
+ # associated with.
22
+ # @param [String] user_sid The SID of the
23
+ # [User](https://www.twilio.com/docs/chat/rest/users) the User Channel belongs to.
24
24
  # @return [UserChannelList] UserChannelList
25
25
  def initialize(version, service_sid: nil, user_sid: nil)
26
26
  super(version)
@@ -157,11 +157,15 @@ module Twilio
157
157
  ##
158
158
  # Initialize the UserChannelContext
159
159
  # @param [Version] version Version that contains the resource
160
- # @param [String] service_sid The unique id of the
161
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) those channels
162
- # belong to.
163
- # @param [String] user_sid The unique id of a User.
164
- # @param [String] channel_sid The unique id of a Channel.
160
+ # @param [String] service_sid The SID of the
161
+ # [Service](https://www.twilio.com/docs/chat/rest/services) to fetch the User
162
+ # Channel resource from.
163
+ # @param [String] user_sid The SID of the
164
+ # [User](https://www.twilio.com/docs/chat/rest/users) to fetch the User Channel
165
+ # resource from.
166
+ # @param [String] channel_sid The SID of the
167
+ # [Channel](https://www.twilio.com/docs/chat/channels) that has the User Channel
168
+ # to fetch.
165
169
  # @return [UserChannelContext] UserChannelContext
166
170
  def initialize(version, service_sid, user_sid, channel_sid)
167
171
  super(version)
@@ -194,8 +198,8 @@ module Twilio
194
198
 
195
199
  ##
196
200
  # Update the UserChannelInstance
197
- # @param [user_channel.NotificationLevel] notification_level Push notification
198
- # level to be assigned to Channel of the User.
201
+ # @param [user_channel.NotificationLevel] notification_level The push notification
202
+ # level to assign to the User Channel. Can be: `default` or `muted`.
199
203
  # @return [UserChannelInstance] Updated UserChannelInstance
200
204
  def update(notification_level: nil)
201
205
  data = Twilio::Values.of({'NotificationLevel' => notification_level, })
@@ -235,12 +239,14 @@ module Twilio
235
239
  # Initialize the UserChannelInstance
236
240
  # @param [Version] version Version that contains the resource
237
241
  # @param [Hash] payload payload that contains response from Twilio
238
- # @param [String] service_sid The unique id of the
239
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) this channel
240
- # belongs to.
241
- # @param [String] user_sid The unique id of the
242
- # [User](https://www.twilio.com/docs/api/chat/rest/users) this Channel belongs to.
243
- # @param [String] channel_sid The unique id of a Channel.
242
+ # @param [String] service_sid The SID of the
243
+ # [Service](https://www.twilio.com/docs/chat/rest/services) the resource is
244
+ # associated with.
245
+ # @param [String] user_sid The SID of the
246
+ # [User](https://www.twilio.com/docs/chat/rest/users) the User Channel belongs to.
247
+ # @param [String] channel_sid The SID of the
248
+ # [Channel](https://www.twilio.com/docs/chat/channels) that has the User Channel
249
+ # to fetch.
244
250
  # @return [UserChannelInstance] UserChannelInstance
245
251
  def initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil)
246
252
  super(version)
@@ -286,67 +292,67 @@ module Twilio
286
292
  end
287
293
 
288
294
  ##
289
- # @return [String] The unique id of the Account responsible for this channel.
295
+ # @return [String] The SID of the Account that created the resource
290
296
  def account_sid
291
297
  @properties['account_sid']
292
298
  end
293
299
 
294
300
  ##
295
- # @return [String] The unique id of the Service this channel belongs to.
301
+ # @return [String] The SID of the Service that the resource is associated with
296
302
  def service_sid
297
303
  @properties['service_sid']
298
304
  end
299
305
 
300
306
  ##
301
- # @return [String] The unique id of a Channel.
307
+ # @return [String] The SID of the Channel the resource belongs to
302
308
  def channel_sid
303
309
  @properties['channel_sid']
304
310
  end
305
311
 
306
312
  ##
307
- # @return [String] The unique id of the User this Channel belongs to.
313
+ # @return [String] The SID of the User the User Channel belongs to
308
314
  def user_sid
309
315
  @properties['user_sid']
310
316
  end
311
317
 
312
318
  ##
313
- # @return [String] The unique id of this User as a Member in this Channel.
319
+ # @return [String] The SID of the User as a Member in the Channel
314
320
  def member_sid
315
321
  @properties['member_sid']
316
322
  end
317
323
 
318
324
  ##
319
- # @return [user_channel.ChannelStatus] The status of the User on this Channel.
325
+ # @return [user_channel.ChannelStatus] The status of the User on the Channel
320
326
  def status
321
327
  @properties['status']
322
328
  end
323
329
 
324
330
  ##
325
- # @return [String] The index of the last read Message in this Channel for this User.
331
+ # @return [String] The index of the last Message in the Channel the Member has read
326
332
  def last_consumed_message_index
327
333
  @properties['last_consumed_message_index']
328
334
  end
329
335
 
330
336
  ##
331
- # @return [String] The count of unread Messages in this Channel for this User.
337
+ # @return [String] The number of unread Messages in the Channel for the User
332
338
  def unread_messages_count
333
339
  @properties['unread_messages_count']
334
340
  end
335
341
 
336
342
  ##
337
- # @return [String] The links
343
+ # @return [String] Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel
338
344
  def links
339
345
  @properties['links']
340
346
  end
341
347
 
342
348
  ##
343
- # @return [String] An absolute URL for this User Channel.
349
+ # @return [String] The absolute URL of the resource
344
350
  def url
345
351
  @properties['url']
346
352
  end
347
353
 
348
354
  ##
349
- # @return [user_channel.NotificationLevel] The notification level of the User for this Channel.
355
+ # @return [user_channel.NotificationLevel] The push notification level of the User for the Channel
350
356
  def notification_level
351
357
  @properties['notification_level']
352
358
  end
@@ -360,8 +366,8 @@ module Twilio
360
366
 
361
367
  ##
362
368
  # Update the UserChannelInstance
363
- # @param [user_channel.NotificationLevel] notification_level Push notification
364
- # level to be assigned to Channel of the User.
369
+ # @param [user_channel.NotificationLevel] notification_level The push notification
370
+ # level to assign to the User Channel. Can be: `default` or `muted`.
365
371
  # @return [UserChannelInstance] Updated UserChannelInstance
366
372
  def update(notification_level: nil)
367
373
  context.update(notification_level: notification_level, )
@@ -33,8 +33,6 @@ module Twilio
33
33
  # @param [String] to The To phonenumber of the phone being verified
34
34
  # @param [String] channel The method in which the phone will be verified. Either
35
35
  # sms or call
36
- # @param [String] custom_message A character string containing a custom message
37
- # for this verification
38
36
  # @param [String] send_digits Digits to send when a phone call is started, same
39
37
  # parameters as in Programmable Voice are supported
40
38
  # @param [String] locale Supported values are af, ar, ca, cs, da, de, el, en, es,
@@ -47,11 +45,10 @@ module Twilio
47
45
  # @param [String] payee Payee of the associated PSD2 compliant transaction.
48
46
  # Requires the PSD2 Service flag enabled.
49
47
  # @return [VerificationInstance] Newly created VerificationInstance
50
- def create(to: nil, channel: nil, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset)
48
+ def create(to: nil, channel: nil, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset)
51
49
  data = Twilio::Values.of({
52
50
  'To' => to,
53
51
  'Channel' => channel,
54
- 'CustomMessage' => custom_message,
55
52
  'SendDigits' => send_digits,
56
53
  'Locale' => locale,
57
54
  'CustomCode' => custom_code,
@@ -0,0 +1,207 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Voice < Domain
12
+ class V1 < Version
13
+ class VoicePermissionList < ListResource
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class SettingsList < ListResource
17
+ ##
18
+ # Initialize the SettingsList
19
+ # @param [Version] version Version that contains the resource
20
+ # @return [SettingsList] SettingsList
21
+ def initialize(version)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {}
26
+ end
27
+
28
+ ##
29
+ # Provide a user friendly representation
30
+ def to_s
31
+ '#<Twilio.Voice.V1.SettingsList>'
32
+ end
33
+ end
34
+
35
+ ##
36
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
37
+ class SettingsPage < Page
38
+ ##
39
+ # Initialize the SettingsPage
40
+ # @param [Version] version Version that contains the resource
41
+ # @param [Response] response Response from the API
42
+ # @param [Hash] solution Path solution for the resource
43
+ # @return [SettingsPage] SettingsPage
44
+ def initialize(version, response, solution)
45
+ super(version, response)
46
+
47
+ # Path Solution
48
+ @solution = solution
49
+ end
50
+
51
+ ##
52
+ # Build an instance of SettingsInstance
53
+ # @param [Hash] payload Payload response from the API
54
+ # @return [SettingsInstance] SettingsInstance
55
+ def get_instance(payload)
56
+ SettingsInstance.new(@version, payload, )
57
+ end
58
+
59
+ ##
60
+ # Provide a user friendly representation
61
+ def to_s
62
+ '<Twilio.Voice.V1.SettingsPage>'
63
+ end
64
+ end
65
+
66
+ ##
67
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
68
+ class SettingsContext < InstanceContext
69
+ ##
70
+ # Initialize the SettingsContext
71
+ # @param [Version] version Version that contains the resource
72
+ # @return [SettingsContext] SettingsContext
73
+ def initialize(version)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {}
78
+ @uri = "/Settings"
79
+ end
80
+
81
+ ##
82
+ # Fetch a SettingsInstance
83
+ # @return [SettingsInstance] Fetched SettingsInstance
84
+ def fetch
85
+ params = Twilio::Values.of({})
86
+
87
+ payload = @version.fetch(
88
+ 'GET',
89
+ @uri,
90
+ params,
91
+ )
92
+
93
+ SettingsInstance.new(@version, payload, )
94
+ end
95
+
96
+ ##
97
+ # Update the SettingsInstance
98
+ # @param [Boolean] dialing_permissions_inheritance `true` for this sub-account to
99
+ # inherit voice dialing permissions from the Master Project; otherwise `false`.
100
+ # @return [SettingsInstance] Updated SettingsInstance
101
+ def update(dialing_permissions_inheritance: :unset)
102
+ data = Twilio::Values.of({'DialingPermissionsInheritance' => dialing_permissions_inheritance, })
103
+
104
+ payload = @version.update(
105
+ 'POST',
106
+ @uri,
107
+ data: data,
108
+ )
109
+
110
+ SettingsInstance.new(@version, payload, )
111
+ end
112
+
113
+ ##
114
+ # Provide a user friendly representation
115
+ def to_s
116
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
117
+ "#<Twilio.Voice.V1.SettingsContext #{context}>"
118
+ end
119
+
120
+ ##
121
+ # Provide a detailed, user friendly representation
122
+ def inspect
123
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
124
+ "#<Twilio.Voice.V1.SettingsContext #{context}>"
125
+ end
126
+ end
127
+
128
+ ##
129
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
130
+ class SettingsInstance < InstanceResource
131
+ ##
132
+ # Initialize the SettingsInstance
133
+ # @param [Version] version Version that contains the resource
134
+ # @param [Hash] payload payload that contains response from Twilio
135
+ # @return [SettingsInstance] SettingsInstance
136
+ def initialize(version, payload)
137
+ super(version)
138
+
139
+ # Marshaled Properties
140
+ @properties = {
141
+ 'dialing_permissions_inheritance' => payload['dialing_permissions_inheritance'],
142
+ 'url' => payload['url'],
143
+ }
144
+
145
+ # Context
146
+ @instance_context = nil
147
+ @params = {}
148
+ end
149
+
150
+ ##
151
+ # Generate an instance context for the instance, the context is capable of
152
+ # performing various actions. All instance actions are proxied to the context
153
+ # @return [SettingsContext] SettingsContext for this SettingsInstance
154
+ def context
155
+ unless @instance_context
156
+ @instance_context = SettingsContext.new(@version, )
157
+ end
158
+ @instance_context
159
+ end
160
+
161
+ ##
162
+ # @return [Boolean] `true` if this sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`
163
+ def dialing_permissions_inheritance
164
+ @properties['dialing_permissions_inheritance']
165
+ end
166
+
167
+ ##
168
+ # @return [String] The absolute URL of this resource
169
+ def url
170
+ @properties['url']
171
+ end
172
+
173
+ ##
174
+ # Fetch a SettingsInstance
175
+ # @return [SettingsInstance] Fetched SettingsInstance
176
+ def fetch
177
+ context.fetch
178
+ end
179
+
180
+ ##
181
+ # Update the SettingsInstance
182
+ # @param [Boolean] dialing_permissions_inheritance `true` for this sub-account to
183
+ # inherit voice dialing permissions from the Master Project; otherwise `false`.
184
+ # @return [SettingsInstance] Updated SettingsInstance
185
+ def update(dialing_permissions_inheritance: :unset)
186
+ context.update(dialing_permissions_inheritance: dialing_permissions_inheritance, )
187
+ end
188
+
189
+ ##
190
+ # Provide a user friendly representation
191
+ def to_s
192
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
193
+ "<Twilio.Voice.V1.SettingsInstance #{values}>"
194
+ end
195
+
196
+ ##
197
+ # Provide a detailed, user friendly representation
198
+ def inspect
199
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
200
+ "<Twilio.Voice.V1.SettingsInstance #{values}>"
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
207
+ end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.21.1'
2
+ VERSION = '5.21.2'
3
3
  end
@@ -0,0 +1,255 @@
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 'FlexFlow' do
12
+ it "can read" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.flex_api.v1.flex_flow.list()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://flex-api.twilio.com/v1/FlexFlows',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives read_full responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "meta": {
33
+ "page": 0,
34
+ "page_size": 50,
35
+ "first_page_url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
36
+ "previous_page_url": null,
37
+ "url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
38
+ "next_page_url": null,
39
+ "key": "flex_flows"
40
+ },
41
+ "flex_flows": [
42
+ {
43
+ "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
44
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
45
+ "date_created": "2016-08-01T22:10:40Z",
46
+ "date_updated": "2016-08-01T22:10:40Z",
47
+ "friendly_name": "friendly_name",
48
+ "chat_service_sid": "SIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
49
+ "channel_type": "sms",
50
+ "contact_identity": "12345",
51
+ "enabled": true,
52
+ "integration_type": "studio",
53
+ "integration": {
54
+ "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
55
+ },
56
+ "long_lived": true,
57
+ "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ ))
63
+
64
+ actual = @client.flex_api.v1.flex_flow.list()
65
+
66
+ expect(actual).to_not eq(nil)
67
+ end
68
+
69
+ it "receives read_empty responses" do
70
+ @holodeck.mock(Twilio::Response.new(
71
+ 200,
72
+ %q[
73
+ {
74
+ "meta": {
75
+ "page": 0,
76
+ "page_size": 50,
77
+ "first_page_url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
78
+ "previous_page_url": null,
79
+ "url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
80
+ "next_page_url": null,
81
+ "key": "flex_flows"
82
+ },
83
+ "flex_flows": []
84
+ }
85
+ ]
86
+ ))
87
+
88
+ actual = @client.flex_api.v1.flex_flow.list()
89
+
90
+ expect(actual).to_not eq(nil)
91
+ end
92
+
93
+ it "can fetch" do
94
+ @holodeck.mock(Twilio::Response.new(500, ''))
95
+
96
+ expect {
97
+ @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
98
+ }.to raise_exception(Twilio::REST::TwilioError)
99
+
100
+ values = {}
101
+ expect(
102
+ @holodeck.has_request?(Holodeck::Request.new(
103
+ method: 'get',
104
+ url: 'https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
105
+ ))).to eq(true)
106
+ end
107
+
108
+ it "receives fetch responses" do
109
+ @holodeck.mock(Twilio::Response.new(
110
+ 200,
111
+ %q[
112
+ {
113
+ "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
114
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
115
+ "date_created": "2016-08-01T22:10:40Z",
116
+ "date_updated": "2016-08-01T22:10:40Z",
117
+ "friendly_name": "friendly_name",
118
+ "chat_service_sid": "SIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
119
+ "channel_type": "sms",
120
+ "contact_identity": "12345",
121
+ "enabled": true,
122
+ "integration_type": "studio",
123
+ "integration": {
124
+ "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
125
+ },
126
+ "long_lived": true,
127
+ "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
128
+ }
129
+ ]
130
+ ))
131
+
132
+ actual = @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
133
+
134
+ expect(actual).to_not eq(nil)
135
+ end
136
+
137
+ it "can create" do
138
+ @holodeck.mock(Twilio::Response.new(500, ''))
139
+
140
+ expect {
141
+ @client.flex_api.v1.flex_flow.create(friendly_name: 'friendly_name', chat_service_sid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', channel_type: 'web')
142
+ }.to raise_exception(Twilio::REST::TwilioError)
143
+
144
+ values = {
145
+ 'FriendlyName' => 'friendly_name',
146
+ 'ChatServiceSid' => 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
147
+ 'ChannelType' => 'web',
148
+ }
149
+ expect(
150
+ @holodeck.has_request?(Holodeck::Request.new(
151
+ method: 'post',
152
+ url: 'https://flex-api.twilio.com/v1/FlexFlows',
153
+ data: values,
154
+ ))).to eq(true)
155
+ end
156
+
157
+ it "receives create responses" do
158
+ @holodeck.mock(Twilio::Response.new(
159
+ 201,
160
+ %q[
161
+ {
162
+ "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
163
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
164
+ "date_created": "2016-08-01T22:10:40Z",
165
+ "date_updated": "2016-08-01T22:10:40Z",
166
+ "friendly_name": "friendly_name",
167
+ "chat_service_sid": "SIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
168
+ "channel_type": "sms",
169
+ "contact_identity": "12345",
170
+ "enabled": true,
171
+ "integration_type": "studio",
172
+ "integration": {
173
+ "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
174
+ },
175
+ "long_lived": true,
176
+ "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
177
+ }
178
+ ]
179
+ ))
180
+
181
+ actual = @client.flex_api.v1.flex_flow.create(friendly_name: 'friendly_name', chat_service_sid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', channel_type: 'web')
182
+
183
+ expect(actual).to_not eq(nil)
184
+ end
185
+
186
+ it "can update" do
187
+ @holodeck.mock(Twilio::Response.new(500, ''))
188
+
189
+ expect {
190
+ @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
191
+ }.to raise_exception(Twilio::REST::TwilioError)
192
+
193
+ values = {}
194
+ expect(
195
+ @holodeck.has_request?(Holodeck::Request.new(
196
+ method: 'post',
197
+ url: 'https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
198
+ ))).to eq(true)
199
+ end
200
+
201
+ it "receives update responses" do
202
+ @holodeck.mock(Twilio::Response.new(
203
+ 200,
204
+ %q[
205
+ {
206
+ "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
207
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
208
+ "date_created": "2016-08-01T22:10:40Z",
209
+ "date_updated": "2016-08-01T22:10:40Z",
210
+ "friendly_name": "friendly_name",
211
+ "chat_service_sid": "SIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
212
+ "channel_type": "sms",
213
+ "contact_identity": "12345",
214
+ "enabled": true,
215
+ "integration_type": "studio",
216
+ "integration": {
217
+ "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
218
+ },
219
+ "long_lived": true,
220
+ "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
221
+ }
222
+ ]
223
+ ))
224
+
225
+ actual = @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update()
226
+
227
+ expect(actual).to_not eq(nil)
228
+ end
229
+
230
+ it "can delete" do
231
+ @holodeck.mock(Twilio::Response.new(500, ''))
232
+
233
+ expect {
234
+ @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
235
+ }.to raise_exception(Twilio::REST::TwilioError)
236
+
237
+ values = {}
238
+ expect(
239
+ @holodeck.has_request?(Holodeck::Request.new(
240
+ method: 'delete',
241
+ url: 'https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
242
+ ))).to eq(true)
243
+ end
244
+
245
+ it "receives delete responses" do
246
+ @holodeck.mock(Twilio::Response.new(
247
+ 204,
248
+ nil,
249
+ ))
250
+
251
+ actual = @client.flex_api.v1.flex_flow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
252
+
253
+ expect(actual).to eq(true)
254
+ end
255
+ end