The Kissmetrics Ruby Sample Code by Kissmetrics demonstrates how to access the API. Usage shows building the AST from a SQL statement, outputting the expression as SQL, and drilling down into the WHERE clause, to examine every piece.