Class: Twilio::REST::Api::V2010::AccountContext::SipList::DomainContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.rb

Defined Under Namespace

Classes: AuthTypesInstance, AuthTypesList, AuthTypesPage, CredentialListMappingContext, CredentialListMappingInstance, CredentialListMappingList, CredentialListMappingPage, IpAccessControlListMappingContext, IpAccessControlListMappingInstance, IpAccessControlListMappingList, IpAccessControlListMappingPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ DomainContext

Initialize the DomainContext

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 SipDomain resource to fetch.

  • sid (String)

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



202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 202

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

  # Path Solution
  @solution = {account_sid: , sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/SIP/Domains/#{@solution[:sid]}.json"

  # Dependents
  @ip_access_control_list_mappings = nil
  @credential_list_mappings = nil
  @auth = nil
end

Instance Method Details

#authAuthTypesList, AuthTypesContext

Access the auth

Returns:



333
334
335
336
337
338
339
340
341
342
343
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 333

def auth
  unless @auth
    @auth = AuthTypesList.new(
        @version,
        account_sid: @solution[:account_sid],
        domain_sid: @solution[:sid],
    )
  end

  @auth
end

#credential_list_mappings(sid = :unset) ⇒ CredentialListMappingList, CredentialListMappingContext

Access the credential_list_mappings

Returns:

Raises:

  • (ArgumentError)


311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 311

def credential_list_mappings(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return CredentialListMappingContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
  end

  unless @credential_list_mappings
    @credential_list_mappings = CredentialListMappingList.new(
        @version,
        account_sid: @solution[:account_sid],
        domain_sid: @solution[:sid],
    )
  end

  @credential_list_mappings
end

#deleteBoolean

Deletes the DomainInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



276
277
278
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 276

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

#fetchDomainInstance

Fetch a DomainInstance

Returns:



218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 218

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

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

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

#inspectObject

Provide a detailed, user friendly representation



354
355
356
357
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 354

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

#ip_access_control_list_mappings(sid = :unset) ⇒ IpAccessControlListMappingList, IpAccessControlListMappingContext

Access the ip_access_control_list_mappings

Returns:

Raises:

  • (ArgumentError)


284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 284

def ip_access_control_list_mappings(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return IpAccessControlListMappingContext.new(
        @version,
        @solution[:account_sid],
        @solution[:sid],
        sid,
    )
  end

  unless @ip_access_control_list_mappings
    @ip_access_control_list_mappings = IpAccessControlListMappingList.new(
        @version,
        account_sid: @solution[:account_sid],
        domain_sid: @solution[:sid],
    )
  end

  @ip_access_control_list_mappings
end

#to_sObject

Provide a user friendly representation



347
348
349
350
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 347

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

#update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset) ⇒ DomainInstance

Update the DomainInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you created to describe the resource. It can be up to 64 characters long.

  • voice_fallback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_fallback_url`. Can be: `GET` or `POST`.

  • voice_fallback_url (String) (defaults to: :unset)

    The URL that we should call when an error occurs while retrieving or executing the TwiML requested by ‘voice_url`.

  • voice_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_url`

  • voice_status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘voice_status_callback_url`. Can be: `GET` or `POST`.

  • voice_status_callback_url (String) (defaults to: :unset)

    The URL that we should call to pass status parameters (such as call ended) to your application.

  • voice_url (String) (defaults to: :unset)

    The URL we should call when the domain receives a call.

  • sip_registration (Boolean) (defaults to: :unset)

    Whether to allow SIP Endpoints to register with the domain to receive calls. Can be ‘true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not.

  • domain_name (String) (defaults to: :unset)

    The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and “-”.

Returns:



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb', line 251

def update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'VoiceFallbackMethod' => voice_fallback_method,
      'VoiceFallbackUrl' => voice_fallback_url,
      'VoiceMethod' => voice_method,
      'VoiceStatusCallbackMethod' => voice_status_callback_method,
      'VoiceStatusCallbackUrl' => voice_status_callback_url,
      'VoiceUrl' => voice_url,
      'SipRegistration' => sip_registration,
      'DomainName' => domain_name,
  })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

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