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
229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 229 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
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 382 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
243 244 245 246 247 248 249 250 251 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 243 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
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 256 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
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 275 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
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 295 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
407 408 409 410 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 407 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialListContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
400 401 402 403 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 400 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
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 322 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
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 349 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 |