Class: Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext::AssignedAddOnContext

Inherits:
InstanceContext
  • Object
show all
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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Defined Under Namespace

Classes: AssignedAddOnExtensionContext, AssignedAddOnExtensionInstance, AssignedAddOnExtensionList, AssignedAddOnExtensionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, resource_sid, sid) ⇒ AssignedAddOnContext

Initialize the AssignedAddOnContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/api/rest/account) that created the resource to fetch.

  • resource_sid (String)

    The SID of the Phone Number to which the Add-on is assigned.

  • sid (String)

    The Twilio-provided string that uniquely identifies the resource to fetch.



197
198
199
200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 197

def initialize(version, , resource_sid, sid)
  super(version)

  # Path Solution
  @solution = {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

#deleteBoolean

Deletes the AssignedAddOnInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



232
233
234
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 232

def delete
  @version.delete('delete', @uri)
end

#extensions(sid = :unset) ⇒ AssignedAddOnExtensionList, AssignedAddOnExtensionContext

Access the extensions

Returns:

Raises:

  • (ArgumentError)


240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 240

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

#fetchAssignedAddOnInstance

Fetch a AssignedAddOnInstance

Returns:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 211

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  AssignedAddOnInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      resource_sid: @solution[:resource_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



274
275
276
277
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 274

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.AssignedAddOnContext #{context}>"
end

#to_sObject

Provide a user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb', line 267

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.AssignedAddOnContext #{context}>"
end