## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Numbers # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Numbers < NumbersBase class V1 < Version class PortingPortabilityList < ListResource ## # Initialize the PortingPortabilityList # @param [Version] version Version that contains the resource # @return [PortingPortabilityList] PortingPortabilityList def initialize(version) super(version) # Path Solution @solution = { } end # Provide a user friendly representation def to_s '#' end end ## #PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class PortingPortabilityContext < InstanceContext ## # Initialize the PortingPortabilityContext # @param [Version] version Version that contains the resource # @param [String] phone_number The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). # @return [PortingPortabilityContext] PortingPortabilityContext def initialize(version, phone_number) super(version) # Path Solution @solution = { phone_number: phone_number, } @uri = "/Porting/Portability/PhoneNumber/#{CGI.escape(@solution[:phone_number]).gsub("+", "%20")}" end ## # Fetch the PortingPortabilityInstance # @param [String] target_account_sid The SID of the account where the phone number(s) will be ported. # @return [PortingPortabilityInstance] Fetched PortingPortabilityInstance def fetch( target_account_sid: :unset ) params = Twilio::Values.of({ 'TargetAccountSid' => target_account_sid, }) payload = @version.fetch('GET', @uri, params: params) PortingPortabilityInstance.new( @version, payload, phone_number: @solution[:phone_number], ) 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 PortingPortabilityPage < Page ## # Initialize the PortingPortabilityPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [PortingPortabilityPage] PortingPortabilityPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of PortingPortabilityInstance # @param [Hash] payload Payload response from the API # @return [PortingPortabilityInstance] PortingPortabilityInstance def get_instance(payload) PortingPortabilityInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class PortingPortabilityInstance < InstanceResource ## # Initialize the PortingPortabilityInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PortingPortability # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [PortingPortabilityInstance] PortingPortabilityInstance def initialize(version, payload , phone_number: nil) super(version) # Marshaled Properties @properties = { 'phone_number' => payload['phone_number'], 'account_sid' => payload['account_sid'], 'portable' => payload['portable'], 'pin_and_account_number_required' => payload['pin_and_account_number_required'], 'not_portable_reason' => payload['not_portable_reason'], 'not_portable_reason_code' => payload['not_portable_reason_code'] == nil ? payload['not_portable_reason_code'] : payload['not_portable_reason_code'].to_i, 'number_type' => payload['number_type'], 'country' => payload['country'], 'messaging_carrier' => payload['messaging_carrier'], 'voice_carrier' => payload['voice_carrier'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'phone_number' => phone_number || @properties['phone_number'] , } 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 [PortingPortabilityContext] CallContext for this CallInstance def context unless @instance_context @instance_context = PortingPortabilityContext.new(@version , @params['phone_number']) end @instance_context end ## # @return [String] The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). def phone_number @properties['phone_number'] end ## # @return [String] The target account sid to which the number will be ported def account_sid @properties['account_sid'] end ## # @return [Boolean] Boolean flag specifying if phone number is portable or not. def portable @properties['portable'] end ## # @return [Boolean] Boolean flag specifying if PIN and account number is required for the phone number. def pin_and_account_number_required @properties['pin_and_account_number_required'] end ## # @return [String] Reason why the phone number cannot be ported into Twilio, `null` otherwise. def not_portable_reason @properties['not_portable_reason'] end ## # @return [String] The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. def not_portable_reason_code @properties['not_portable_reason_code'] end ## # @return [NumberType] def number_type @properties['number_type'] end ## # @return [String] Country the phone number belongs to. def country @properties['country'] end ## # @return [String] Current messaging carrier of the phone number def messaging_carrier @properties['messaging_carrier'] end ## # @return [String] Current voice carrier of the phone number def voice_carrier @properties['voice_carrier'] end ## # @return [String] This is the url of the request that you're trying to reach out to locate the resource. def url @properties['url'] end ## # Fetch the PortingPortabilityInstance # @param [String] target_account_sid The SID of the account where the phone number(s) will be ported. # @return [PortingPortabilityInstance] Fetched PortingPortabilityInstance def fetch( target_account_sid: :unset ) context.fetch( target_account_sid: target_account_sid, ) 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