Class: Twilio::REST::Webhooks::V1::SharedKeyContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/webhooks/v1/shared_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, shared_key_id) ⇒ SharedKeyContext

Initialize the SharedKeyContext

Parameters:

  • version (Version) —

    Version that contains the resource

  • shared_key_id (String)


278
279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 278

def initialize(version, shared_key_id)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)

    # Path Solution
    @solution = { shared_key_id: shared_key_id,  }
    @uri = "/Webhooks/SharedKeys/#{@solution[:shared_key_id]}"

    
end

Instance Method Details

#delete ⇒ Boolean

Delete the SharedKeyInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 292

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    response = @version.('DELETE', @uri, headers: headers)
    SharedKeyInstance.new(
      @version,
      response.body,
        shared_key_id: @solution[:shared_key_id],
    )
    
end

#delete_with_metadata ⇒ Boolean

Delete the SharedKeyInstanceMetadata

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 310

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      sharedKey_instance = SharedKeyInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      SharedKeyInstanceMetadata.new(@version, sharedKey_instance, response.headers, response.status_code)
end

#fetch ⇒ SharedKeyInstance

Fetch the SharedKeyInstance

Returns:



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 329

def fetch

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

#fetch_with_metadata ⇒ SharedKeyInstance

Fetch the SharedKeyInstanceMetadata

Returns:



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 348

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
     headers['Accept'] = '*/*'
    response = @version.('GET', @uri, headers: headers)
    shared_key_instance = SharedKeyInstance.new(
        @version,
        response.body,
        shared_key_id: @solution[:shared_key_id],
    )
    SharedKeyInstanceMetadata.new(
        @version,
        shared_key_instance,
        response.headers,
        response.status_code
    )
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



428
429
430
431
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 428

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

#patch(patch_shared_key: nil) ⇒ SharedKeyInstance

Patch the SharedKeyInstance

Parameters:

  • patch_shared_key (PatchSharedKey) (defaults to: nil)

Returns:



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 374

def patch(patch_shared_key: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
     headers['Accept'] = '*/*'
    payload = @version.patch('PATCH', @uri, headers: headers, data: patch_shared_key.to_json)
    SharedKeyInstance.new(
        @version,
        payload,
        shared_key_id: @solution[:shared_key_id],
    )
end

#patch_with_metadata(patch_shared_key: nil) ⇒ SharedKeyInstance

Patch the SharedKeyInstanceMetadata

Parameters:

  • patch_shared_key (PatchSharedKey) (defaults to: nil)

Returns:



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 395

def (patch_shared_key: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
     headers['Accept'] = '*/*'
    response = @version.('PATCH', @uri, headers: headers, data: patch_shared_key.to_json)
    shared_key_instance = SharedKeyInstance.new(
        @version,
        response.body,
        shared_key_id: @solution[:shared_key_id],
    )
    SharedKeyInstanceMetadata.new(
        @version,
        shared_key_instance,
        response.headers,
        response.status_code
    )
end

#to_s ⇒ Object

Provide a user friendly representation



421
422
423
424
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 421

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