Class: Twilio::REST::Accounts::V1::CredentialList::PublicKeyContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ PublicKeyContext

Initialize the PublicKeyContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Twilio-provided string that uniquely identifies the PublicKey resource to update.



229
230
231
232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 229

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the PublicKeyInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



242
243
244
245
246
247
248
249
250
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 242

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

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

#delete_with_metadataBoolean

Delete the PublicKeyInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 255

def 

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

#fetchPublicKeyInstance

Fetch the PublicKeyInstance

Returns:



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 274

def fetch

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

#fetch_with_metadataPublicKeyInstance

Fetch the PublicKeyInstanceMetadata

Returns:



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 293

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    public_key_instance = PublicKeyInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    PublicKeyInstanceMetadata.new(
        @version,
        public_key_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



383
384
385
386
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 383

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

#to_sObject

Provide a user friendly representation



376
377
378
379
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 376

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

#update(friendly_name: :unset) ⇒ PublicKeyInstance

Update the PublicKeyInstance

Parameters:

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

Returns:



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 319

def update(
    friendly_name: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

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

#update_with_metadata(friendly_name: :unset) ⇒ PublicKeyInstance

Update the PublicKeyInstanceMetadata

Parameters:

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

Returns:



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb', line 345

def (
  friendly_name: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    public_key_instance = PublicKeyInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    PublicKeyInstanceMetadata.new(
        @version,
        public_key_instance,
        response.headers,
        response.status_code
    )
end