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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ServiceContext

Initialize the ServiceContext



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

def initialize(version, sid)
    super(version)

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

    
end

Instance Method Details

#deleteBoolean

Delete the ServiceInstance



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchServiceInstance

Fetch the ServiceInstance



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 212

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ServiceInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



290
291
292
293
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 290

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

#to_sObject

Provide a user friendly representation



283
284
285
286
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 283

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, 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



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 241

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
)

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

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