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, DependentPhoneNumberPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the AddressInstance.
-
#dependent_phone_numbers ⇒ DependentPhoneNumberList, DependentPhoneNumberContext
Access the dependent_phone_numbers.
-
#fetch ⇒ AddressInstance
Fetch the AddressInstance.
-
#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.
Constructor Details
#initialize(version, account_sid, sid) ⇒ AddressContext
Initialize the AddressContext
200 201 202 203 204 205 206 207 208 209 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 200 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
213 214 215 216 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 213 def delete @version.delete('DELETE', @uri) end |
#dependent_phone_numbers ⇒ DependentPhoneNumberList, DependentPhoneNumberContext
Access the dependent_phone_numbers
281 282 283 284 285 286 287 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 281 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
221 222 223 224 225 226 227 228 229 230 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 221 def fetch payload = @version.fetch('GET', @uri) AddressInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
298 299 300 301 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 298 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.AddressContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
291 292 293 294 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 291 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
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 244 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, }) payload = @version.update('POST', @uri, data: data) AddressInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |