Trying to get query results from Google Analytics using Legato gem (following a previous recommendation I go there + some research). Seems to be simple to define my query, however I fail to understand how to actually get the results. Reading the readme shows how to build some "building blocks", but I fail to get an object where I can read the results from.
Maybe I missed something, and the query results should be written directly to the model (DB), which is not what I want (I wanted to go over them first). Maybe that's the reason I'm not seeing anything.
So can someone please share an example how to read the results? For example, just print the pageviews to the screen.
Thanks
So here's the way I've found to use it: You create a class that defines the "model" of your query (and like Active-Model returning relations, you can also concatenate here). In this example:
Also note that the filter & result just return a "query" (just like ActiveModel::Relation), where the execution is done by invoking something on it, like 'each' or 'to_a', etc.
Once this is ready, you can do something like:
Lastly, I recommand that you first explore with Google Analytics Query Explorer.
I hope you can find this example helpful