Class: Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext::AssignedAddOnContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext::AssignedAddOnContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb,
lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb
Defined Under Namespace
Classes: AssignedAddOnExtensionContext, AssignedAddOnExtensionInstance, AssignedAddOnExtensionInstanceMetadata, AssignedAddOnExtensionList, AssignedAddOnExtensionListResponse, AssignedAddOnExtensionPage, AssignedAddOnExtensionPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the AssignedAddOnInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the AssignedAddOnInstanceMetadata.
-
#extensions(sid = :unset) ⇒ AssignedAddOnExtensionList, AssignedAddOnExtensionContext
Access the extensions.
-
#fetch ⇒ AssignedAddOnInstance
Fetch the AssignedAddOnInstance.
-
#fetch_with_metadata ⇒ AssignedAddOnInstance
Fetch the AssignedAddOnInstanceMetadata.
-
#initialize(version, account_sid, resource_sid, sid) ⇒ AssignedAddOnContext
constructor
Initialize the AssignedAddOnContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, account_sid, resource_sid, sid) ⇒ AssignedAddOnContext
Initialize the AssignedAddOnContext
232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 232 def initialize(version, account_sid, resource_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, resource_sid: resource_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/IncomingPhoneNumbers/#{@solution[:resource_sid]}/AssignedAddOns/#{@solution[:sid]}.json" # Dependents @extensions = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the AssignedAddOnInstance
246 247 248 249 250 251 252 253 254 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 246 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 AssignedAddOnInstanceMetadata
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 259 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) assignedAddOn_instance = AssignedAddOnInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) AssignedAddOnInstanceMetadata.new(@version, assignedAddOn_instance, response.headers, response.status_code) end |
#extensions(sid = :unset) ⇒ AssignedAddOnExtensionList, AssignedAddOnExtensionContext
Access the extensions
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 327 def extensions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return AssignedAddOnExtensionContext.new(@version, @solution[:account_sid], @solution[:resource_sid], @solution[:sid],sid ) end unless @extensions @extensions = AssignedAddOnExtensionList.new( @version, account_sid: @solution[:account_sid], resource_sid: @solution[:resource_sid], assigned_add_on_sid: @solution[:sid], ) end @extensions end |
#fetch ⇒ AssignedAddOnInstance
Fetch the AssignedAddOnInstance
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 278 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) AssignedAddOnInstance.new( @version, payload, account_sid: @solution[:account_sid], resource_sid: @solution[:resource_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ AssignedAddOnInstance
Fetch the AssignedAddOnInstanceMetadata
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 299 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) assigned_add_on_instance = AssignedAddOnInstance.new( @version, response.body, account_sid: @solution[:account_sid], resource_sid: @solution[:resource_sid], sid: @solution[:sid], ) AssignedAddOnInstanceMetadata.new( @version, assigned_add_on_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
352 353 354 355 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 352 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.AssignedAddOnContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
345 346 347 348 |
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 345 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.AssignedAddOnContext #{context}>" end |