Class: VoiceML::SipCredentialListsResource

Inherits:
BaseResource show all
Defined in:
lib/voiceml/resources/sip.rb

Overview

/SIP/CredentialLists + /Credentials sub-resource.

Constant Summary collapse

PAGE_FIELDS =
{ 'Page' => :page, 'PageSize' => :page_size, 'PageToken' => :page_token }.freeze

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from VoiceML::BaseResource

Instance Method Details

#create(friendly_name:) ⇒ Object



137
138
139
# File 'lib/voiceml/resources/sip.rb', line 137

def create(friendly_name:)
  SipCredentialList.from_hash(@transport.request(:post, path('SIP', 'CredentialLists'), form: { 'FriendlyName' => friendly_name }))
end

#create_credential(credential_list_sid, username:, password:) ⇒ Object



155
156
157
# File 'lib/voiceml/resources/sip.rb', line 155

def create_credential(credential_list_sid, username:, password:)
  SipCredential.from_hash(@transport.request(:post, path('SIP', 'CredentialLists', credential_list_sid, 'Credentials'), form: { 'Username' => username, 'Password' => password }))
end

#delete(credential_list_sid) ⇒ Object



147
148
149
# File 'lib/voiceml/resources/sip.rb', line 147

def delete(credential_list_sid)
  @transport.request(:delete, path('SIP', 'CredentialLists', credential_list_sid)); nil
end

#delete_credential(credential_list_sid, credential_sid) ⇒ Object



164
165
166
# File 'lib/voiceml/resources/sip.rb', line 164

def delete_credential(credential_list_sid, credential_sid)
  @transport.request(:delete, path('SIP', 'CredentialLists', credential_list_sid, 'Credentials', credential_sid)); nil
end

#fetch(credential_list_sid) ⇒ Object



140
141
142
# File 'lib/voiceml/resources/sip.rb', line 140

def fetch(credential_list_sid)
  SipCredentialList.from_hash(@transport.request(:get, path('SIP', 'CredentialLists', credential_list_sid)))
end

#fetch_credential(credential_list_sid, credential_sid) ⇒ Object



158
159
160
# File 'lib/voiceml/resources/sip.rb', line 158

def fetch_credential(credential_list_sid, credential_sid)
  SipCredential.from_hash(@transport.request(:get, path('SIP', 'CredentialLists', credential_list_sid, 'Credentials', credential_sid)))
end

#list(**kwargs) ⇒ Object



134
135
136
# File 'lib/voiceml/resources/sip.rb', line 134

def list(**kwargs)
  SipCredentialListList.new(@transport.request(:get, path('SIP', 'CredentialLists'), params: form_params(PAGE_FIELDS, kwargs)))
end

#list_credentials(credential_list_sid, **kwargs) ⇒ Object

/Credentials sub-resource



152
153
154
# File 'lib/voiceml/resources/sip.rb', line 152

def list_credentials(credential_list_sid, **kwargs)
  SipCredentialListPage.new(@transport.request(:get, path('SIP', 'CredentialLists', credential_list_sid, 'Credentials'), params: form_params(PAGE_FIELDS, kwargs)))
end

#update(credential_list_sid, friendly_name: nil) ⇒ Object



143
144
145
146
# File 'lib/voiceml/resources/sip.rb', line 143

def update(credential_list_sid, friendly_name: nil)
  form = friendly_name.nil? ? {} : { 'FriendlyName' => friendly_name }
  SipCredentialList.from_hash(@transport.request(:post, path('SIP', 'CredentialLists', credential_list_sid), form: form))
end

#update_credential(credential_list_sid, credential_sid, password:) ⇒ Object



161
162
163
# File 'lib/voiceml/resources/sip.rb', line 161

def update_credential(credential_list_sid, credential_sid, password:)
  SipCredential.from_hash(@transport.request(:post, path('SIP', 'CredentialLists', credential_list_sid, 'Credentials', credential_sid), form: { 'Password' => password }))
end