self.normalize

in lib/facebook_ads/ad_objects/server_side/util.rb [53:107]


            def self.normalize(input, field_type)

                if input.nil? or field_type.nil?
                    return nil;
                end

                input = input.strip.downcase

                
                if is_already_hashed?(input) == true
                    return input
                end

                normalized_input = input;

                case field_type
                when 'action_source'
                    return normalize_action_source input
                when 'country'
                    normalized_input = normalize_country input
                when 'ct'
                    normalized_input = normalize_city input
                when 'currency'
                    return normalize_currency input
                when 'delivery_category'
                    return normalize_delivery_category input
                when 'em'
                    normalized_input = normalize_email input
                when 'ge'
                    normalized_input = normalize_gender input
                when 'ph'
                    normalized_input = normalize_phone input
                when 'st'
                    normalized_input = normalize_state input
                when 'zp'
                    normalized_input = normalize_zip input
                when 'f5first'
                    normalized_input = normalize_f5 input
                when 'f5last'
                    normalized_input = normalize_f5 input
                when 'fi'
                    normalized_input = normalize_fi input
                when 'dobd'
                    normalized_input = normalize_dobd input
                when 'dobm'
                    normalized_input = normalize_dobm input
                when 'doby'
                    normalized_input = normalize_doby input
                end

                normalized_input = sha256Hash normalized_input

                return normalized_input
            end