twilio-ruby 7.5.1 → 7.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aad54e4127225802d5b5d4a1e3711e2237721b9b
4
- data.tar.gz: 33661730ed8d04136f1d82c41d06637efacba9f2
3
+ metadata.gz: 5c84f48a652b0a72ebf4e7b6654813a215f94ed7
4
+ data.tar.gz: '04808d5c430749e3a35f0b5098b250a0fab1d476'
5
5
  SHA512:
6
- metadata.gz: c4ab77c9062fc59a357c9ee328461b8d1d65a940cd90316abe2c1c31e519e2c8929f9185bcd167f4076783f1c355f073945acad8edc45aa6c624608a77ce6b92
7
- data.tar.gz: ac5416a1673ba49aafef4a58dc5f5dbb77a88dec86e620c97cf2a04fd9f10f9fc8fa6ba761d9ab22f70375d6fb5816b7aefbc05ccb8e943b74795fd39a0603f7
6
+ metadata.gz: 3e9e6004baa7bb7d91fbec42f3dfbe73d1bf094d5c7452cdc64e078a4510ee2909da7778209b37061b8331455ddd058604cdefb062394256ecd8d3ebb15bfa3c
7
+ data.tar.gz: 11bb382b74ad1a2327aacfe4f1a061e8bce8056f0bb6c0b8cc425fb3d8769ec6db7c1cf258289ae8186c8113bf76a224bb4d81b95221c6bf64c3cc5d78f72bd7
data/CHANGES.md CHANGED
@@ -1,6 +1,33 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2025-05-05] Version 7.6.0
5
+ --------------------------
6
+ **Library - Chore**
7
+ - [PR #742](https://github.com/twilio/twilio-ruby/pull/742): remove ostruct and benchmark from gemspec. Thanks to [@oehlschl](https://github.com/oehlschl)!
8
+
9
+ **Api**
10
+ - Add `response_key` for `Usage Triggers` fetch endpoint.
11
+
12
+ **Flex**
13
+ - Add Update Interaction API
14
+ - Adding `webhook_ttid` as optional parameter in Interactions API
15
+
16
+ **Serverless**
17
+ - Add node22 as a valid Build runtime
18
+ - Add node20 as a valid Build runtime
19
+
20
+ **Video**
21
+ - removed `transcribe_participants_on_connect` and `transcriptions_configuration` from the room resource **(breaking change)**
22
+ - Added `transcribe_participants_on_connect` and `transcriptions_configuration` to the room resource
23
+
24
+
25
+ [2025-04-07] Version 7.5.2
26
+ --------------------------
27
+ **Studio**
28
+ - Add documentation for parent_step_sid field in Step resource
29
+
30
+
4
31
  [2025-03-20] Version 7.5.1
5
32
  --------------------------
6
33
  **Accounts**
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.5.1'
42
+ gem 'twilio-ruby', '~> 7.6.0'
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.5.1
48
+ gem install twilio-ruby -v 7.6.0
49
49
  ```
50
50
 
51
51
  To build and install the development branch yourself from the latest source:
@@ -42,7 +42,7 @@ module Twilio
42
42
  # @param [String] status_callback The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
43
43
  # @param [Array[String]] status_callback_event The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.
44
44
  # @param [String] status_callback_method The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
45
- # @param [String] send_digits A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
45
+ # @param [String] send_digits The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (`0`-`9`), '`A`', '`B`', '`C`', '`D`', '`#`', and '`*`'. You can also use '`w`' to insert a half-second pause and '`W`' to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to `W1234#`. Be sure to URL-encode this string because the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
46
46
  # @param [String] timeout The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail.
47
47
  # @param [Boolean] record Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.
48
48
  # @param [String] recording_channels The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call.
@@ -47,7 +47,7 @@ module Twilio
47
47
  # @param [String] beep Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`.
48
48
  # @param [Boolean] start_conference_on_enter Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference.
49
49
  # @param [Boolean] end_conference_on_exit Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`.
50
- # @param [String] wait_url The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic).
50
+ # @param [String] wait_url The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [<Conference> TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl).
51
51
  # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
52
52
  # @param [Boolean] early_media Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`.
53
53
  # @param [String] max_participants The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`.
@@ -374,7 +374,7 @@ module Twilio
374
374
  # @param [String] hold_method The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`.
375
375
  # @param [String] announce_url The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs.
376
376
  # @param [String] announce_method The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`.
377
- # @param [String] wait_url The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic).
377
+ # @param [String] wait_url The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [<Conference> TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl).
378
378
  # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
379
379
  # @param [Boolean] beep_on_exit Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`.
380
380
  # @param [Boolean] end_conference_on_exit Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`.
@@ -633,7 +633,7 @@ module Twilio
633
633
  # @param [String] hold_method The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`.
634
634
  # @param [String] announce_url The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs.
635
635
  # @param [String] announce_method The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`.
636
- # @param [String] wait_url The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic).
636
+ # @param [String] wait_url The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [<Conference> TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl).
637
637
  # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
638
638
  # @param [Boolean] beep_on_exit Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`.
639
639
  # @param [Boolean] end_conference_on_exit Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`.
@@ -92,6 +92,11 @@ module Twilio
92
92
  @ip_messaging ||= IpMessaging.new self
93
93
  end
94
94
  ##
95
+ # Access the Knowledge Twilio Domain
96
+ def knowledge
97
+ @knowledge ||= Knowledge.new self
98
+ end
99
+ ##
95
100
  # Access the Lookups Twilio Domain
96
101
  def lookups
97
102
  @lookups ||= Lookups.new self
@@ -35,17 +35,20 @@ module Twilio
35
35
  # @param [Object] channel The Interaction's channel.
36
36
  # @param [Object] routing The Interaction's routing logic.
37
37
  # @param [String] interaction_context_sid The Interaction context sid is used for adding a context lookup sid
38
+ # @param [String] webhook_ttid The unique identifier for Interaction level webhook
38
39
  # @return [InteractionInstance] Created InteractionInstance
39
40
  def create(
40
41
  channel: nil,
41
42
  routing: :unset,
42
- interaction_context_sid: :unset
43
+ interaction_context_sid: :unset,
44
+ webhook_ttid: :unset
43
45
  )
44
46
 
45
47
  data = Twilio::Values.of({
46
48
  'Channel' => Twilio.serialize_object(channel),
47
49
  'Routing' => Twilio.serialize_object(routing),
48
50
  'InteractionContextSid' => interaction_context_sid,
51
+ 'WebhookTtid' => webhook_ttid,
49
52
  })
50
53
 
51
54
  headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
@@ -106,6 +109,32 @@ module Twilio
106
109
  )
