Class: Twilio::REST::Api::V2010::AccountContext::AddressContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::AddressContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/address.rb,
lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb
Defined Under Namespace
Classes: DependentPhoneNumberInstance, DependentPhoneNumberList, DependentPhoneNumberListResponse, DependentPhoneNumberPage, DependentPhoneNumberPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the AddressInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the AddressInstanceMetadata.
-
#dependent_phone_numbers ⇒ DependentPhoneNumberList, DependentPhoneNumberContext
Access the dependent_phone_numbers.
-
#fetch ⇒ AddressInstance
Fetch the AddressInstance.
-
#fetch_with_metadata ⇒ AddressInstance
Fetch the AddressInstanceMetadata.
-
#initialize(version, account_sid, sid) ⇒ AddressContext
constructor
Initialize the AddressContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset) ⇒ AddressInstance
Update the AddressInstance.
-
#update_with_metadata(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset) ⇒ AddressInstance
Update the AddressInstanceMetadata.
Constructor Details
#initialize(version, account_sid, sid) ⇒ AddressContext
Initialize the AddressContext
314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 314 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Addresses/#{@solution[:sid]}.json" # Dependents @dependent_phone_numbers = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the AddressInstance
328 329 330 331 332 333 334 335 336 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 328 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 AddressInstanceMetadata
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 341 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) address_instance = AddressInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) AddressInstanceMetadata.new(@version, address_instance, response.headers, response.status_code) end |
#dependent_phone_numbers ⇒ DependentPhoneNumberList, DependentPhoneNumberContext
Access the dependent_phone_numbers
515 516 517 518 519 520 521 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 515 def dependent_phone_numbers unless @dependent_phone_numbers @dependent_phone_numbers = DependentPhoneNumberList.new( @version, account_sid: @solution[:account_sid], address_sid: @solution[:sid], ) end @dependent_phone_numbers end |
#fetch ⇒ AddressInstance
Fetch the AddressInstance
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 360 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) AddressInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ AddressInstance
Fetch the AddressInstanceMetadata
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 380 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) address_instance = AddressInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) AddressInstanceMetadata.new( @version, address_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
532 533 534 535 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 532 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.AddressContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
525 526 527 528 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 525 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.AddressContext #{context}>" end |
#update(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset) ⇒ AddressInstance
Update the AddressInstance
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 415 def update( friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'CustomerName' => customer_name, 'Street' => street, 'City' => city, 'Region' => region, 'PostalCode' => postal_code, 'EmergencyEnabled' => emergency_enabled, 'AutoCorrectAddress' => auto_correct_address, 'StreetSecondary' => street_secondary, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) AddressInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset) ⇒ AddressInstance
Update the AddressInstanceMetadata
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 466 def ( friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset, street_secondary: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'CustomerName' => customer_name, 'Street' => street, 'City' => city, 'Region' => region, 'PostalCode' => postal_code, 'EmergencyEnabled' => emergency_enabled, 'AutoCorrectAddress' => auto_correct_address, 'StreetSecondary' => street_secondary, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) address_instance = AddressInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) AddressInstanceMetadata.new( @version, address_instance, response.headers, response.status_code ) end |