Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb

Defined Under Namespace

Classes: CredentialContext, CredentialInstance, CredentialList, CredentialPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ CredentialListContext

Initialize the CredentialListContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The unique id of the Account that is responsible for this resource.

  • sid (String)

    The credential list Sid that uniquely identifies this resource



175
176
177
178
179
180
181
182
183
184
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 175

def initialize(version, , sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/SIP/CredentialLists/#{@solution[:sid]}.json"

  # Dependents
  @credentials = nil
end

Instance Method Details

#credentials(sid = :unset) ⇒ CredentialList, CredentialContext

Access the credentials

Returns:

Raises:

  • (ArgumentError)


239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 239

def credentials(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return CredentialContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
  end

  unless @credentials
    @credentials = CredentialList.new(
        @version,
        account_sid: @solution[:account_sid],
        credential_list_sid: @solution[:sid],
    )
  end

  @credentials
end

#deleteBoolean

Deletes the CredentialListInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



231
232
233
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 231

def delete
  @version.delete('delete', @uri)
end

#fetchCredentialListInstance

Fetch a CredentialListInstance

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 189

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  CredentialListInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



266
267
268
269
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 266

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

#to_sObject

Provide a user friendly representation



259
260
261
262
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 259

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

#update(friendly_name: nil) ⇒ CredentialListInstance

Update the CredentialListInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

    A human readable descriptive text for a CredentialList, up to 64 characters long.

Returns:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 211

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

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  CredentialListInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end