ets-berkeley-edu/eggshell — pull request #21 by yuhunglin (2012-11-02 12:22:20+00:00)
Title: [CLC-508] Initial mockup of api features for Sinatra

JIRA: https://jira.media.berkeley.edu/jira/browse/CLC-508 (copied notes below)

Pull Request details:
- All endpoints /api/canvas/* - are routed through to the sinatra endpoint for canvas. Sadly though, it doesn't route api/canvas (which is probably fine).
- /api/canvas/hello - is a braindead json response, no authentication required.
- /api/canvas/* - Should route to the "catch-all" response, which will spit back the * params, wrapped inside another dummy json element. No authentication required
- /api/canvas/protected - Is a test of using sinatra filters to check for valid session variables (session[user_id] is set when someone logs in with OmniAuth). It should fail spectacularly on the command line curl commands (returns nothing for me) when unauthenticated. Hitting the url in the browser while unauthenticated should redirect you the login landing for the site ('/login' takes you to omniauth-cas). Hitting the url in the browser, after authentication should get you a response similar to the /api/canvas/* response.
- Last one: /api/canvas/mycourses - Throws in a new gem RestClient that will execute the proxy requests out to canvas. In this instance, I'm targeting a fixed url https://ucberkeley.instructure.com/api/v1/courses. I'm revisiting history in using the old "manually generated auth token from canvas" and stuffing that in the header. The url slice & auth token are pulled out of the settings files, like the old properties files (be sure to set your local version of them). The response then gets returned directly back to the user (like a typical pass-through proxy).