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
231 232 233 234 235 236 237 238 239 240 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 231 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
244 245 246 247 248 249 250 251 252 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 244 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
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 257 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
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 276 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
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 297 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
393 394 395 396 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 393 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
386 387 388 389 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 386 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialContext #{context}>" end |
#update(password: :unset) ⇒ CredentialInstance
Update the CredentialInstance
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 325 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
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 353 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 |