twilio-ruby 7.10.6 → 7.10.7
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.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/conversations/v2/action.rb +507 -0
- data/lib/twilio-ruby/rest/conversations/v2.rb +16 -0
- data/lib/twilio-ruby/rest/memory/v1/profile.rb +85 -0
- data/lib/twilio-ruby/rest/memory/v1/store.rb +45 -0
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94c0dcbac0d30aded66290e1af4f4916f3b476448fa529bc90b1921d514a3993
|
|
4
|
+
data.tar.gz: 44119ab61253eb5a927420db836726d0b294431acdc4d6b56ec94f6a0eaaa545
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d620607d6d1289f1f69fe5ea66bc830d9dab6dcdc1039751650fbc05f47f71fd740f731d67d5a66fe20b3c9f9e483931b747d68bbb805ba07cf2dec401f88c5
|
|
7
|
+
data.tar.gz: 2f306acace082920c9c00ed1093f7a76caccaa5620d0adcc30e4290e733301c9a0423b8315d916cb21185b67ec208e8009d6dd494214e2cba1d8a220483e18ef
|
data/CHANGES.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
twilio-ruby changelog
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
|
+
[2026-05-07] Version 7.10.7
|
|
5
|
+
---------------------------
|
|
6
|
+
**Conversations**
|
|
7
|
+
- update actions api visibility
|
|
8
|
+
|
|
9
|
+
**Memory**
|
|
10
|
+
- ## 2026-05-07
|
|
11
|
+
- **Content updates**:
|
|
12
|
+
- include store api
|
|
13
|
+
|
|
14
|
+
|
|
4
15
|
[2026-05-06] Version 7.10.6
|
|
5
16
|
---------------------------
|
|
6
17
|
**Library - Chore**
|
data/README.md
CHANGED
|
@@ -39,13 +39,13 @@ This library supports the following Ruby implementations:
|
|
|
39
39
|
To install using [Bundler][bundler] grab the latest stable version:
|
|
40
40
|
|
|
41
41
|
```ruby
|
|
42
|
-
gem 'twilio-ruby', '~> 7.10.
|
|
42
|
+
gem 'twilio-ruby', '~> 7.10.7'
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
gem install twilio-ruby -v 7.10.
|
|
48
|
+
gem install twilio-ruby -v 7.10.7
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
To build and install the development branch yourself from the latest source:
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Conversation Orchestrator
|
|
8
|
+
# Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Conversations < ConversationsBase
|
|
19
|
+
class V2 < Version
|
|
20
|
+
class ActionList < ListResource
|
|
21
|
+
|
|
22
|
+
class ConversationsV2SendMessageContent
|
|
23
|
+
# @param [text]: [String] Plain text message body.
|
|
24
|
+
# @param [content_id]: [String] Content template ID (HX... format). When provided, the template is rendered with the variables map and sent to the recipient.
|
|
25
|
+
# @param [variables]: [Hash<String, String>] Variables to substitute into the content template.
|
|
26
|
+
# @param [media_urls]: [Array<String>] URLs of media attachments to include with the message.
|
|
27
|
+
attr_accessor :text, :content_id, :variables, :media_urls
|
|
28
|
+
def initialize(payload)
|
|
29
|
+
@text = payload["text"]
|
|
30
|
+
@content_id = payload["content_id"]
|
|
31
|
+
@variables = payload["variables"]
|
|
32
|
+
@media_urls = payload["media_urls"]
|
|
33
|
+
end
|
|
34
|
+
def to_json(options = {})
|
|
35
|
+
{
|
|
36
|
+
"text": @text,
|
|
37
|
+
"contentId": @content_id,
|
|
38
|
+
"variables": @variables,
|
|
39
|
+
"mediaUrls": @media_urls,
|
|
40
|
+
}.to_json(options)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class ConversationsV2SendMessageParticipant
|
|
45
|
+
# @param [participant_id]: [String] Participant ID to resolve address from.
|
|
46
|
+
# @param [address]: [String] Explicit address formatted according to channel type.
|
|
47
|
+
# @param [channel]: [String] Channel type for address resolution.
|
|
48
|
+
attr_accessor :participant_id, :address, :channel
|
|
49
|
+
def initialize(payload)
|
|
50
|
+
@participant_id = payload["participant_id"]
|
|
51
|
+
@address = payload["address"]
|
|
52
|
+
@channel = payload["channel"]
|
|
53
|
+
end
|
|
54
|
+
def to_json(options = {})
|
|
55
|
+
{
|
|
56
|
+
"participantId": @participant_id,
|
|
57
|
+
"address": @address,
|
|
58
|
+
"channel": @channel,
|
|
59
|
+
}.to_json(options)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class ConversationsV2SendMessagePayload
|
|
64
|
+
# @param [from]: [ActionList.ConversationsV2SendMessageParticipant]
|
|
65
|
+
# @param [to]: [Array<ActionList.ConversationsV2SendMessageParticipant>] The recipients of this action.
|
|
66
|
+
# @param [content]: [ActionList.ConversationsV2SendMessageContent]
|
|
67
|
+
# @param [channel_settings]: [Hash<String, Object>] Channel-specific parameters forwarded as-is to the downstream sending service. Allows passing backend-specific fields without requiring API changes.
|
|
68
|
+
attr_accessor :from, :to, :content, :channel_settings
|
|
69
|
+
def initialize(payload)
|
|
70
|
+
@from = payload["from"]
|
|
71
|
+
@to = payload["to"]
|
|
72
|
+
@content = payload["content"]
|
|
73
|
+
@channel_settings = payload["channel_settings"]
|
|
74
|
+
end
|
|
75
|
+
def to_json(options = {})
|
|
76
|
+
{
|
|
77
|
+
"from": @from,
|
|
78
|
+
"to": @to,
|
|
79
|
+
"content": @content,
|
|
80
|
+
"channelSettings": @channel_settings,
|
|
81
|
+
}.to_json(options)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class CreateConversationActionRequest
|
|
86
|
+
# @param [type]: [String] Action type discriminator. Accepted values: SEND_MESSAGE.
|
|
87
|
+
# @param [payload]: [ActionList.ConversationsV2SendMessagePayload]
|
|
88
|
+
attr_accessor :type, :payload
|
|
89
|
+
def initialize(payload)
|
|
90
|
+
@type = payload["type"]
|
|
91
|
+
@payload = payload["payload"]
|
|
92
|
+
end
|
|
93
|
+
def to_json(options = {})
|
|
94
|
+
{
|
|
95
|
+
"type": @type,
|
|
96
|
+
"payload": @payload,
|
|
97
|
+
}.to_json(options)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
##
|
|
103
|
+
# Initialize the ActionList
|
|
104
|
+
# @param [Version] version Version that contains the resource
|
|
105
|
+
# @return [ActionList] ActionList
|
|
106
|
+
def initialize(version, conversation_id: nil)
|
|
107
|
+
|
|
108
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
109
|
+
super(apiV1Version)
|
|
110
|
+
# Path Solution
|
|
111
|
+
@solution = { conversation_id: conversation_id }
|
|
112
|
+
@uri = "/Conversations/#{@solution[:conversation_id]}/Actions"
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
##
|
|
116
|
+
# Create the ActionInstance
|
|
117
|
+
# @param [CreateConversationActionRequest] create_conversation_action_request The action to perform.
|
|
118
|
+
# @return [ActionInstance] Created ActionInstance
|
|
119
|
+
def create(create_conversation_action_request: nil
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
123
|
+
headers['Content-Type'] = 'application/json'
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
payload = @version.create('POST', @uri, headers: headers, data: create_conversation_action_request.to_json)
|
|
129
|
+
ActionInstance.new(
|
|
130
|
+
@version,
|
|
131
|
+
payload,
|
|
132
|
+
conversation_id: @solution[:conversation_id],
|
|
133
|
+
)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
##
|
|
137
|
+
# Create the ActionInstanceMetadata
|
|
138
|
+
# @param [CreateConversationActionRequest] create_conversation_action_request The action to perform.
|
|
139
|
+
# @return [ActionInstance] Created ActionInstance
|
|
140
|
+
def create_with_metadata(create_conversation_action_request: nil
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
144
|
+
headers['Content-Type'] = 'application/json'
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: create_conversation_action_request.to_json)
|
|
150
|
+
action_instance = ActionInstance.new(
|
|
151
|
+
@version,
|
|
152
|
+
response.body,
|
|
153
|
+
conversation_id: @solution[:conversation_id],
|
|
154
|
+
)
|
|
155
|
+
ActionInstanceMetadata.new(
|
|
156
|
+
@version,
|
|
157
|
+
action_instance,
|
|
158
|
+
response.headers,
|
|
159
|
+
response.status_code
|
|
160
|
+
)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# Provide a user friendly representation
|
|
167
|
+
def to_s
|
|
168
|
+
'#<Twilio.Conversations.V2.ActionList>'
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class ActionContext < InstanceContext
|
|
174
|
+
##
|
|
175
|
+
# Initialize the ActionContext
|
|
176
|
+
# @param [Version] version Version that contains the resource
|
|
177
|
+
# @param [String] conversation_id
|
|
178
|
+
# @param [String] action_id
|
|
179
|
+
# @return [ActionContext] ActionContext
|
|
180
|
+
def initialize(version, conversation_id, action_id)
|
|
181
|
+
|
|
182
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
183
|
+
super(apiV1Version)
|
|
184
|
+
|
|
185
|
+
# Path Solution
|
|
186
|
+
@solution = { conversation_id: conversation_id, action_id: action_id, }
|
|
187
|
+
@uri = "/Conversations/#{@solution[:conversation_id]}/Actions/#{@solution[:action_id]}"
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
end
|
|
191
|
+
##
|
|
192
|
+
# Fetch the ActionInstance
|
|
193
|
+
# @return [ActionInstance] Fetched ActionInstance
|
|
194
|
+
def fetch
|
|
195
|
+
|
|
196
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
203
|
+
ActionInstance.new(
|
|
204
|
+
@version,
|
|
205
|
+
payload,
|
|
206
|
+
conversation_id: @solution[:conversation_id],
|
|
207
|
+
action_id: @solution[:action_id],
|
|
208
|
+
)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
##
|
|
212
|
+
# Fetch the ActionInstanceMetadata
|
|
213
|
+
# @return [ActionInstance] Fetched ActionInstance
|
|
214
|
+
def fetch_with_metadata
|
|
215
|
+
|
|
216
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
223
|
+
action_instance = ActionInstance.new(
|
|
224
|
+
@version,
|
|
225
|
+
response.body,
|
|
226
|
+
conversation_id: @solution[:conversation_id],
|
|
227
|
+
action_id: @solution[:action_id],
|
|
228
|
+
)
|
|
229
|
+
ActionInstanceMetadata.new(
|
|
230
|
+
@version,
|
|
231
|
+
action_instance,
|
|
232
|
+
response.headers,
|
|
233
|
+
response.status_code
|
|
234
|
+
)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
##
|
|
239
|
+
# Provide a user friendly representation
|
|
240
|
+
def to_s
|
|
241
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
242
|
+
"#<Twilio.Conversations.V2.ActionContext #{context}>"
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
##
|
|
246
|
+
# Provide a detailed, user friendly representation
|
|
247
|
+
def inspect
|
|
248
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
249
|
+
"#<Twilio.Conversations.V2.ActionContext #{context}>"
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
class ActionInstanceMetadata < InstanceResourceMetadata
|
|
254
|
+
##
|
|
255
|
+
# Initializes a new ActionInstanceMetadata.
|
|
256
|
+
# @param [Version] version Version that contains the resource
|
|
257
|
+
# @param [}ActionInstance] action_instance The instance associated with the metadata.
|
|
258
|
+
# @param [Hash] headers Header object with response headers.
|
|
259
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
260
|
+
# @return [ActionInstanceMetadata] The initialized instance with metadata.
|
|
261
|
+
def initialize(version, action_instance, headers, status_code)
|
|
262
|
+
super(version, headers, status_code)
|
|
263
|
+
@action_instance = action_instance
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def action
|
|
267
|
+
@action_instance
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def headers
|
|
271
|
+
@headers
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def status_code
|
|
275
|
+
@status_code
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def to_s
|
|
279
|
+
"<Twilio.Api.V2010.ActionInstanceMetadata status=#{@status_code}>"
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
class ActionListResponse < InstanceListResource
|
|
284
|
+
# @param [Array<ActionInstance>] instance
|
|
285
|
+
# @param [Hash{String => Object}] headers
|
|
286
|
+
# @param [Integer] status_code
|
|
287
|
+
def initialize(version, payload, key)
|
|
288
|
+
@action_instance = payload.body[key].map do |data|
|
|
289
|
+
ActionInstance.new(version, data)
|
|
290
|
+
end
|
|
291
|
+
@headers = payload.headers
|
|
292
|
+
@status_code = payload.status_code
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def action_instance
|
|
296
|
+
@instance
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
class ActionPage < TokenPage
|
|
301
|
+
##
|
|
302
|
+
# Initialize the ActionPage
|
|
303
|
+
# @param [Version] version Version that contains the resource
|
|
304
|
+
# @param [Response] response Response from the API
|
|
305
|
+
# @param [Hash] solution Path solution for the resource
|
|
306
|
+
# @return [ActionPage] ActionPage
|
|
307
|
+
def initialize(version, response, solution)
|
|
308
|
+
|
|
309
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
310
|
+
super(apiV1Version, response)
|
|
311
|
+
|
|
312
|
+
# Path Solution
|
|
313
|
+
@solution = solution
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
##
|
|
317
|
+
# Build an instance of ActionInstance
|
|
318
|
+
# @param [Hash] payload Payload response from the API
|
|
319
|
+
# @return [ActionInstance] ActionInstance
|
|
320
|
+
def get_instance(payload)
|
|
321
|
+
ActionInstance.new(@version, payload, conversation_id: @solution[:conversation_id])
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
##
|
|
325
|
+
# Provide a user friendly representation
|
|
326
|
+
def to_s
|
|
327
|
+
'<Twilio.Conversations.V2.ActionPage>'
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
class ActionPageMetadata < PageMetadata
|
|
332
|
+
attr_reader :action_page
|
|
333
|
+
|
|
334
|
+
def initialize(version, response, solution, limit)
|
|
335
|
+
super(version, response)
|
|
336
|
+
@action_page = []
|
|
337
|
+
@limit = limit
|
|
338
|
+
key = get_key(response.body)
|
|
339
|
+
records = 0
|
|
340
|
+
while( limit != :unset && records < limit )
|
|
341
|
+
@action_page << ActionListResponse.new(version, @payload, key, limit - records)
|
|
342
|
+
@payload = self.next_page
|
|
343
|
+
break unless @payload
|
|
344
|
+
records += (@payload.body[key] || []).size
|
|
345
|
+
end
|
|
346
|
+
# Path Solution
|
|
347
|
+
@solution = solution
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def each
|
|
351
|
+
@action_page.each do |record|
|
|
352
|
+
yield record
|
|
353
|
+
end
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def to_s
|
|
357
|
+
'<Twilio::REST::Conversations::V2PageMetadata>';
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
class ActionListResponse < InstanceListResource
|
|
361
|
+
|
|
362
|
+
# @param [Array<ActionInstance>] instance
|
|
363
|
+
# @param [Hash{String => Object}] headers
|
|
364
|
+
# @param [Integer] status_code
|
|
365
|
+
def initialize(version, payload, key, limit = :unset)
|
|
366
|
+
data_list = payload.body[key] || []
|
|
367
|
+
if limit != :unset
|
|
368
|
+
data_list = data_list[0, limit]
|
|
369
|
+
end
|
|
370
|
+
@action = data_list.map do |data|
|
|
371
|
+
ActionInstance.new(version, data)
|
|
372
|
+
end
|
|
373
|
+
@headers = payload.headers
|
|
374
|
+
@status_code = payload.status_code
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def action
|
|
378
|
+
@action
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def headers
|
|
382
|
+
@headers
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
def status_code
|
|
386
|
+
@status_code
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
class ActionInstance < InstanceResource
|
|
391
|
+
##
|
|
392
|
+
# Initialize the ActionInstance
|
|
393
|
+
# @param [Version] version Version that contains the resource
|
|
394
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
395
|
+
# @param [String] account_sid The SID of the
|
|
396
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Action
|
|
397
|
+
# resource.
|
|
398
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
399
|
+
# @return [ActionInstance] ActionInstance
|
|
400
|
+
def initialize(version, payload , conversation_id: nil, action_id: nil)
|
|
401
|
+
|
|
402
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
403
|
+
super(apiV1Version)
|
|
404
|
+
|
|
405
|
+
# Marshaled Properties
|
|
406
|
+
@properties = {
|
|
407
|
+
'id' => payload['id'],
|
|
408
|
+
'type' => payload['type'],
|
|
409
|
+
'status' => payload['status'],
|
|
410
|
+
'conversation_id' => payload['conversation_id'],
|
|
411
|
+
'related' => payload['related'],
|
|
412
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
|
413
|
+
'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
|
|
414
|
+
'completed_at' => Twilio.deserialize_iso8601_datetime(payload['completed_at']),
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
# Context
|
|
418
|
+
@instance_context = nil
|
|
419
|
+
@params = { 'conversation_id' => conversation_id || @properties['conversation_id'] ,'action_id' => action_id || @properties['action_id'] , }
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
##
|
|
423
|
+
# Generate an instance context for the instance, the context is capable of
|
|
424
|
+
# performing various actions. All instance actions are proxied to the context
|
|
425
|
+
# @return [ActionContext] CallContext for this CallInstance
|
|
426
|
+
def context
|
|
427
|
+
unless @instance_context
|
|
428
|
+
@instance_context = ActionContext.new(@version , @params['conversation_id'], @params['action_id'])
|
|
429
|
+
end
|
|
430
|
+
@instance_context
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
##
|
|
434
|
+
# @return [String] Unique identifier for this Action.
|
|
435
|
+
def id
|
|
436
|
+
@properties['id']
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
##
|
|
440
|
+
# @return [String] The type of action. Accepted values: SEND_MESSAGE.
|
|
441
|
+
def type
|
|
442
|
+
@properties['type']
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
##
|
|
446
|
+
# @return [String] Current status of the Action. - PENDING: Action accepted, awaiting downstream confirmation - COMPLETED: Downstream backend confirmed the action - FAILED: Downstream backend reported a failure
|
|
447
|
+
def status
|
|
448
|
+
@properties['status']
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
##
|
|
452
|
+
# @return [String] The conversation this action belongs to.
|
|
453
|
+
def conversation_id
|
|
454
|
+
@properties['conversation_id']
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
##
|
|
458
|
+
# @return [Hash<String, String>] Named identifiers from downstream. For SEND_MESSAGE: - messageSid: The downstream message SID (present when PENDING or COMPLETED) - communicationId: The Communication ID (present when COMPLETED)
|
|
459
|
+
def related
|
|
460
|
+
@properties['related']
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
##
|
|
464
|
+
# @return [Time] Timestamp when the action was created.
|
|
465
|
+
def created_at
|
|
466
|
+
@properties['created_at']
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
##
|
|
470
|
+
# @return [Time] Timestamp when the action was last updated.
|
|
471
|
+
def updated_at
|
|
472
|
+
@properties['updated_at']
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
##
|
|
476
|
+
# @return [Time] Timestamp when the action reached a terminal status.
|
|
477
|
+
def completed_at
|
|
478
|
+
@properties['completed_at']
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
##
|
|
482
|
+
# Fetch the ActionInstance
|
|
483
|
+
# @return [ActionInstance] Fetched ActionInstance
|
|
484
|
+
def fetch
|
|
485
|
+
|
|
486
|
+
context.fetch
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
##
|
|
490
|
+
# Provide a user friendly representation
|
|
491
|
+
def to_s
|
|
492
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
493
|
+
"<Twilio.Conversations.V2.ActionInstance #{values}>"
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
##
|
|
497
|
+
# Provide a detailed, user friendly representation
|
|
498
|
+
def inspect
|
|
499
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
500
|
+
"<Twilio.Conversations.V2.ActionInstance #{values}>"
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
end
|
|
@@ -21,6 +21,7 @@ module Twilio
|
|
|
21
21
|
def initialize(domain)
|
|
22
22
|
super
|
|
23
23
|
@version = 'v2'
|
|
24
|
+
@actions = nil
|
|
24
25
|
@communications = nil
|
|
25
26
|
@configurations = nil
|
|
26
27
|
@conversations = nil
|
|
@@ -28,6 +29,21 @@ module Twilio
|
|
|
28
29
|
@participants = nil
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
##
|
|
33
|
+
# @param [String] conversation_id
|
|
34
|
+
# @return [Twilio::REST::Conversations::V2::ActionContext] if conversationId was passed.
|
|
35
|
+
# @return [Twilio::REST::Conversations::V2::ActionList]
|
|
36
|
+
def actions(conversation_id=:unset)
|
|
37
|
+
if conversation_id.nil?
|
|
38
|
+
raise ArgumentError, 'conversation_id cannot be nil'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if conversation_id == :unset
|
|
42
|
+
@actions ||= ActionList.new self
|
|
43
|
+
else
|
|
44
|
+
ActionContext.new(self, conversation_id)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
31
47
|
##
|
|
32
48
|
# @param [String] conversation_sid
|
|
33
49
|
# @param [String] sid
|
|
@@ -329,6 +329,64 @@ module Twilio
|
|
|
329
329
|
ProfileInstanceMetadata.new(@version, profile_instance, response.headers, response.status_code)
|
|
330
330
|
end
|
|
331
331
|
|
|
332
|
+
##
|
|
333
|
+
# Fetch the ProfileInstance
|
|
334
|
+
# @param [String] trait_groups Comma separated list of trait group names to include.
|
|
335
|
+
# @return [ProfileInstance] Fetched ProfileInstance
|
|
336
|
+
def fetch(
|
|
337
|
+
trait_groups: :unset
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
params = Twilio::Values.of({
|
|
341
|
+
'traitGroups' => trait_groups,
|
|
342
|
+
})
|
|
343
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
payload = @version.fetch('GET', @uri, params: params, headers: headers)
|
|
350
|
+
ProfileInstance.new(
|
|
351
|
+
@version,
|
|
352
|
+
payload,
|
|
353
|
+
store_id: @solution[:store_id],
|
|
354
|
+
profile_id: @solution[:profile_id],
|
|
355
|
+
)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
##
|
|
359
|
+
# Fetch the ProfileInstanceMetadata
|
|
360
|
+
# @param [String] trait_groups Comma separated list of trait group names to include.
|
|
361
|
+
# @return [ProfileInstance] Fetched ProfileInstance
|
|
362
|
+
def fetch_with_metadata(
|
|
363
|
+
trait_groups: :unset
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
params = Twilio::Values.of({
|
|
367
|
+
'traitGroups' => trait_groups,
|
|
368
|
+
})
|
|
369
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
response = @version.fetch_with_metadata('GET', @uri, params: params, headers: headers)
|
|
376
|
+
profile_instance = ProfileInstance.new(
|
|
377
|
+
@version,
|
|
378
|
+
response.body,
|
|
379
|
+
store_id: @solution[:store_id],
|
|
380
|
+
profile_id: @solution[:profile_id],
|
|
381
|
+
)
|
|
382
|
+
ProfileInstanceMetadata.new(
|
|
383
|
+
@version,
|
|
384
|
+
profile_instance,
|
|
385
|
+
response.headers,
|
|
386
|
+
response.status_code
|
|
387
|
+
)
|
|
388
|
+
end
|
|
389
|
+
|
|
332
390
|
##
|
|
333
391
|
# Patch the ProfileInstance
|
|
334
392
|
# @param [ProfilePatch] profile_patch
|
|
@@ -551,6 +609,8 @@ module Twilio
|
|
|
551
609
|
@properties = {
|
|
552
610
|
'id' => payload['id'],
|
|
553
611
|
'message' => payload['message'],
|
|
612
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
|
613
|
+
'traits' => payload['traits'],
|
|
554
614
|
'profiles' => payload['profiles'],
|
|
555
615
|
'meta' => payload['meta'],
|
|
556
616
|
}
|
|
@@ -583,6 +643,18 @@ module Twilio
|
|
|
583
643
|
@properties['message']
|
|
584
644
|
end
|
|
585
645
|
|
|
646
|
+
##
|
|
647
|
+
# @return [Time] The time the profile was created.
|
|
648
|
+
def created_at
|
|
649
|
+
@properties['created_at']
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
##
|
|
653
|
+
# @return [Hash<String, Hash<String, Object>>] Multiple trait groups.
|
|
654
|
+
def traits
|
|
655
|
+
@properties['traits']
|
|
656
|
+
end
|
|
657
|
+
|
|
586
658
|
##
|
|
587
659
|
# @return [Array<String>]
|
|
588
660
|
def profiles
|
|
@@ -603,6 +675,19 @@ module Twilio
|
|
|
603
675
|
context.delete
|
|
604
676
|
end
|
|
605
677
|
|
|
678
|
+
##
|
|
679
|
+
# Fetch the ProfileInstance
|
|
680
|
+
# @param [String] trait_groups Comma separated list of trait group names to include.
|
|
681
|
+
# @return [ProfileInstance] Fetched ProfileInstance
|
|
682
|
+
def fetch(
|
|
683
|
+
trait_groups: :unset
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
context.fetch(
|
|
687
|
+
trait_groups: trait_groups,
|
|
688
|
+
)
|
|
689
|
+
end
|
|
690
|
+
|
|
606
691
|
##
|
|
607
692
|
# Patch the ProfileInstance
|
|
608
693
|
# @param [ProfilePatch] profile_patch
|
|
@@ -300,6 +300,43 @@ module Twilio
|
|
|
300
300
|
|
|
301
301
|
|
|
302
302
|
end
|
|
303
|
+
##
|
|
304
|
+
# Delete the StoreInstance
|
|
305
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
306
|
+
def delete
|
|
307
|
+
|
|
308
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
313
|
+
StoreInstance.new(
|
|
314
|
+
@version,
|
|
315
|
+
response.body,
|
|
316
|
+
store_id: @solution[:store_id],
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
##
|
|
322
|
+
# Delete the StoreInstanceMetadata
|
|
323
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
324
|
+
def delete_with_metadata
|
|
325
|
+
|
|
326
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
331
|
+
store_instance = StoreInstance.new(
|
|
332
|
+
@version,
|
|
333
|
+
response.body,
|
|
334
|
+
account_sid: @solution[:account_sid],
|
|
335
|
+
sid: @solution[:sid],
|
|
336
|
+
)
|
|
337
|
+
StoreInstanceMetadata.new(@version, store_instance, response.headers, response.status_code)
|
|
338
|
+
end
|
|
339
|
+
|
|
303
340
|
##
|
|
304
341
|
# Fetch the StoreInstance
|
|
305
342
|
# @return [StoreInstance] Fetched StoreInstance
|
|
@@ -656,6 +693,14 @@ module Twilio
|
|
|
656
693
|
@properties['meta']
|
|
657
694
|
end
|
|
658
695
|
|
|
696
|
+
##
|
|
697
|
+
# Delete the StoreInstance
|
|
698
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
699
|
+
def delete
|
|
700
|
+
|
|
701
|
+
context.delete
|
|
702
|
+
end
|
|
703
|
+
|
|
659
704
|
##
|
|
660
705
|
# Fetch the StoreInstance
|
|
661
706
|
# @return [StoreInstance] Fetched StoreInstance
|
data/lib/twilio-ruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twilio-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.10.
|
|
4
|
+
version: 7.10.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Twilio API Team
|
|
@@ -445,6 +445,7 @@ files:
|
|
|
445
445
|
- lib/twilio-ruby/rest/conversations/v1/user.rb
|
|
446
446
|
- lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
|
|
447
447
|
- lib/twilio-ruby/rest/conversations/v2.rb
|
|
448
|
+
- lib/twilio-ruby/rest/conversations/v2/action.rb
|
|
448
449
|
- lib/twilio-ruby/rest/conversations/v2/communication.rb
|
|
449
450
|
- lib/twilio-ruby/rest/conversations/v2/configuration.rb
|
|
450
451
|
- lib/twilio-ruby/rest/conversations/v2/conversation.rb
|