imightbeamy/buzzerbot9000 — pull request #2 by niftynei (2014-10-20 02:16:08+00:00)
Title: Adds Google Api logic

This is a rough crack at adding Google Address validation. I had a lot of trouble getting `npm` packages to install, so I wasn't able to test it out as much as I would have liked to, but hopefully it gets this moving forward. The Google API stuff works ok, but I couldn't get my attempt at making a Prototype working. Either something's wrong with the syntax or the package manager was having trouble with loading `underscore.`

You'll need a file called `secrets` with the API key saved in the same directory as the `google_request.js` file to make it work. I'll send it to you via email. (It's set to be ignored by `.gitignore` so it doesn't get checked in by accident).

Also, the sqlite3 code is untested -- I couldn't get the module to load on either my macbook or raspi.

If you enter in an address that has multiple options, we'd need to be able to save those options, and give you the choice to select which one you meant.

When a number texts in an answer, you first would query the database to find if a record existed for it. If it's not in the database yet, then we'd fetch the results for the message using the `GoogleAddressApi` class thing.

If there's one entry for your query, we save that in the database as the `answer` and let you in.

If there's more than one entry for the query, we'd present them with a list of numbered options, and also save the options as an array in `options`. Once they texted back, we'd be able to look them up in the database, see that there's already an entry for them, and then pick the correct option out to echo back. (and save it to the answers column).

Sorry I suck so hard at package management, there's still a decent amount left to do on the database portion. I'll email you the secrets file, and hopefully we can take a look at it sometime this week.