class Twilio::REST::Api::V2010::AccountContext::AddressContext
Public Class Methods
Initialize the AddressContext
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that is responsible for the Address resource to fetch.
@param [String] sid The Twilio-provided string that uniquely identifies the
Address resource to fetch.
@return [AddressContext] AddressContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 223 def initialize(version, account_sid, sid) 224 super(version) 225 226 # Path Solution 227 @solution = {account_sid: account_sid, sid: sid, } 228 @uri = "/Accounts/#{@solution[:account_sid]}/Addresses/#{@solution[:sid]}.json" 229 230 # Dependents 231 @dependent_phone_numbers = nil 232 end
Public Instance Methods
Delete the AddressInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 237 def delete 238 @version.delete('DELETE', @uri) 239 end
Access the dependent_phone_numbers
@return [DependentPhoneNumberList] @return [DependentPhoneNumberContext]
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 287 def dependent_phone_numbers 288 unless @dependent_phone_numbers 289 @dependent_phone_numbers = DependentPhoneNumberList.new( 290 @version, 291 account_sid: @solution[:account_sid], 292 address_sid: @solution[:sid], 293 ) 294 end 295 296 @dependent_phone_numbers 297 end
Fetch the AddressInstance
@return [AddressInstance] Fetched AddressInstance
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 244 def fetch 245 payload = @version.fetch('GET', @uri) 246 247 AddressInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 248 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 308 def inspect 309 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 310 "#<Twilio.Api.V2010.AddressContext #{context}>" 311 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 301 def to_s 302 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 303 "#<Twilio.Api.V2010.AddressContext #{context}>" 304 end
Update the AddressInstance
@param [String] friendly_name A descriptive string that you create to describe
the address. It can be up to 64 characters long.
@param [String] customer_name The name to associate with the address. @param [String] street The number and street address of the address. @param [String] city The city of the address. @param [String] region The state or region of the address. @param [String] postal_code The postal code of the address. @param [Boolean] emergency_enabled Whether to enable emergency calling on the
address. Can be: `true` or `false`.
@param [Boolean] auto_correct_address Whether we should automatically correct
the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide.
@return [AddressInstance] Updated AddressInstance
# File lib/twilio-ruby/rest/api/v2010/account/address.rb 266 def update(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset) 267 data = Twilio::Values.of({ 268 'FriendlyName' => friendly_name, 269 'CustomerName' => customer_name, 270 'Street' => street, 271 'City' => city, 272 'Region' => region, 273 'PostalCode' => postal_code, 274 'EmergencyEnabled' => emergency_enabled, 275 'AutoCorrectAddress' => auto_correct_address, 276 }) 277 278 payload = @version.update('POST', @uri, data: data) 279 280 AddressInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 281 end