107
110
  end
108
111
 
112
+ ##
113
+ # Update the InteractionInstance
114
+ # @param [String] webhook_ttid The unique identifier for Interaction level webhook
115
+ # @return [InteractionInstance] Updated InteractionInstance
116
+ def update(
117
+ webhook_ttid: :unset
118
+ )
119
+
120
+ data = Twilio::Values.of({
121
+ 'WebhookTtid' => webhook_ttid,
122
+ })
123
+
124
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
125
+
126
+
127
+
128
+
129
+
130
+ payload = @version.update('POST', @uri, data: data, headers: headers)
131
+ InteractionInstance.new(
132
+ @version,
133
+ payload,
134
+ sid: @solution[:sid],
135
+ )
136
+ end
137
+
109
138
  ##
110
139
  # Access the channels
111
140
  # @return [InteractionChannelList]
@@ -190,6 +219,7 @@ module Twilio
190
219
  'url' => payload['url'],
191
220
  'links' => payload['links'],
192
221
  'interaction_context_sid' => payload['interaction_context_sid'],
222
+ 'webhook_ttid' => payload['webhook_ttid'],
193
223
  }
194
224
 
195
225
  # Context
@@ -244,6 +274,12 @@ module Twilio
244
274
  @properties['interaction_context_sid']
245
275
  end
246
276
 
277
+ ##
278
+ # @return [String]
279
+ def webhook_ttid
280
+ @properties['webhook_ttid']
281
+ end
282
+
247
283
  ##
248
284
  # Fetch the InteractionInstance
249
285
  # @return [InteractionInstance] Fetched InteractionInstance
@@ -252,6 +288,19 @@ module Twilio
252
288
  context.fetch
253
289
  end
254
290
 
291
+ ##
292
+ # Update the InteractionInstance
293
+ # @param [String] webhook_ttid The unique identifier for Interaction level webhook
294
+ # @return [InteractionInstance] Updated InteractionInstance
295
+ def update(
296
+ webhook_ttid: :unset
297
+ )
298
+
299
+ context.update(
300
+ webhook_ttid: webhook_ttid,
301
+ )
302
+ end
303
+
255
304
  ##
