Class: VoiceML::ConversationsV1CredentialsResource

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/resources/conversations_v1.rb

Overview

============================================================================

/v1/Credentials (push credentials — distinct from /SIP/Credentials)

Constant Summary collapse

CREDENTIAL_FIELDS =
{
  'Type' => :type,
  'FriendlyName' => :friendly_name,
  'Certificate' => :certificate,
  'PrivateKey' => :private_key,
  'Sandbox' => :sandbox,
  'ApiKey' => :api_key,
  'Secret' => :secret
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ ConversationsV1CredentialsResource

Returns a new instance of ConversationsV1CredentialsResource.



403
404
405
# File 'lib/voiceml/resources/conversations_v1.rb', line 403

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(type:, **kwargs) ⇒ Object



413
414
415
416
417
418
# File 'lib/voiceml/resources/conversations_v1.rb', line 413

def create(type:, **kwargs)
  kwargs[:type] = type
  ConversationsV1Credential.from_hash(
    @transport.request(:post, '/v1/Credentials', form: build_form(kwargs))
  )
end

#delete(sid) ⇒ Object



430
431
432
433
# File 'lib/voiceml/resources/conversations_v1.rb', line 430

def delete(sid)
  @transport.request(:delete, "/v1/Credentials/#{sid}")
  nil
end

#fetch(sid) ⇒ Object



420
421
422
# File 'lib/voiceml/resources/conversations_v1.rb', line 420

def fetch(sid)
  ConversationsV1Credential.from_hash(@transport.request(:get, "/v1/Credentials/#{sid}"))
end

#list(page_size: nil) ⇒ Object



407
408
409
410
411
# File 'lib/voiceml/resources/conversations_v1.rb', line 407

def list(page_size: nil)
  params = {}
  params['PageSize'] = page_size unless page_size.nil?
  ConversationsV1CredentialList.new(@transport.request(:get, '/v1/Credentials', params: params))
end

#update(sid, **kwargs) ⇒ Object



424
425
426
427
428
# File 'lib/voiceml/resources/conversations_v1.rb', line 424

def update(sid, **kwargs)
  ConversationsV1Credential.from_hash(
    @transport.request(:post, "/v1/Credentials/#{sid}", form: build_form(kwargs))
  )
end