def normalize_gateways(gateways_config)
      gateways_config.each_with_object(map: {}, gateways: {}) do |(name, spec), hash|
        identifier, *args = Array(spec)

        if identifier.is_a?(Gateway)
          gateway = identifier
        else
          gateway = Gateway.setup(identifier, *args.flatten)
        end

        hash[:map][gateway] = name
        hash[:gateways][name] = gateway
      end
    end
def normalize_gateways(gateways_config)
      gateways_config.each_with_object(map: {}, gateways: {}) do |(name, spec), hash|
        identifier, *args = Array(spec)

        if identifier.is_a?(Gateway)
          gateway = identifier
        else
          gateway = Gateway.setup(identifier, *args.flatten)
        end

        hash[:map][gateway] = name
        hash[:gateways][name] = gateway
      end
    end
Build gateways using the setup interface

 @api private