Class: Twilio::REST::Intelligence::V2::ServiceContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/service.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ServiceContext

Initialize the ServiceContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this Service.



178
179
180
181
182
183
184
185
186
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 178

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Services/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



190
191
192
193
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 190

def delete

    @version.delete('DELETE', @uri)
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



198
199
200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 198

def fetch

    payload = @version.fetch('GET', @uri)
    ServiceInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



265
266
267
268
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 265

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Intelligence.V2.ServiceContext #{context}>"
end

#to_sObject

Provide a user friendly representation



258
259
260
261
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 258

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Intelligence.V2.ServiceContext #{context}>"
end

#update(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, language_code: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, if_match: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • auto_transcribe (Boolean) (defaults to: :unset)

    Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.

  • data_logging (Boolean) (defaults to: :unset)

    Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models.

  • friendly_name (String) (defaults to: :unset)

    A human readable description of this resource, up to 64 characters.

  • language_code (String) (defaults to: :unset)

    The default language code of the audio.

  • unique_name (String) (defaults to: :unset)

    Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.

  • auto_redaction (Boolean) (defaults to: :unset)

    Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.

  • media_redaction (Boolean) (defaults to: :unset)

    Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.

  • webhook_url (String) (defaults to: :unset)

    The URL Twilio will request when executing the Webhook.

  • webhook_http_method (HttpMethod) (defaults to: :unset)
  • if_match (String) (defaults to: :unset)

    The If-Match HTTP request header

Returns:



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 221

def update(
    auto_transcribe: :unset, 
    data_logging: :unset, 
    friendly_name: :unset, 
    language_code: :unset, 
    unique_name: :unset, 
    auto_redaction: :unset, 
    media_redaction: :unset, 
    webhook_url: :unset, 
    webhook_http_method: :unset, 
    if_match: :unset
)

    data = Twilio::Values.of({
        'AutoTranscribe' => auto_transcribe,
        'DataLogging' => data_logging,
        'FriendlyName' => friendly_name,
        'LanguageCode' => language_code,
        'UniqueName' => unique_name,
        'AutoRedaction' => auto_redaction,
        'MediaRedaction' => media_redaction,
        'WebhookUrl' => webhook_url,
        'WebhookHttpMethod' => webhook_http_method,
    })

    headers = Twilio::Values.of({ 'If-Match' => if_match, })
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ServiceInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end