Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext::CredentialContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext::CredentialContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the CredentialInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the CredentialInstanceMetadata.
-
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance.
-
#fetch_with_metadata ⇒ CredentialInstance
Fetch the CredentialInstanceMetadata.
-
#initialize(version, account_sid, credential_list_sid, sid) ⇒ CredentialContext
constructor
Initialize the CredentialContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(password: :unset) ⇒ CredentialInstance
Update the CredentialInstance.
-
#update_with_metadata(password: :unset) ⇒ CredentialInstance
Update the CredentialInstanceMetadata.
Constructor Details
#initialize(version, account_sid, credential_list_sid, sid) ⇒ CredentialContext
Initialize the CredentialContext
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 239 def initialize(version, account_sid, credential_list_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, credential_list_sid: credential_list_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/SIP/CredentialLists/#{@solution[:credential_list_sid]}/Credentials/#{@solution[:sid]}.json" end |
Instance Method Details
#delete ⇒ Boolean
Delete the CredentialInstance
252 253 254 255 256 257 258 259 260 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 252 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 CredentialInstanceMetadata
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 265 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) CredentialInstanceMetadata.new(@version, credential_instance, response.headers, response.status_code) end |
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 284 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CredentialInstance.new( @version, payload, account_sid: @solution[:account_sid], credential_list_sid: @solution[:credential_list_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ CredentialInstance
Fetch the CredentialInstanceMetadata
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 305 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, account_sid: @solution[:account_sid], credential_list_sid: @solution[:credential_list_sid], sid: @solution[:sid], ) CredentialInstanceMetadata.new( @version, credential_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
401 402 403 404 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 401 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
394 395 396 397 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 394 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialContext #{context}>" end |
#update(password: :unset) ⇒ CredentialInstance
Update the CredentialInstance
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 333 def update( password: :unset ) data = Twilio::Values.of({ 'Password' => password, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) CredentialInstance.new( @version, payload, account_sid: @solution[:account_sid], credential_list_sid: @solution[:credential_list_sid], sid: @solution[:sid], ) end |
#update_with_metadata(password: :unset) ⇒ CredentialInstance
Update the CredentialInstanceMetadata
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 361 def ( password: :unset ) data = Twilio::Values.of({ 'Password' => password, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, account_sid: @solution[:account_sid], credential_list_sid: @solution[:credential_list_sid], sid: @solution[:sid], ) CredentialInstanceMetadata.new( @version, credential_instance, response.headers, response.status_code ) end |