Skip to content

Instantly share code, notes, and snippets.

@kevindavis
Created January 24, 2015 00:08
Show Gist options
  • Save kevindavis/131c6c4cd849c9669814 to your computer and use it in GitHub Desktop.
Save kevindavis/131c6c4cd849c9669814 to your computer and use it in GitHub Desktop.
Results from a Mode report
def results_for_report(report_token)
report = HTTParty.get('https://modeanalytics.com/api/Kitchenbowl/reports/'+report_token+'?embed%5Breport_runs%5D=1', @auth)
last_run_token = report['_embedded']['report_runs']['_embedded']['report_runs'][0]['token']
results_url = HTTParty.get('https://modeanalytics.com/api/Kitchenbowl/reports/'+report_token+'/runs/'+last_run_token+'/results', @auth)['_links']['json']['href']
JSON.parse(HTTParty.get(results_url))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment