Repository: piotrmaslanka/falcon-ratelimit

Issue:
falcon-ratelimit 1.1 is broken with falcon 2.0.0
FYI, looks like `falcon-ratelimit==1.1` is broken with the latest version of falcon, which is `falcon==2.0.0`

```
❯ gunicorn hello.app:api
[2019-05-24 14:10:19 -0300] [16138] [INFO] Starting gunicorn 19.9.0
[2019-05-24 14:10:19 -0300] [16138] [INFO] Listening at: http://127.0.0.1:8000 (16138)
[2019-05-24 14:10:19 -0300] [16138] [INFO] Using worker: sync
[2019-05-24 14:10:19 -0300] [16141] [INFO] Booting worker with pid: 16141
[2019-05-24 14:10:22 -0300] [16141] [ERROR] Error handling request /ping
Traceback (most recent call last):
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "falcon/api.py", line 274, in falcon.api.API.__call__
  File "falcon/api.py", line 269, in falcon.api.API.__call__
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/falcon/hooks.py", line 179, in do_before
    action(req, resp, self, kwargs, *action_args, **action_kwargs)
TypeError: hook() takes 3 positional arguments but 4 were given
```

Code sample to reproduce:

```
import falcon
from falconratelimit import rate_limit


class PingResource(object):
    @falcon.before(rate_limit(per_second=5, window_size=30))
    def on_get(self, req, resp) -> None:
        resp.media = {"test": "hello"}


api = falcon.API()
api.add_route("/ping", PingResource())
```

Testing the endpoint

```
❯ http GET :8000/ping
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 141
Content-Type: text/html

<html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>

  </body>
</html>
```

This same example works fine with falcon 1.4.1. 

Thanks!

Comments:

Patch:
diff --git a/.travis.yml b/.travis.yml
index 6aeb9d4..f6c244e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,15 @@
 language: python
 python:
- - "2.7"
  - "3.5"
  - "3.4"
  - "pypy"
 cache: pip
+services:
+ - redis-server
 install:
  - pip install -r requirements.txt
  - pip install --force-reinstall "coverage>=4.0,<4.4" codeclimate-test-reporter
 script:
- - sudo redis-server /etc/redis/redis.conf --port 6379
  - python setup.py nosetests --with-coverage
 after_success:
  - codeclimate-test-reporter
diff --git a/falconratelimit/ratelimit.py b/falconratelimit/ratelimit.py
index 6e8641d..c912a39 100644
--- a/falconratelimit/ratelimit.py
+++ b/falconratelimit/ratelimit.py
@@ -89,7 +89,7 @@ def rate_limit(per_second=30, resource=u'default', window_size=10,
                redis_url=None):
     arg = Argument(resource, window_size, per_second, error_message, redis_url)
 
-    def hook(req, resp, params):
+    def hook(req, resp, resource, params):
         if redis_url:
             try:
                 redis


Test patch:
diff --git a/tests/test_ratelimit.py b/tests/test_ratelimit.py
index fda9683..b2f2078 100644
--- a/tests/test_ratelimit.py
+++ b/tests/test_ratelimit.py
@@ -23,7 +23,7 @@ import redis
 
 class RedisResource(object):
     @falcon.before(
-        rate_limit(redis_url='localhost:6379', per_second=1, window_size=5,
+        rate_limit(redis_url='redis://localhost:6379/0', per_second=1, window_size=5,
                    resource='on_get'))
     def on_get(self, req, resp):
         resp.status = falcon.HTTP_200