## # 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 PortingBulkPortabilityList < ListResource ## # Initialize the PortingBulkPortabilityList # @param [Version] version Version that contains the resource # @return [PortingBulkPortabilityList] PortingBulkPortabilityList def initialize(version) super(version) # Path Solution @solution = { } @uri = "/Porting/Portability" end ## # Create the PortingBulkPortabilityInstance # @param [Array[String]] phone_numbers The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . # @return [PortingBulkPortabilityInstance] Created PortingBulkPortabilityInstance def create( phone_numbers: nil ) data = Twilio::Values.of({ 'PhoneNumbers' => Twilio.serialize_list(phone_numbers) { |e| e }, }) payload = @version.create('POST', @uri, data: data) PortingBulkPortabilityInstance.new( @version, payload, ) 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 PortingBulkPortabilityContext < InstanceContext ## # Initialize the PortingBulkPortabilityContext # @param [Version] version Version that contains the resource # @param [String] sid A 34 character string that uniquely identifies the Portability check. # @return [PortingBulkPortabilityContext] PortingBulkPortabilityContext def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Porting/Portability/#{@solution[:sid]}" end ## # Fetch the PortingBulkPortabilityInstance # @return [PortingBulkPortabilityInstance] Fetched PortingBulkPortabilityInstance def fetch payload = @version.fetch('GET', @uri) PortingBulkPortabilityInstance.new( @version, payload, sid: @solution[:sid], ) 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 PortingBulkPortabilityPage < Page ## # Initialize the PortingBulkPortabilityPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [PortingBulkPortabilityPage] PortingBulkPortabilityPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of PortingBulkPortabilityInstance # @param [Hash] payload Payload response from the API # @return [PortingBulkPortabilityInstance] PortingBulkPortabilityInstance def get_instance(payload) PortingBulkPortabilityInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class PortingBulkPortabilityInstance < InstanceResource ## # Initialize the PortingBulkPortabilityInstance # @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 PortingBulkPortability # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [PortingBulkPortabilityInstance] PortingBulkPortabilityInstance def initialize(version, payload , sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'status' => payload['status'], 'datetime_created' => Twilio.deserialize_iso8601_datetime(payload['datetime_created']), 'phone_numbers' => payload['phone_numbers'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'sid' => sid || @properties['sid'] , } 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 [PortingBulkPortabilityContext] CallContext for this CallInstance def context unless @instance_context @instance_context = PortingBulkPortabilityContext.new(@version , @params['sid']) end @instance_context end ## # @return [String] A 34 character string that uniquely identifies this Portability check. def sid @properties['sid'] end ## # @return [Status] def status @properties['status'] end ## # @return [Time] The date that the Portability check was created, given in ISO 8601 format. def datetime_created @properties['datetime_created'] end ## # @return [Array] Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number. def phone_numbers @properties['phone_numbers'] 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 PortingBulkPortabilityInstance # @return [PortingBulkPortabilityInstance] Fetched PortingBulkPortabilityInstance 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