Class: Twilio::REST::Trunking::V1::TrunkContext::CredentialListContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, trunk_sid, sid) ⇒ CredentialListContext

Initialize the CredentialListContext

Parameters:

  • version (Version)

    Version that contains the resource

  • trunk_sid (String)

    The SID of the Trunk from which to fetch the credential list.

  • sid (String)

    The unique string that we created to identify the CredentialList resource to fetch.



220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 220

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

    # Path Solution
    @solution = { trunk_sid: trunk_sid, sid: sid,  }
    @uri = "/Trunks/#{@solution[:trunk_sid]}/CredentialLists/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the CredentialListInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



233
234
235
236
237
238
239
240
241
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 233

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 CredentialListInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 246

def 

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

#fetchCredentialListInstance

Fetch the CredentialListInstance

Returns:



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 265

def fetch

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

#fetch_with_metadataCredentialListInstance

Fetch the CredentialListInstanceMetadata

Returns:



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 285

def 

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

#inspectObject

Provide a detailed, user friendly representation



318
319
320
321
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 318

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

#to_sObject

Provide a user friendly representation



311
312
313
314
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb', line 311

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