## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Routes < Domain class V2 < Version class SipDomainList < ListResource ## # Initialize the SipDomainList # @param [Version] version Version that contains the resource # @return [SipDomainList] SipDomainList def initialize(version) super(version) # Path Solution @solution = {} end ## # Provide a user friendly representation def to_s '#' end end class SipDomainPage < Page ## # Initialize the SipDomainPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [SipDomainPage] SipDomainPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of SipDomainInstance # @param [Hash] payload Payload response from the API # @return [SipDomainInstance] SipDomainInstance def get_instance(payload) SipDomainInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '' end end class SipDomainContext < InstanceContext ## # Initialize the SipDomainContext # @param [Version] version Version that contains the resource # @param [String] sip_domain The sip_domain # @return [SipDomainContext] SipDomainContext def initialize(version, sip_domain) super(version) # Path Solution @solution = {sip_domain: sip_domain, } @uri = "/SipDomains/#{@solution[:sip_domain]}" end ## # Create the SipDomainInstance # @param [String] voice_region The voice_region # @param [String] friendly_name The friendly_name # @return [SipDomainInstance] Created SipDomainInstance def create(voice_region: :unset, friendly_name: :unset) data = Twilio::Values.of({'VoiceRegion' => voice_region, 'FriendlyName' => friendly_name, }) payload = @version.create('POST', @uri, data: data) SipDomainInstance.new(@version, payload, sip_domain: @solution[:sip_domain], ) end ## # Update the SipDomainInstance # @param [String] voice_region The voice_region # @param [String] friendly_name The friendly_name # @return [SipDomainInstance] Updated SipDomainInstance def update(voice_region: :unset, friendly_name: :unset) data = Twilio::Values.of({'VoiceRegion' => voice_region, 'FriendlyName' => friendly_name, }) payload = @version.update('POST', @uri, data: data) SipDomainInstance.new(@version, payload, sip_domain: @solution[:sip_domain], ) end ## # Fetch the SipDomainInstance # @return [SipDomainInstance] Fetched SipDomainInstance def fetch payload = @version.fetch('GET', @uri) SipDomainInstance.new(@version, payload, sip_domain: @solution[:sip_domain], ) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end end class SipDomainInstance < InstanceResource ## # Initialize the SipDomainInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sip_domain The sip_domain # @return [SipDomainInstance] SipDomainInstance def initialize(version, payload, sip_domain: nil) super(version) # Marshaled Properties @properties = { 'sip_domain' => payload['sip_domain'], 'url' => payload['url'], 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'friendly_name' => payload['friendly_name'], 'voice_region' => payload['voice_region'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), } # Context @instance_context = nil @params = {'sip_domain' => sip_domain || @properties['sip_domain'], } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [SipDomainContext] SipDomainContext for this SipDomainInstance def context unless @instance_context @instance_context = SipDomainContext.new(@version, @params['sip_domain'], ) end @instance_context end ## # @return [String] The sip_domain def sip_domain @properties['sip_domain'] end ## # @return [String] The url def url @properties['url'] end ## # @return [String] The sid def sid @properties['sid'] end ## # @return [String] The account_sid def account_sid @properties['account_sid'] end ## # @return [String] The friendly_name def friendly_name @properties['friendly_name'] end ## # @return [String] The voice_region def voice_region @properties['voice_region'] end ## # @return [Time] The date_created def date_created @properties['date_created'] end ## # @return [Time] The date_updated def date_updated @properties['date_updated'] end ## # Create the SipDomainInstance # @param [String] voice_region The voice_region # @param [String] friendly_name The friendly_name # @return [SipDomainInstance] Created SipDomainInstance def create(voice_region: :unset, friendly_name: :unset) context.create(voice_region: voice_region, friendly_name: friendly_name, ) end ## # Update the SipDomainInstance # @param [String] voice_region The voice_region # @param [String] friendly_name The friendly_name # @return [SipDomainInstance] Updated SipDomainInstance def update(voice_region: :unset, friendly_name: :unset) context.update(voice_region: voice_region, friendly_name: friendly_name, ) end ## # Fetch the SipDomainInstance # @return [SipDomainInstance] Fetched SipDomainInstance def fetch context.fetch end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end