codeforamerica / wand

Let's make wizards!
MIT License
6 stars 4 forks source link

API preprocessor #36

Closed ErnieAtLYD closed 9 years ago

ErnieAtLYD commented 9 years ago

Don't merge this just yet!

After some pair programming with @bsmithgall we started work on the idea of an API preprocessor.

Why: for Miami's STEP wizard, @phiden uses a first API to convert an address to latitude longitude pairs. We take those pairs and feed it into a second API which will return whether or not the address is in unincorporated Miami-Dade County, and redirect down particular paths or expose nodes if necessary.

  {
    "id":0,
    "title": "The county check!",
    "content": "Enter your address in Miami:",
    "type": "api",
    "triggers": [
      {
        "content": "submit",
        "api": "http://still-eyrie-4551.herokuapp.com/areas",
        "preprocessor": "nested.preprocessor",
        "callbackFn": "nested.handleYesNoApi",
        "jsonp": true
      }
    ]
  }

http://localhost:4000/examples/api.html

Some additional work that needs to be done:

bsmithgall commented 9 years ago

Closing so that this can be re-opened against the proper branch.