Add flatten_response capabilities to make working with the Omniture API Responses Easier#6
Open
RobGoretsky wants to merge 4 commits into
Open
Add flatten_response capabilities to make working with the Omniture API Responses Easier#6RobGoretsky wants to merge 4 commits into
RobGoretsky wants to merge 4 commits into
Conversation
…PI response reports much easiser
Owner
|
Will try to review these changes in the next week or so @RobGoretsky, thanks for the contributions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the more time-consuming parts of working with Omniture's API has been working with the hierarchical, deeply-nested responses that the API provides for Trended reports. For example, if you request a report with two elements (say, 'browser' and 'page') plus the date, Omniture returns a tree-like response that may first have the browser, then all of the pages broken down underneath that, and then all of the dates broken down underneath that.
This commit contains something I have found to be very helpful - it basically flattens/denormalizes the response so you always end up with just a simple array of hashes. So for the example above you'd end up with something like the following:
To invoke this flattening capability, just call it like this:
I have included a set of Unit Tests for this functionality as well that confirm that it works with Trended reports for 1 or 2 elements, and for Overtime reports (with 0 elements)