Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext
- 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, CredentialInstanceMetadata, CredentialList, CredentialListResponse, CredentialPage, CredentialPageMetadata
Instance Method Summary collapse
-
#credentials(sid = :unset) ⇒ CredentialList, CredentialContext
Access the credentials.
-
#delete ⇒ Boolean
Delete the CredentialListInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the CredentialListInstanceMetadata.
-
#fetch ⇒ CredentialListInstance
Fetch the CredentialListInstance.
-
#fetch_with_metadata ⇒ CredentialListInstance
Fetch the CredentialListInstanceMetadata.
-
#initialize(version, account_sid, sid) ⇒ CredentialListContext
constructor
Initialize the CredentialListContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: nil) ⇒ CredentialListInstance
Update the CredentialListInstance.
-
#update_with_metadata(friendly_name: nil) ⇒ CredentialListInstance
Update the CredentialListInstanceMetadata.
Constructor Details
#initialize(version, account_sid, sid) ⇒ CredentialListContext
Initialize the CredentialListContext
221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 221 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: 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
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 374 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 |
#delete ⇒ Boolean
Delete the CredentialListInstance
235 236 237 238 239 240 241 242 243 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 235 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the CredentialListInstanceMetadata
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 248 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 |
#fetch ⇒ CredentialListInstance
Fetch the CredentialListInstance
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 267 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CredentialListInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ CredentialListInstance
Fetch the CredentialListInstanceMetadata
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 287 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, account_sid: @solution[:account_sid], sid: @solution[:sid], ) CredentialListInstanceMetadata.new( @version, credential_list_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
399 400 401 402 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 399 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialListContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
392 393 394 395 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 392 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
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 314 def update( friendly_name: nil ) 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) CredentialListInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: nil) ⇒ CredentialListInstance
Update the CredentialListInstanceMetadata
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 341 def ( friendly_name: nil ) 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) credential_list_instance = CredentialListInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) CredentialListInstanceMetadata.new( @version, credential_list_instance, response.headers, response.status_code ) end |