256
305
  # Access the channels
257
306
  # @return [channels] channels
@@ -0,0 +1,232 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Knowledge
8
+ # This is the public Twilio REST API.
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 Knowledge < KnowledgeBase
19
+ class V1 < Version
20
+ class Knowledge < InstanceContext
21
+
22
+ class ChunkList < ListResource
23
+
24
+ ##
25
+ # Initialize the ChunkList
26
+ # @param [Version] version Version that contains the resource
27
+ # @return [ChunkList] ChunkList
28
+ def initialize(version, id: nil)
29
+ super(version)
30
+ # Path Solution
31
+ @solution = { id: id }
32
+ @uri = "/Knowledge/#{@solution[:id]}/Chunks"
33
+
34
+ end
35
+
36
+ ##
37
+ # Lists ChunkInstance records from the API as a list.
38
+ # Unlike stream(), this operation is eager and will load `limit` records into
39
+ # memory before returning.
40
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
41
+ # guarantees to never return more than limit. Default is no limit
42
+ # @param [Integer] page_size Number of records to fetch per request, when
43
+ # not set will use the default value of 50 records. If no page_size is defined
44
+ # but a limit is defined, stream() will attempt to read the limit with the most
45
+ # efficient page size, i.e. min(limit, 1000)
46
+ # @return [Array] Array of up to limit results
47
+ def list(limit: nil, page_size: nil)
48
+ self.stream(
49
+ limit: limit,
50
+ page_size: page_size
51
+ ).entries
52
+ end
53
+
54
+ ##
55
+ # Streams Instance records from the API as an Enumerable.
56
+ # This operation lazily loads records as efficiently as possible until the limit
57
+ # is reached.
58
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
59
+ # guarantees to never return more than limit. Default is no limit
60
+ # @param [Integer] page_size Number of records to fetch per request, when
61
+ # not set will use the default value of 50 records. If no page_size is defined
62
+ # but a limit is defined, stream() will attempt to read the limit with the most
63
+ # efficient page size, i.e. min(limit, 1000)
64
+ # @return [Enumerable] Enumerable that will yield up to limit results
65
+ def stream(limit: nil, page_size: nil)
66
+ limits = @version.read_limits(limit, page_size)
67
+
68
+ page = self.page(
69
+ page_size: limits[:page_size], )
70
+
71
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
72
+ end
73
+
74
+ ##
75
+ # When passed a block, yields ChunkInstance records from the API.
76
+ # This operation lazily loads records as efficiently as possible until the limit
77
+ # is reached.
78
+ def each
79
+ limits = @version.read_limits
80
+
81
+ page = self.page(page_size: limits[:page_size], )
82
+
83
+ @version.stream(page,
84
+ limit: limits[:limit],
85
+ page_limit: limits[:page_limit]).each {|x| yield x}
86
+ end
87
+
88
+ ##
89
+ # Retrieve a single page of ChunkInstance records from the API.
90
+ # Request is executed immediately.
91
+ # @param [String] page_token PageToken provided by the API
92
+ # @param [Integer] page_number Page Number, this value is simply for client state
93
+ # @param [Integer] page_size Number of records to return, defaults to 50
94
+ # @return [Page] Page of ChunkInstance
95
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
96
+ params = Twilio::Values.of({
97
+ 'PageToken' => page_token,
98
+ 'Page' => page_number,
99
+ 'PageSize' => page_size,
100
+ })
101
+ headers = Twilio::Values.of({})
102
+
103
+
104
+
105
+ response = @version.page('GET', @uri, params: params, headers: headers)
106
+
107
+ ChunkPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of ChunkInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [String] target_url API-generated URL for the requested results page
114
+ # @return [Page] Page of ChunkInstance
115
+ def get_page(target_url)
116
+ response = @version.domain.request(
117
+ 'GET',
118
+ target_url
119
+ )
120
+ ChunkPage.new(@version, response, @solution)
121
+ end
122
+
123
+
124
+
125
+ # Provide a user friendly representation
126
+ def to_s
127
+ '#<Twilio.Knowledge.V1.ChunkList>'
128
+ end
129
+ end
130
+
131
+ class ChunkPage < Page
132
+ ##
133
+ # Initialize the ChunkPage
134
+ # @param [Version] version Version that contains the resource
135
+ # @param [Response] response Response from the API
136
+ # @param [Hash] solution Path solution for the resource
137
+ # @return [ChunkPage] ChunkPage
138
+ def initialize(version, response, solution)
139
+ super(version, response)
140
+
141
+ # Path Solution
142
+ @solution = solution
143
+ end
144
+
145
+ ##
146
+ # Build an instance of ChunkInstance
147
+ # @param [Hash] payload Payload response from the API
148
+ # @return [ChunkInstance] ChunkInstance
149
+ def get_instance(payload)
150
+ ChunkInstance.new(@version, payload, id: @solution[:id])
151
+ end
152
+
153
+ ##
154
+ # Provide a user friendly representation
155
+ def to_s
156
+ '<Twilio.Knowledge.V1.ChunkPage>'
157
+ end
158
+ end
159
+ class ChunkInstance < InstanceResource
160
+ ##
161
+ # Initialize the ChunkInstance
162
+ # @param [Version] version Version that contains the resource
163
+ # @param [Hash] payload payload that contains response from Twilio
164
+ # @param [String] account_sid The SID of the
165
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Chunk
166
+ # resource.
167
+ # @param [String] sid The SID of the Call resource to fetch.
168
+ # @return [ChunkInstance] ChunkInstance
169
+ def initialize(version, payload , id: nil)
170
+ super(version)
171
+
172
+ # Marshaled Properties
173
+ @properties = {
174
+ 'account_sid' => payload['account_sid'],
175
+ 'content' => payload['content'],
176
+ 'metadata' => payload['metadata'],
177
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
178
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
179
+ }
180
+ end
181
+
182
+
183
+ ##
184
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
185
+ def account_sid
186
+ @properties['account_sid']
187
+ end
188
+
189
+ ##
190
+ # @return [String] The chunk content.
191
+ def content
192
+ @properties['content']
193
+ end
194
+
195
+ ##
196
+ # @return [Hash] The metadata of the chunk.
197
+ def metadata
198
+ @properties['metadata']
199
+ end
200
+
201
+ ##
202
+ # @return [Time] The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
203
+ def date_created
204
+ @properties['date_created']
205
+ end
206
+
207
+ ##
208
+ # @return [Time] The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
209
+ def date_updated
210
+ @properties['date_updated']
211
+ end
212
+
213
+ ##
214
+ # Provide a user friendly representation
215
+ def to_s
216
+ "<Twilio.Knowledge.V1.ChunkInstance>"
217
+ end
218
+
219
+ ##
220
+ # Provide a detailed, user friendly representation
221
+ def inspect
222
+ "<Twilio.Knowledge.V1.ChunkInstance>"
223
+ end
224
+ end
225
+
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
231
+
232
+
@@ -0,0 +1,213 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Knowledge
8
+ # This is the public Twilio REST API.
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 Knowledge < KnowledgeBase
19
+ class V1 < Version
20
+ class Knowledge < InstanceContext
21
+
22
+ class KnowledgeStatusList < ListResource
23
+
24
+ ##
25
+ # Initialize the KnowledgeStatusList
26
+ # @param [Version] version Version that contains the resource
27
+ # @return [KnowledgeStatusList] KnowledgeStatusList
28
+ def initialize(version, id: nil)
29
+ super(version)
30
+ # Path Solution
31
+ @solution = { id: id }
32
+
33
+
34
+ end
35
+
36
+
37
+
38
+ # Provide a user friendly representation
39
+ def to_s
40
+ '#<Twilio.Knowledge.V1.KnowledgeStatusList>'
41
+ end
42
+ end
43
+
44
+
45
+ class KnowledgeStatusContext < InstanceContext
46
+ ##
47
+ # Initialize the KnowledgeStatusContext
48
+ # @param [Version] version Version that contains the resource
49
+ # @param [String] id the Knowledge ID.
50
+ # @return [KnowledgeStatusContext] KnowledgeStatusContext
51
+ def initialize(version, id)
52
+ super(version)
53
+
54
+ # Path Solution
55
+ @solution = { id: id, }
56
+ @uri = "/Knowledge/#{@solution[:id]}/Status"
57
+
58
+
59
+ end
60
+ ##
61
+ # Fetch the KnowledgeStatusInstance
62
+ # @return [KnowledgeStatusInstance] Fetched KnowledgeStatusInstance
63
+ def fetch
64
+
65
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
66
+
67
+
68
+
69
+
70
+
71
+ payload = @version.fetch('GET', @uri, headers: headers)
72
+ KnowledgeStatusInstance.new(
73
+ @version,
74
+ payload,
75
+ id: @solution[:id],
76
+ )
77
+ end
78
+
79
+
80
+ ##
81
+ # Provide a user friendly representation
82
+ def to_s
83
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
84
+ "#<Twilio.Knowledge.V1.KnowledgeStatusContext #{context}>"
85
+ end
86
+
87
+ ##
88
+ # Provide a detailed, user friendly representation
89
+ def inspect
90
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
91
+ "#<Twilio.Knowledge.V1.KnowledgeStatusContext #{context}>"
92
+ end
93
+ end
94
+
95
+ class KnowledgeStatusPage < Page
96
+ ##
97
+ # Initialize the KnowledgeStatusPage
98
+ # @param [Version] version Version that contains the resource
99
+ # @param [Response] response Response from the API
100
+ # @param [Hash] solution Path solution for the resource
101
+ # @return [KnowledgeStatusPage] KnowledgeStatusPage
102
+ def initialize(version, response, solution)
103
+ super(version, response)
104
+
105
+ # Path Solution
106
+ @solution = solution
107
+ end
108
+
109
+ ##
110
+ # Build an instance of KnowledgeStatusInstance
111
+ # @param [Hash] payload Payload response from the API
112
+ # @return [KnowledgeStatusInstance] KnowledgeStatusInstance
113
+ def get_instance(payload)
114
+ KnowledgeStatusInstance.new(@version, payload, id: @solution[:id])
115
+ end
116
+
117
+ ##
118
+ # Provide a user friendly representation
119
+ def to_s
120
+ '<Twilio.Knowledge.V1.KnowledgeStatusPage>'
121
+ end
122
+ end
123
+ class KnowledgeStatusInstance < InstanceResource
124
+ ##
125
+ # Initialize the KnowledgeStatusInstance
126
+ # @param [Version] version Version that contains the resource
127
+ # @param [Hash] payload payload that contains response from Twilio
128
+ # @param [String] account_sid The SID of the
129
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this KnowledgeStatus
130
+ # resource.
131
+ # @param [String] sid The SID of the Call resource to fetch.
132
+ # @return [KnowledgeStatusInstance] KnowledgeStatusInstance
133
+ def initialize(version, payload , id: nil)
134
+ super(version)
135
+
136
+ # Marshaled Properties
137
+ @properties = {
138
+ 'account_sid' => payload['account_sid'],
139
+ 'status' => payload['status'],
140
+ 'last_status' => payload['last_status'],
141
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
142
+ }
143
+
144
+ # Context
145
+ @instance_context = nil
146
+ @params = { 'id' => id || @properties['id'] , }
147
+ end
148
+
149
+ ##
150
+ # Generate an instance context for the instance, the context is capable of
151
+ # performing various actions. All instance actions are proxied to the context
152
+ # @return [KnowledgeStatusContext] CallContext for this CallInstance
153
+ def context
154
+ unless @instance_context
155
+ @instance_context = KnowledgeStatusContext.new(@version , @params['id'])
156
+ end
157
+ @instance_context
158
+ end
159
+
160
+ ##
161
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
162
+ def account_sid
163
+ @properties['account_sid']
164
+ end
165
+
166
+ ##
167
+ # @return [String] The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
168
+ def status
169
+ @properties['status']
170
+ end
171
+
172
+ ##
173
+ # @return [String] The last status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
174
+ def last_status
175
+ @properties['last_status']
176
+ end
177
+
178
+ ##
179
+ # @return [Time] The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
180
+ def date_updated
181
+ @properties['date_updated']
182
+ end
183
+
184
+ ##
185
+ # Fetch the KnowledgeStatusInstance
186
+ # @return [KnowledgeStatusInstance] Fetched KnowledgeStatusInstance
187
+ def fetch
188
+
189
+ context.fetch
190
+ end
191
+
192
+ ##
193
+ # Provide a user friendly representation
194
+ def to_s
195
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
196
+ "<Twilio.Knowledge.V1.KnowledgeStatusInstance #{values}>"
197
+ end
198
+
199
+ ##
200
+ # Provide a detailed, user friendly representation
201
+ def inspect
202
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
203
+ "<Twilio.Knowledge.V1.KnowledgeStatusInstance #{values}>"
204
+ end
205
+ end
206
+
207
+ end
208
+ end
209
+ end
210
+ end
211
+ end
212
+
213
+