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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +9 -3
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/http/http_client.rb +0 -1
  5. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +196 -0
  6. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +197 -0
  7. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +232 -0
  8. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +44 -0
  9. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +517 -0
  10. data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +35 -0
  11. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +336 -0
  12. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +393 -0
  13. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +409 -0
  14. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +479 -0
  15. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +506 -0
  16. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +336 -0
  17. data/lib/twilio-ruby/rest/preview/proxy/service.rb +467 -0
  18. data/lib/twilio-ruby/rest/preview/proxy.rb +35 -0
  19. data/lib/twilio-ruby/rest/preview.rb +34 -1
  20. data/lib/twilio-ruby/version.rb +1 -1
  21. data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
  22. data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
  23. data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
  24. data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +277 -0
  25. data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
  26. data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
  27. data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
  28. data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
  29. data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
  30. data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
  31. data/spec/integration/preview/proxy/service_spec.rb +200 -0
  32. 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 HostedNumbers < Version
11
+ ##
12
+ # Initialize the HostedNumbers version of Preview
13
+ def initialize(domain)
14
+ super
15
+ @version = 'HostedNumbers'
16
+ @hosted_number_orders = nil
17
+ end
18
+
19
+ def hosted_number_orders(sid=:unset)
20
+ if sid == :unset
21
+ @hosted_number_orders ||= HostedNumberOrderList.new self
22
+ else
23
+ HostedNumberOrderContext.new(self, sid)
24
+ end
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '<Twilio::REST::Preview::HostedNumbers>'
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,336 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Proxy < Version
11
+ class ServiceContext < InstanceContext
12
+ class PhoneNumberList < ListResource
13
+ ##
14
+ # Initialize the PhoneNumberList
15
+ # @param [Version] version Version that contains the resource
16
+ # @param [String] service_sid The unique SID identifier of the Service.
17
+ # @return [PhoneNumberList] PhoneNumberList
18
+ def initialize(version, service_sid: nil)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {
23
+ service_sid: service_sid
24
+ }
25
+ @uri = "/Services/#{@solution[:service_sid]}/PhoneNumbers"
26
+ end
27
+
28
+ ##
29
+ # Retrieve a single page of PhoneNumberInstance records from the API.
30
+ # Request is executed immediately.
31
+ # @param [String] sid The phone-number Sid that uniquely identifies this resource
32
+ # @return [PhoneNumberInstance] Newly created PhoneNumberInstance
33
+ def create(sid: nil)
34
+ data = {
35
+ 'Sid' => sid,
36
+ }
37
+
38
+ payload = @version.create(
39
+ 'POST',
40
+ @uri,
41
+ data: data
42
+ )
43
+
44
+ return PhoneNumberInstance.new(
45
+ @version,
46
+ payload,
47
+ service_sid: @solution[:service_sid],
48
+ )
49
+ end
50
+
51
+ ##
52
+ # Lists PhoneNumberInstance records from the API as a list.
53
+ # Unlike stream(), this operation is eager and will load `limit` records into
54
+ # memory before returning.
55
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
56
+ # guarantees to never return more than limit. Default is no limit
57
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
58
+ # the default value of 50 records. If no page_size is defined
59
+ # but a limit is defined, stream() will attempt to read the
60
+ # limit with the most efficient page size, i.e. min(limit, 1000)
61
+ # @return [Array] Array of up to limit results
62
+ def list(limit: nil, page_size: nil)
63
+ self.stream(
64
+ limit: limit,
65
+ page_size: page_size
66
+ ).entries
67
+ end
68
+
69
+ ##
70
+ # Streams PhoneNumberInstance records from the API as an Enumerable.
71
+ # This operation lazily loads records as efficiently as possible until the limit
72
+ # is reached.
73
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
74
+ # guarantees to never return more than limit. Default is no limit
75
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
76
+ # the default value of 50 records. If no page_size is defined
77
+ # but a limit is defined, stream() will attempt to read the
78
+ # limit with the most efficient page size, i.e. min(limit, 1000)
79
+ # @return [Enumerable] Enumerable that will yield up to limit results
80
+ def stream(limit: nil, page_size: nil)
81
+ limits = @version.read_limits(limit, page_size)
82
+
83
+ page = self.page(
84
+ page_size: limits[:page_size],
85
+ )
86
+
87
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
88
+ end
89
+
90
+ ##
91
+ # When passed a block, yields PhoneNumberInstance records from the API.
92
+ # This operation lazily loads records as efficiently as possible until the limit
93
+ # is reached.
94
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
95
+ # guarantees to never return more than limit. Default is no limit
96
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
97
+ # the default value of 50 records. If no page_size is defined
98
+ # but a limit is defined, stream() will attempt to read the
99
+ # limit with the most efficient page size, i.e. min(limit, 1000)
100
+ def each
101
+ limits = @version.read_limits
102
+
103
+ page = self.page(
104
+ page_size: limits[:page_size],
105
+ )
106
+
107
+ @version.stream(page,
108
+ limit: limits[:limit],
109
+ page_limit: limits[:page_limit]).each {|x| yield x}
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of PhoneNumberInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [String] page_token PageToken provided by the API
116
+ # @param [Integer] page_number Page Number, this value is simply for client state
117
+ # @param [Integer] page_size Number of records to return, defaults to 50
118
+ # @return [Page] Page of PhoneNumberInstance
119
+ def page(page_token: nil, page_number: nil, page_size: nil)
120
+ params = {
121
+ 'PageToken' => page_token,
122
+ 'Page' => page_number,
123
+ 'PageSize' => page_size,
124
+ }
125
+ response = @version.page(
126
+ 'GET',
127
+ @uri,
128
+ params
129
+ )
130
+ return PhoneNumberPage.new(@version, response, @solution)
131
+ end
132
+
133
+ ##
134
+ # Provide a user friendly representation
135
+ def to_s
136
+ '#<Twilio.Preview.Proxy.PhoneNumberList>'
137
+ end
138
+ end
139
+
140
+ class PhoneNumberPage < Page
141
+ ##
142
+ # Initialize the PhoneNumberPage
143
+ # @param [Version] version Version that contains the resource
144
+ # @param [Response] response Response from the API
145
+ # @param [Hash] solution Path solution for the resource
146
+ # @param [String] service_sid The unique SID identifier of the Service.
147
+ # @return [PhoneNumberPage] PhoneNumberPage
148
+ def initialize(version, response, solution)
149
+ super(version, response)
150
+
151
+ # Path Solution
152
+ @solution = solution
153
+ end
154
+
155
+ ##
156
+ # Build an instance of PhoneNumberInstance
157
+ # @param [Hash] payload Payload response from the API
158
+ # @return [PhoneNumberInstance] PhoneNumberInstance
159
+ def get_instance(payload)
160
+ return PhoneNumberInstance.new(
161
+ @version,
162
+ payload,
163
+ service_sid: @solution[:service_sid],
164
+ )
165
+ end
166
+
167
+ ##
168
+ # Provide a user friendly representation
169
+ def to_s
170
+ '<Twilio.Preview.Proxy.PhoneNumberPage>'
171
+ end
172
+ end
173
+
174
+ class PhoneNumberContext < InstanceContext
175
+ ##
176
+ # Initialize the PhoneNumberContext
177
+ # @param [Version] version Version that contains the resource
178
+ # @param [String] service_sid The service_sid
179
+ # @param [String] sid The phone-number Sid that uniquely identifies this resource
180
+ # @return [PhoneNumberContext] PhoneNumberContext
181
+ def initialize(version, service_sid, sid)
182
+ super(version)
183
+
184
+ # Path Solution
185
+ @solution = {
186
+ service_sid: service_sid,
187
+ sid: sid,
188
+ }
189
+ @uri = "/Services/#{@solution[:service_sid]}/PhoneNumbers/#{@solution[:sid]}"
190
+ end
191
+
192
+ ##
193
+ # Deletes the PhoneNumberInstance
194
+ # @return [Boolean] true if delete succeeds, true otherwise
195
+ def delete
196
+ return @version.delete('delete', @uri)
197
+ end
198
+
199
+ ##
200
+ # Fetch a PhoneNumberInstance
201
+ # @return [PhoneNumberInstance] Fetched PhoneNumberInstance
202
+ def fetch
203
+ params = {}
204
+
205
+ payload = @version.fetch(
206
+ 'GET',
207
+ @uri,
208
+ params,
209
+ )
210
+
211
+ return PhoneNumberInstance.new(
212
+ @version,
213
+ payload,
214
+ service_sid: @solution[:service_sid],
215
+ sid: @solution[:sid],
216
+ )
217
+ end
218
+
219
+ ##
220
+ # Provide a user friendly representation
221
+ def to_s
222
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
223
+ "#<Twilio.Preview.Proxy.PhoneNumberContext #{context}>"
224
+ end
225
+ end
226
+
227
+ class PhoneNumberInstance < InstanceResource
228
+ ##
229
+ # Initialize the PhoneNumberInstance
230
+ # @param [Version] version Version that contains the resource
231
+ # @param [Hash] payload payload that contains response from Twilio
232
+ # @param [String] service_sid The unique SID identifier of the Service.
233
+ # @param [String] sid The phone-number Sid that uniquely identifies this resource
234
+ # @return [PhoneNumberInstance] PhoneNumberInstance
235
+ def initialize(version, payload, service_sid: nil, sid: nil)
236
+ super(version)
237
+
238
+ # Marshaled Properties
239
+ @properties = {
240
+ 'sid' => payload['sid'],
241
+ 'account_sid' => payload['account_sid'],
242
+ 'service_sid' => payload['service_sid'],
243
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
244
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
245
+ 'phone_number' => payload['phone_number'],
246
+ 'country_code' => payload['country_code'],
247
+ 'capabilities' => payload['capabilities'],
248
+ 'url' => payload['url'],
249
+ }
250
+
251
+ # Context
252
+ @instance_context = nil
253
+ @params = {
254
+ 'service_sid' => service_sid,
255
+ 'sid' => sid || @properties['sid'],
256
+ }
257
+ end
258
+
259
+ ##
260
+ # Generate an instance context for the instance, the context is capable of
261
+ # performing various actions. All instance actions are proxied to the context
262
+ # @param [Version] version Version that contains the resource
263
+ # @return [PhoneNumberContext] PhoneNumberContext for this PhoneNumberInstance
264
+ def context
265
+ unless @instance_context
266
+ @instance_context = PhoneNumberContext.new(
267
+ @version,
268
+ @params['service_sid'],
269
+ @params['sid'],
270
+ )
271
+ end
272
+ @instance_context
273
+ end
274
+
275
+ def sid
276
+ @properties['sid']
277
+ end
278
+
279
+ def account_sid
280
+ @properties['account_sid']
281
+ end
282
+
283
+ def service_sid
284
+ @properties['service_sid']
285
+ end
286
+
287
+ def date_created
288
+ @properties['date_created']
289
+ end
290
+
291
+ def date_updated
292
+ @properties['date_updated']
293
+ end
294
+
295
+ def phone_number
296
+ @properties['phone_number']
297
+ end
298
+
299
+ def country_code
300
+ @properties['country_code']
301
+ end
302
+
303
+ def capabilities
304
+ @properties['capabilities']
305
+ end
306
+
307
+ def url
308
+ @properties['url']
309
+ end
310
+
311
+ ##
312
+ # Deletes the PhoneNumberInstance
313
+ # @return [Boolean] true if delete succeeds, true otherwise
314
+ def delete
315
+ context.delete
316
+ end
317
+
318
+ ##
319
+ # Fetch a PhoneNumberInstance
320
+ # @return [PhoneNumberInstance] Fetched PhoneNumberInstance
321
+ def fetch
322
+ context.fetch
323
+ end
324
+
325
+ ##
326
+ # Provide a user friendly representation
327
+ def to_s
328
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
329
+ "<Twilio.Preview.Proxy.PhoneNumberInstance #{values}>"
330
+ end
331
+ end
332
+ end
333
+ end
334
+ end
335
+ end
336
+ end
@@ -0,0 +1,393 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Proxy < Version
11
+ class ServiceContext < InstanceContext
12
+ class SessionContext < InstanceContext
13
+ class InteractionList < ListResource
14
+ ##
15
+ # Initialize the InteractionList
16
+ # @param [Version] version Version that contains the resource
17
+ # @param [String] service_sid The unique SID identifier of the Service.
18
+ # @param [String] session_sid The unique SID identifier of the Session.
19
+ # @return [InteractionList] InteractionList
20
+ def initialize(version, service_sid: nil, session_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ service_sid: service_sid,
26
+ session_sid: session_sid
27
+ }
28
+ @uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Interactions"
29
+ end
30
+
31
+ ##
32
+ # Lists InteractionInstance records from the API as a list.
33
+ # Unlike stream(), this operation is eager and will load `limit` records into
34
+ # memory before returning.
35
+ # @param [interaction.ResourceStatus] inbound_participant_status The Inbound
36
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
37
+ # `failed`.
38
+ # @param [interaction.ResourceStatus] outbound_participant_status The Outbound
39
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
40
+ # `failed`.
41
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
42
+ # guarantees to never return more than limit. Default is no limit
43
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
44
+ # the default value of 50 records. If no page_size is defined
45
+ # but a limit is defined, stream() will attempt to read the
46
+ # limit with the most efficient page size, i.e. min(limit, 1000)
47
+ # @return [Array] Array of up to limit results
48
+ def list(inbound_participant_status: nil, outbound_participant_status: nil, limit: nil, page_size: nil)
49
+ self.stream(
50
+ inbound_participant_status: inbound_participant_status,
51
+ outbound_participant_status: outbound_participant_status,
52
+ limit: limit,
53
+ page_size: page_size
54
+ ).entries
55
+ end
56
+
57
+ ##
58
+ # Streams InteractionInstance records from the API as an Enumerable.
59
+ # This operation lazily loads records as efficiently as possible until the limit
60
+ # is reached.
61
+ # @param [interaction.ResourceStatus] inbound_participant_status The Inbound
62
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
63
+ # `failed`.
64
+ # @param [interaction.ResourceStatus] outbound_participant_status The Outbound
65
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
66
+ # `failed`.
67
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
68
+ # guarantees to never return more than limit. Default is no limit
69
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
70
+ # the default value of 50 records. If no page_size is defined
71
+ # but a limit is defined, stream() will attempt to read the
72
+ # limit with the most efficient page size, i.e. min(limit, 1000)
73
+ # @return [Enumerable] Enumerable that will yield up to limit results
74
+ def stream(inbound_participant_status: nil, outbound_participant_status: nil, limit: nil, page_size: nil)
75
+ limits = @version.read_limits(limit, page_size)
76
+
77
+ page = self.page(
78
+ inbound_participant_status: inbound_participant_status,
79
+ outbound_participant_status: outbound_participant_status,
80
+ page_size: limits[:page_size],
81
+ )
82
+
83
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
84
+ end
85
+
86
+ ##
87
+ # When passed a block, yields InteractionInstance records from the API.
88
+ # This operation lazily loads records as efficiently as possible until the limit
89
+ # is reached.
90
+ # @param [interaction.ResourceStatus] inbound_participant_status The Inbound
91
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
92
+ # `failed`.
93
+ # @param [interaction.ResourceStatus] outbound_participant_status The Outbound
94
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
95
+ # `failed`.
96
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
97
+ # guarantees to never return more than limit. Default is no limit
98
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
99
+ # the default value of 50 records. If no page_size is defined
100
+ # but a limit is defined, stream() will attempt to read the
101
+ # limit with the most efficient page size, i.e. min(limit, 1000)
102
+ def each
103
+ limits = @version.read_limits
104
+
105
+ page = self.page(
106
+ page_size: limits[:page_size],
107
+ )
108
+
109
+ @version.stream(page,
110
+ limit: limits[:limit],
111
+ page_limit: limits[:page_limit]).each {|x| yield x}
112
+ end
113
+
114
+ ##
115
+ # Retrieve a single page of InteractionInstance records from the API.
116
+ # Request is executed immediately.
117
+ # @param [interaction.ResourceStatus] inbound_participant_status The Inbound
118
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
119
+ # `failed`.
120
+ # @param [interaction.ResourceStatus] outbound_participant_status The Outbound
121
+ # Participant Status of this Interaction. One of `completed`, `in-progress` or
122
+ # `failed`.
123
+ # @param [String] page_token PageToken provided by the API
124
+ # @param [Integer] page_number Page Number, this value is simply for client state
125
+ # @param [Integer] page_size Number of records to return, defaults to 50
126
+ # @return [Page] Page of InteractionInstance
127
+ def page(inbound_participant_status: nil, outbound_participant_status: nil, page_token: nil, page_number: nil, page_size: nil)
128
+ params = {
129
+ 'InboundParticipantStatus' => inbound_participant_status,
130
+ 'OutboundParticipantStatus' => outbound_participant_status,
131
+ 'PageToken' => page_token,
132
+ 'Page' => page_number,
133
+ 'PageSize' => page_size,
134
+ }
135
+ response = @version.page(
136
+ 'GET',
137
+ @uri,
138
+ params
139
+ )
140
+ return InteractionPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Provide a user friendly representation
145
+ def to_s
146
+ '#<Twilio.Preview.Proxy.InteractionList>'
147
+ end
148
+ end
149
+
150
+ class InteractionPage < Page
151
+ ##
152
+ # Initialize the InteractionPage
153
+ # @param [Version] version Version that contains the resource
154
+ # @param [Response] response Response from the API
155
+ # @param [Hash] solution Path solution for the resource
156
+ # @param [String] service_sid The unique SID identifier of the Service.
157
+ # @param [String] session_sid The unique SID identifier of the Session.
158
+ # @return [InteractionPage] InteractionPage
159
+ def initialize(version, response, solution)
160
+ super(version, response)
161
+
162
+ # Path Solution
163
+ @solution = solution
164
+ end
165
+
166
+ ##
167
+ # Build an instance of InteractionInstance
168
+ # @param [Hash] payload Payload response from the API
169
+ # @return [InteractionInstance] InteractionInstance
170
+ def get_instance(payload)
171
+ return InteractionInstance.new(
172
+ @version,
173
+ payload,
174
+ service_sid: @solution[:service_sid],
175
+ session_sid: @solution[:session_sid],
176
+ )
177
+ end
178
+
179
+ ##
180
+ # Provide a user friendly representation
181
+ def to_s
182
+ '<Twilio.Preview.Proxy.InteractionPage>'
183
+ end
184
+ end
185
+
186
+ class InteractionContext < InstanceContext
187
+ ##
188
+ # Initialize the InteractionContext
189
+ # @param [Version] version Version that contains the resource
190
+ # @param [String] service_sid The unique SID identifier of the Service.
191
+ # @param [String] session_sid The unique SID identifier of the Session.
192
+ # @param [String] sid A 34 character string that uniquely identifies this
193
+ # Interaction.
194
+ # @return [InteractionContext] InteractionContext
195
+ def initialize(version, service_sid, session_sid, sid)
196
+ super(version)
197
+
198
+ # Path Solution
199
+ @solution = {
200
+ service_sid: service_sid,
201
+ session_sid: session_sid,
202
+ sid: sid,
203
+ }
204
+ @uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Interactions/#{@solution[:sid]}"
205
+ end
206
+
207
+ ##
208
+ # Fetch a InteractionInstance
209
+ # @return [InteractionInstance] Fetched InteractionInstance
210
+ def fetch
211
+ params = {}
212
+
213
+ payload = @version.fetch(
214
+ 'GET',
215
+ @uri,
216
+ params,
217
+ )
218
+
219
+ return InteractionInstance.new(
220
+ @version,
221
+ payload,
222
+ service_sid: @solution[:service_sid],
223
+ session_sid: @solution[:session_sid],
224
+ sid: @solution[:sid],
225
+ )
226
+ end
227
+
228
+ ##
229
+ # Provide a user friendly representation
230
+ def to_s
231
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
232
+ "#<Twilio.Preview.Proxy.InteractionContext #{context}>"
233
+ end
234
+ end
235
+
236
+ class InteractionInstance < InstanceResource
237
+ ##
238
+ # Initialize the InteractionInstance
239
+ # @param [Version] version Version that contains the resource
240
+ # @param [Hash] payload payload that contains response from Twilio
241
+ # @param [String] service_sid The unique SID identifier of the Service.
242
+ # @param [String] session_sid The unique SID identifier of the Session.
243
+ # @param [String] sid A 34 character string that uniquely identifies this
244
+ # Interaction.
245
+ # @return [InteractionInstance] InteractionInstance
246
+ def initialize(version, payload, service_sid: nil, session_sid: nil, sid: nil)
247
+ super(version)
248
+
249
+ # Marshaled Properties
250
+ @properties = {
251
+ 'sid' => payload['sid'],
252
+ 'session_sid' => payload['session_sid'],
253
+ 'service_sid' => payload['service_sid'],
254
+ 'account_sid' => payload['account_sid'],
255
+ 'data' => payload['data'],
256
+ 'status' => payload['status'],
257
+ 'inbound_participant_sid' => payload['inbound_participant_sid'],
258
+ 'inbound_resource_sid' => payload['inbound_resource_sid'],
259
+ 'inbound_resource_status' => payload['inbound_resource_status'],
260
+ 'inbound_resource_type' => payload['inbound_resource_type'],
261
+ 'inbound_resource_url' => payload['inbound_resource_url'],
262
+ 'outbound_participant_sid' => payload['outbound_participant_sid'],
263
+ 'outbound_resource_sid' => payload['outbound_resource_sid'],
264
+ 'outbound_resource_status' => payload['outbound_resource_status'],
265
+ 'outbound_resource_type' => payload['outbound_resource_type'],
266
+ 'outbound_resource_url' => payload['outbound_resource_url'],
267
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
268
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
269
+ 'url' => payload['url'],
270
+ }
271
+
272
+ # Context
273
+ @instance_context = nil
274
+ @params = {
275
+ 'service_sid' => service_sid,
276
+ 'session_sid' => session_sid,
277
+ 'sid' => sid || @properties['sid'],
278
+ }
279
+ end
280
+
281
+ ##
282
+ # Generate an instance context for the instance, the context is capable of
283
+ # performing various actions. All instance actions are proxied to the context
284
+ # @param [Version] version Version that contains the resource
285
+ # @return [InteractionContext] InteractionContext for this InteractionInstance
286
+ def context
287
+ unless @instance_context
288
+ @instance_context = InteractionContext.new(
289
+ @version,
290
+ @params['service_sid'],
291
+ @params['session_sid'],
292
+ @params['sid'],
293
+ )
294
+ end
295
+ @instance_context
296
+ end
297
+
298
+ def sid
299
+ @properties['sid']
300
+ end
301
+
302
+ def session_sid
303
+ @properties['session_sid']
304
+ end
305
+
306
+ def service_sid
307
+ @properties['service_sid']
308
+ end
309
+
310
+ def account_sid
311
+ @properties['account_sid']
312
+ end
313
+
314
+ def data
315
+ @properties['data']
316
+ end
317
+
318
+ def status
319
+ @properties['status']
320
+ end
321
+
322
+ def inbound_participant_sid
323
+ @properties['inbound_participant_sid']
324
+ end
325
+
326
+ def inbound_resource_sid
327
+ @properties['inbound_resource_sid']
328
+ end
329
+
330
+ def inbound_resource_status
331
+ @properties['inbound_resource_status']
332
+ end
333
+
334
+ def inbound_resource_type
335
+ @properties['inbound_resource_type']
336
+ end
337
+
338
+ def inbound_resource_url
339
+ @properties['inbound_resource_url']
340
+ end
341
+
342
+ def outbound_participant_sid
343
+ @properties['outbound_participant_sid']
344
+ end
345
+
346
+ def outbound_resource_sid
347
+ @properties['outbound_resource_sid']
348
+ end
349
+
350
+ def outbound_resource_status
351
+ @properties['outbound_resource_status']
352
+ end
353
+
354
+ def outbound_resource_type
355
+ @properties['outbound_resource_type']
356
+ end
357
+
358
+ def outbound_resource_url
359
+ @properties['outbound_resource_url']
360
+ end
361
+
362
+ def date_created
363
+ @properties['date_created']
364
+ end
365
+
366
+ def date_updated
367
+ @properties['date_updated']
368
+ end
369
+
370
+ def url
371
+ @properties['url']
372
+ end
373
+
374
+ ##
375
+ # Fetch a InteractionInstance
376
+ # @return [InteractionInstance] Fetched InteractionInstance
377
+ def fetch
378
+ context.fetch
379
+ end
380
+
381
+ ##
382
+ # Provide a user friendly representation
383
+ def to_s
384
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
385
+ "<Twilio.Preview.Proxy.InteractionInstance #{values}>"
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end