## # 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 PortingPortInPhoneNumberList < ListResource ## # Initialize the PortingPortInPhoneNumberList # @param [Version] version Version that contains the resource # @return [PortingPortInPhoneNumberList] PortingPortInPhoneNumberList def initialize(version) super(version) # Path Solution @solution = { } end # Provide a user friendly representation def to_s '#' end end class PortingPortInPhoneNumberContext < InstanceContext ## # Initialize the PortingPortInPhoneNumberContext # @param [Version] version Version that contains the resource # @param [String] port_in_request_sid The SID of the Port In request. This is a unique identifier of the port in request. # @param [String] phone_number_sid The SID of the Phone number. This is a unique identifier of the phone number. # @return [PortingPortInPhoneNumberContext] PortingPortInPhoneNumberContext def initialize(version, port_in_request_sid, phone_number_sid) super(version) # Path Solution @solution = { port_in_request_sid: port_in_request_sid, phone_number_sid: phone_number_sid, } @uri = "/Porting/PortIn/#{@solution[:port_in_request_sid]}/PhoneNumber/#{@solution[:phone_number_sid]}" end ## # Delete the PortingPortInPhoneNumberInstance # @return [Boolean] True if delete succeeds, false otherwise def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end ## # Fetch the PortingPortInPhoneNumberInstance # @return [PortingPortInPhoneNumberInstance] Fetched PortingPortInPhoneNumberInstance def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) PortingPortInPhoneNumberInstance.new( @version, payload, port_in_request_sid: @solution[:port_in_request_sid], phone_number_sid: @solution[:phone_number_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 PortingPortInPhoneNumberPage < Page ## # Initialize the PortingPortInPhoneNumberPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [PortingPortInPhoneNumberPage] PortingPortInPhoneNumberPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of PortingPortInPhoneNumberInstance # @param [Hash] payload Payload response from the API # @return [PortingPortInPhoneNumberInstance] PortingPortInPhoneNumberInstance def get_instance(payload) PortingPortInPhoneNumberInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class PortingPortInPhoneNumberInstance < InstanceResource ## # Initialize the PortingPortInPhoneNumberInstance # @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 PortingPortInPhoneNumber # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [PortingPortInPhoneNumberInstance] PortingPortInPhoneNumberInstance def initialize(version, payload , port_in_request_sid: nil, phone_number_sid: nil) super(version) # Marshaled Properties @properties = { 'port_in_request_sid' => payload['port_in_request_sid'], 'phone_number_sid' => payload['phone_number_sid'], 'url' => payload['url'], 'account_sid' => payload['account_sid'], 'phone_number_type' => payload['phone_number_type'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'country' => payload['country'], 'missing_required_fields' => payload['missing_required_fields'], 'last_updated' => Twilio.deserialize_iso8601_datetime(payload['last_updated']), 'phone_number' => payload['phone_number'], 'portable' => payload['portable'], 'not_portability_reason' => payload['not_portability_reason'], 'not_portability_reason_code' => payload['not_portability_reason_code'] == nil ? payload['not_portability_reason_code'] : payload['not_portability_reason_code'].to_i, 'port_in_phone_number_status' => payload['port_in_phone_number_status'], 'port_out_pin' => payload['port_out_pin'] == nil ? payload['port_out_pin'] : payload['port_out_pin'].to_i, 'rejection_reason' => payload['rejection_reason'], 'rejection_reason_code' => payload['rejection_reason_code'] == nil ? payload['rejection_reason_code'] : payload['rejection_reason_code'].to_i, 'port_date' => Twilio.deserialize_iso8601_datetime(payload['port_date']), } # Context @instance_context = nil @params = { 'port_in_request_sid' => port_in_request_sid || @properties['port_in_request_sid'] ,'phone_number_sid' => phone_number_sid || @properties['phone_number_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 [PortingPortInPhoneNumberContext] CallContext for this CallInstance def context unless @instance_context @instance_context = PortingPortInPhoneNumberContext.new(@version , @params['port_in_request_sid'], @params['phone_number_sid']) end @instance_context end ## # @return [String] The unique identifier for the port in request that this phone number is associated with. def port_in_request_sid @properties['port_in_request_sid'] end ## # @return [String] The unique identifier for this phone number associated with this port in request. def phone_number_sid @properties['phone_number_sid'] end ## # @return [String] URL reference for this resource. def url @properties['url'] end ## # @return [String] Account Sid or subaccount where the phone number(s) will be Ported. def account_sid @properties['account_sid'] end ## # @return [String] The number type of the phone number. This can be: toll-free, local, mobile or unknown. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. def phone_number_type @properties['phone_number_type'] end ## # @return [Time] The timestamp for when this port in phone number was created. def date_created @properties['date_created'] end ## # @return [String] The ISO country code that this number is associated with. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. def country @properties['country'] end ## # @return [Boolean] Indicates if the phone number is missing required fields such as a PIN or account number. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. def missing_required_fields @properties['missing_required_fields'] end ## # @return [Time] Timestamp indicating when the Port In Phone Number resource was last modified. def last_updated @properties['last_updated'] end ## # @return [String] Phone number to be ported. This will be in the E164 Format. def phone_number @properties['phone_number'] end ## # @return [Boolean] If the number is portable by Twilio or not. This field may be null if the number portability has not yet been evaluated. If a number is not portable reference the `not_portability_reason_code` and `not_portability_reason` fields for more details def portable @properties['portable'] end ## # @return [String] The not portability reason code description. This field may be null if the number is portable or if the portability for a number has not yet been evaluated. def not_portability_reason @properties['not_portability_reason'] end ## # @return [String] The not portability reason code. This field may be null if the number is portable or if the portability for a number has not yet been evaluated. def not_portability_reason_code @properties['not_portability_reason_code'] end ## # @return [String] The status of the port in phone number. def port_in_phone_number_status @properties['port_in_phone_number_status'] end ## # @return [String] The pin required by the losing carrier to do the port out. def port_out_pin @properties['port_out_pin'] end ## # @return [String] The description of the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier. def rejection_reason @properties['rejection_reason'] end ## # @return [String] The code for the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier. def rejection_reason_code @properties['rejection_reason_code'] end ## # @return [Time] The timestamp the phone number will be ported. This will only be set once a port date has been confirmed. Not all carriers can guarantee a specific time on the port date. Twilio will try its best to get the port completed by this time on the port date. Please subscribe to webhooks for confirmation on when a port has actually been completed. def port_date @properties['port_date'] end ## # Delete the PortingPortInPhoneNumberInstance # @return [Boolean] True if delete succeeds, false otherwise def delete context.delete end ## # Fetch the PortingPortInPhoneNumberInstance # @return [PortingPortInPhoneNumberInstance] Fetched PortingPortInPhoneNumberInstance 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