Class: Twilio::REST::Intelligence::V2::ServiceInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Service resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 627

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'auto_redaction' => payload['auto_redaction'],
        'media_redaction' => payload['media_redaction'],
        'auto_transcribe' => payload['auto_transcribe'],
        'data_logging' => payload['data_logging'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'friendly_name' => payload['friendly_name'],
        'language_code' => payload['language_code'],
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        'url' => payload['url'],
        'webhook_url' => payload['webhook_url'],
        'webhook_http_method' => payload['webhook_http_method'],
        'read_only_attached_operator_sids' => payload['read_only_attached_operator_sids'],
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
        'encryption_credential_sid' => payload['encryption_credential_sid'],
    }

    # Context
    @instance_context = nil
    @params = { 'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account the Service belongs to.

Returns:

  • (String)

    The unique SID identifier of the Account the Service belongs to.



670
671
672
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 670

def 
    @properties['account_sid']
end

#auto_redactionBoolean

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

Returns:

  • (Boolean)

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



676
677
678
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 676

def auto_redaction
    @properties['auto_redaction']
end

#auto_transcribeBoolean

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

Returns:

  • (Boolean)

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



688
689
690
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 688

def auto_transcribe
    @properties['auto_transcribe']
end

#contextServiceContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



661
662
663
664
665
666
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 661

def context
    unless @instance_context
        @instance_context = ServiceContext.new(@version , @params['sid'])
    end
    @instance_context
end

#data_loggingBoolean

Returns Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.

Returns:

  • (Boolean)

    Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.



694
695
696
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 694

def data_logging
    @properties['data_logging']
end

#date_createdTime

Returns The date that this Service was created, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Service was created, given in ISO 8601 format.



700
701
702
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 700

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this Service was updated, given in ISO 8601 format.

Returns:

  • (Time)

    The date that this Service was updated, given in ISO 8601 format.



706
707
708
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 706

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



773
774
775
776
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 773

def delete

    context.delete
end

#encryption_credential_sidString

Returns The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results.

Returns:

  • (String)

    The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results.



766
767
768
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 766

def encryption_credential_sid
    @properties['encryption_credential_sid']
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



781
782
783
784
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 781

def fetch

    context.fetch
end

#friendly_nameString

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

Returns:

  • (String)

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



712
713
714
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 712

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



835
836
837
838
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 835

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V2.ServiceInstance #{values}>"
end

#language_codeString

Returns The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it’s set.

Returns:

  • (String)

    The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it’s set.



718
719
720
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 718

def language_code
    @properties['language_code']
end

#media_redactionBoolean

Returns 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.

Returns:

  • (Boolean)

    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.



682
683
684
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 682

def media_redaction
    @properties['media_redaction']
end

#read_only_attached_operator_sidsArray<String>

Returns Operator sids attached to this service, read only.

Returns:

  • (Array<String>)

    Operator sids attached to this service, read only



754
755
756
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 754

def read_only_attached_operator_sids
    @properties['read_only_attached_operator_sids']
end

#sidString

Returns A 34 character string that uniquely identifies this Service.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Service.



724
725
726
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 724

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



828
829
830
831
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 828

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V2.ServiceInstance #{values}>"
end

#unique_nameString

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

Returns:

  • (String)

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



730
731
732
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 730

def unique_name
    @properties['unique_name']
end

#update(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :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 & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.

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

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

  • 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)
  • encryption_credential_sid (String) (defaults to: :unset)

    The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results.

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

    The If-Match HTTP request header

Returns:



799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 799

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

    context.update(
        auto_transcribe: auto_transcribe, 
        data_logging: data_logging, 
        friendly_name: friendly_name, 
        unique_name: unique_name, 
        auto_redaction: auto_redaction, 
        media_redaction: media_redaction, 
        webhook_url: webhook_url, 
        webhook_http_method: webhook_http_method, 
        encryption_credential_sid: encryption_credential_sid, 
        if_match: if_match, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



736
737
738
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 736

def url
    @properties['url']
end

#versionString

Returns The version number of this Service.

Returns:

  • (String)

    The version number of this Service.



760
761
762
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 760

def version
    @properties['version']
end

#webhook_http_methodHttpMethod

Returns:

  • (HttpMethod)


748
749
750
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 748

def webhook_http_method
    @properties['webhook_http_method']
end

#webhook_urlString

Returns The URL Twilio will request when executing the Webhook.

Returns:

  • (String)

    The URL Twilio will request when executing the Webhook.



742
743
744
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 742

def webhook_url
    @properties['webhook_url']
end