Repository: cuenca-mx/cuenca-python

Issue:
Change next_page_url to _uri
The parameter for the next page should be `next_page_uri` (not `_url`) for consistency

Discussion:

Patch:
diff --git a/cuenca/resources/base.py b/cuenca/resources/base.py
index 612d148..b712d0b 100644
--- a/cuenca/resources/base.py
+++ b/cuenca/resources/base.py
@@ -102,11 +102,11 @@ class Queryable(Resource):
     @classmethod
     def all(cls, **query_params) -> Generator[Resource, None, None]:
         q = cls._query_params(**query_params)
-        next_page_url = f'{cls._resource}?{urlencode(q.dict())}'
-        while next_page_url:
-            page = session.get(next_page_url)
+        next_page_uri = f'{cls._resource}?{urlencode(q.dict())}'
+        while next_page_uri:
+            page = session.get(next_page_uri)
             yield from (cls._from_dict(item) for item in page['items'])
-            next_page_url = page['next_page_url']
+            next_page_uri = page['next_page_uri']
 
 
 @dataclass
diff --git a/cuenca/version.py b/cuenca/version.py
index f2397c6..f5fbf89 100644
--- a/cuenca/version.py
+++ b/cuenca/version.py
@@ -1,3 +1,3 @@
-__version__ = '0.2.4'
+__version__ = '0.2.5'
 CLIENT_VERSION = __version__
 API_VERSION = '2020-03-19'


Test patch:
diff --git a/tests/resources/cassettes/test_transfers_all.yaml b/tests/resources/cassettes/test_transfers_all.yaml
index 22c9e69..ed0ed7c 100644
--- a/tests/resources/cassettes/test_transfers_all.yaml
+++ b/tests/resources/cassettes/test_transfers_all.yaml
@@ -22,7 +22,7 @@ interactions:
         primer transferencia","idempotency_key":"my_custom_id","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TR41ohSc7ET4a6XNJlTQwO-g==","created_at":"2020-05-09T03:43:59.029000","updated_at":"2020-05-09T03:43:59.924000","account_number":"646180157034181180","recipient_name":"cuenca user","amount":10000,"descriptor":"Mi
         primer transferencia","idempotency_key":"my_unique_id","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRbunDZEb9Q9CpFQGqZlVzQA==","created_at":"2020-05-09T03:41:12.048000","updated_at":"2020-05-09T03:41:15.932000","account_number":"646180157034181180","recipient_name":"cuenca user","amount":10000,"descriptor":"Mi
         primer transferencia","idempotency_key":"2020-05-09:646180157034181180:10000","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRXrre-cmATVag5-eGrpczeQ==","created_at":"2020-05-08T23:19:34.541000","updated_at":"2020-05-08T23:19:35.873000","account_number":"646180157034181180","recipient_name":"cuenca user","amount":10000,"descriptor":"Transferencia
-        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?created_before=2020-05-08T23%3A19%3A34.541000&status=succeeded&count=False"}'
+        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?created_before=2020-05-08T23%3A19%3A34.541000&status=succeeded&count=False"}'
     headers:
       Connection:
       - keep-alive
@@ -68,7 +68,7 @@ interactions:
     uri: https://sandbox.cuenca.com/transfers?created_before=2020-05-08T23%3A19%3A34.541000&status=succeeded&count=False
   response:
     body:
-      string: '{"items":[],"next_page_url":null}'
+      string: '{"items":[],"next_page_uri":null}'
     headers:
       Connection:
       - keep-alive
diff --git a/tests/resources/cassettes/test_transfers_count_vs_all.yaml b/tests/resources/cassettes/test_transfers_count_vs_all.yaml
index 7b4769c..db9ea5b 100644
--- a/tests/resources/cassettes/test_transfers_count_vs_all.yaml
+++ b/tests/resources/cassettes/test_transfers_count_vs_all.yaml
@@ -66,7 +66,7 @@ interactions:
     body:
       string: '{"items":[{"id":"TRhKxyL1lhQvSiMx7whOpEJA==","created_at":"2020-05-19T19:34:31.400000","updated_at":"2020-05-19T19:34:34.985000","account_number":"646180157034181180","recipient_name":"Rogelio","amount":10000,"descriptor":"Transferencia
         Demo","idempotency_key":"key_roger_2","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRRAnqEwwRRZWVgwbDjtAGeA==","created_at":"2020-05-19T19:07:10.018000","updated_at":"2020-05-19T19:07:14.234000","account_number":"646180157034181180","recipient_name":"Rogelio","amount":10000,"descriptor":"Transferencia
-        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000&status=succeeded"}'
+        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000&status=succeeded"}'
     headers:
       Connection:
       - keep-alive
@@ -112,7 +112,7 @@ interactions:
     uri: https://sandbox.cuenca.com/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000&status=succeeded
   response:
     body:
-      string: '{"items":[],"next_page_url":null}'
+      string: '{"items":[],"next_page_uri":null}'
     headers:
       Connection:
       - keep-alive
@@ -304,7 +304,7 @@ interactions:
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"e42f05f230bc47268df1e1af9b97540c","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRt0SsyO8pTL-wa36jIBIOTg==","created_at":"2020-05-19T22:50:44.079000","updated_at":"2020-05-19T22:50:45.415000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"33d0173d73a2413e9508facbfdb8c6fe","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TR4g7qLeDKSyOmXW-igaibLA==","created_at":"2020-05-19T22:50:43.399000","updated_at":"2020-05-19T22:50:44.456000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"c8b7950fd4bc43a8a1ab2bbb3ead8c72","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRoNVh2TR7S2WVs8pc8wDChg==","created_at":"2020-05-19T22:50:42.916000","updated_at":"2020-05-19T22:50:45.701000","account_number":"646180157042875763","recipient_name":"Benito
-        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"ce27f69f47994c9fa2930ca04de84acb","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?limit=100&created_before=2020-05-19T22%3A50%3A42.916000"}'
+        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"ce27f69f47994c9fa2930ca04de84acb","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?limit=100&created_before=2020-05-19T22%3A50%3A42.916000"}'
     headers:
       Connection:
       - keep-alive
@@ -450,7 +450,7 @@ interactions:
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"49f6466f8cd1420e9fe1105fe993bdf5","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRIDuLDDRHQY27gRpqTfeZbg==","created_at":"2020-05-19T22:27:11.611000","updated_at":"2020-05-19T22:27:13.654000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"dc42b8084fd34564b576691a60f0538c","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRGXPypqZhRRCkw_IOzeGpdA==","created_at":"2020-05-19T22:27:11.129000","updated_at":"2020-05-19T22:27:13.543000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"a41d41ee7d92404dab3fe13e074af657","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRa1Mvq7UYT2eJbopSTGfPRA==","created_at":"2020-05-19T22:27:10.669000","updated_at":"2020-05-19T22:27:13.584000","account_number":"646180157042875763","recipient_name":"Benito
-        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"285c7d3440dd43e9ad7acc4dd9d90f0d","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?limit=100&created_before=2020-05-19T22%3A27%3A10.669000"}'
+        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"285c7d3440dd43e9ad7acc4dd9d90f0d","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?limit=100&created_before=2020-05-19T22%3A27%3A10.669000"}'
     headers:
       Connection:
       - keep-alive
@@ -596,7 +596,7 @@ interactions:
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"6cc3ac27937b4cc8aad848fecc016635","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRbD353LHZSbW4pmZJovNqwA==","created_at":"2020-05-19T22:00:10.296000","updated_at":"2020-05-19T22:00:11.212000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"2262dfaf7b494b13bea62edd2aba05b8","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRJcILfqJLRDGGEgUf2Bp4Sw==","created_at":"2020-05-19T22:00:09.716000","updated_at":"2020-05-19T22:00:12.218000","account_number":"646180157042875763","recipient_name":"Benito
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"d9e30a354aa240f7b05443baf9096cb5","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRjTIMlZ52ROec2nIA4PqefA==","created_at":"2020-05-19T22:00:09.216000","updated_at":"2020-05-19T22:00:10.241000","account_number":"646180157042875763","recipient_name":"Benito
-        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"e1fda51348d041909b48fbdb33bb7974","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?limit=100&created_before=2020-05-19T22%3A00%3A09.216000"}'
+        Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"e1fda51348d041909b48fbdb33bb7974","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?limit=100&created_before=2020-05-19T22%3A00%3A09.216000"}'
     headers:
       Connection:
       - keep-alive
@@ -648,7 +648,7 @@ interactions:
         Ju\u00e1rez","amount":12345,"descriptor":"sending money","idempotency_key":"cf0c854c318a4b5b95c6af867c5376cf","status":"failed","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRqCCl4tyBQnSyR8YvP1Og6A==","created_at":"2020-05-19T19:34:36.343000","updated_at":"2020-05-19T19:35:37.286000","account_number":"646180157034181180","recipient_name":"Rogelio","amount":10000,"descriptor":"Transferencia
         Demo","idempotency_key":"key_roger_1","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRhKxyL1lhQvSiMx7whOpEJA==","created_at":"2020-05-19T19:34:31.400000","updated_at":"2020-05-19T19:34:34.985000","account_number":"646180157034181180","recipient_name":"Rogelio","amount":10000,"descriptor":"Transferencia
         Demo","idempotency_key":"key_roger_2","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRRAnqEwwRRZWVgwbDjtAGeA==","created_at":"2020-05-19T19:07:10.018000","updated_at":"2020-05-19T19:07:14.234000","account_number":"646180157034181180","recipient_name":"Rogelio","amount":10000,"descriptor":"Transferencia
-        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000"}'
+        Demo","idempotency_key":"key_roger_3","status":"succeeded","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000"}'
     headers:
       Connection:
       - keep-alive
@@ -694,7 +694,7 @@ interactions:
     uri: https://sandbox.cuenca.com/transfers?limit=100&created_before=2020-05-19T19%3A07%3A10.018000
   response:
     body:
-      string: '{"items":[],"next_page_url":null}'
+      string: '{"items":[],"next_page_uri":null}'
     headers:
       Connection:
       - keep-alive
diff --git a/tests/resources/cassettes/test_transfers_first.yaml b/tests/resources/cassettes/test_transfers_first.yaml
index 0ff021f..84fe6ef 100644
--- a/tests/resources/cassettes/test_transfers_first.yaml
+++ b/tests/resources/cassettes/test_transfers_first.yaml
@@ -19,7 +19,7 @@ interactions:
   response:
     body:
       string: '{"items":[{"id":"TRGtslEptDT0-_cVVLmXojBg==","created_at":"2020-05-08T23:12:25.042000","updated_at":"2020-05-08T23:12:28.854000","account_number":"646180157013244941","recipient_name":"test
-        85d91ea6-76b6-49ab-913b-0481e8df7379","amount":8888,"descriptor":"lambda","idempotency_key":"b2bf01cb-da5f-4a42-9462-23078b81b6ea","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?account_number=646180157013244941&created_before=2020-05-08T23%3A12%3A25.042000&limit=1&count=False"}'
+        85d91ea6-76b6-49ab-913b-0481e8df7379","amount":8888,"descriptor":"lambda","idempotency_key":"b2bf01cb-da5f-4a42-9462-23078b81b6ea","status":"failed","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?account_number=646180157013244941&created_before=2020-05-08T23%3A12%3A25.042000&limit=1&count=False"}'
     headers:
       Connection:
       - keep-alive
@@ -65,7 +65,7 @@ interactions:
     uri: https://sandbox.cuenca.com/transfers?account_number=bad_account&limit=1
   response:
     body:
-      string: '{"items":[],"next_page_url":null}'
+      string: '{"items":[],"next_page_uri":null}'
     headers:
       Connection:
       - keep-alive
diff --git a/tests/resources/cassettes/test_transfers_one.yaml b/tests/resources/cassettes/test_transfers_one.yaml
index 988adab..7f678a5 100644
--- a/tests/resources/cassettes/test_transfers_one.yaml
+++ b/tests/resources/cassettes/test_transfers_one.yaml
@@ -19,7 +19,7 @@ interactions:
   response:
     body:
       string: '{"items":[{"id":"TR6sozlFsTQsGxzwQfWm5N_g==","created_at":"2020-05-07T17:01:30.774000","updated_at":"2020-05-07T17:01:30.794000","account_number":"646180157034181180","recipient_name":"test","amount":10000,"descriptor":"Transferencia
-        Demo","idempotency_key":"idempotency_key_1","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?idempotency_key=idempotency_key_1&created_before=2020-05-07T17%3A01%3A30.774000&limit=2&count=False"}'
+        Demo","idempotency_key":"idempotency_key_1","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?idempotency_key=idempotency_key_1&created_before=2020-05-07T17%3A01%3A30.774000&limit=2&count=False"}'
     headers:
       Connection:
       - keep-alive
diff --git a/tests/resources/cassettes/test_transfers_one_errors.yaml b/tests/resources/cassettes/test_transfers_one_errors.yaml
index caf8f95..a7d593a 100644
--- a/tests/resources/cassettes/test_transfers_one_errors.yaml
+++ b/tests/resources/cassettes/test_transfers_one_errors.yaml
@@ -18,7 +18,7 @@ interactions:
     uri: https://sandbox.cuenca.com/transfers?idempotency_key=wrong_key&limit=2
   response:
     body:
-      string: '{"items":[],"next_page_url":null}'
+      string: '{"items":[],"next_page_uri":null}'
     headers:
       Connection:
       - keep-alive
@@ -66,7 +66,7 @@ interactions:
     body:
       string: '{"items":[{"id":"TRIeJD25AJTCaaqd5mvSz-hA==","created_at":"2020-05-08T22:48:19.624000","updated_at":"2020-05-08T22:48:19.643000","account_number":"646180157013244941","recipient_name":"test
         ec941f79-0c0f-4c1a-9648-4ca221103b9b","amount":8888,"descriptor":"lambda","idempotency_key":"ee3d8fbb-e2b6-4c81-94ea-b4ff240a2913","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null},{"id":"TRo4iQvJD5TreE51v3_cVLlA==","created_at":"2020-05-08T19:53:29.917000","updated_at":"2020-05-08T19:53:29.937000","account_number":"646180157013244941","recipient_name":"pach
-        31fe4f55-b7c8-49a5-bec4-460e62b94cf9","amount":8888,"descriptor":"lambda","idempotency_key":"972a5034-91de-4fb8-99a2-9733afc4065b","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_url":"/transfers?created_before=2020-05-08T19%3A53%3A29.917000&status=pending&limit=2&count=False"}'
+        31fe4f55-b7c8-49a5-bec4-460e62b94cf9","amount":8888,"descriptor":"lambda","idempotency_key":"972a5034-91de-4fb8-99a2-9733afc4065b","status":"submitted","network":"internal","destination_uri":null,"tracking_key":null}],"next_page_uri":"/transfers?created_before=2020-05-08T19%3A53%3A29.917000&status=pending&limit=2&count=False"}'
     headers:
       Connection:
       - keep-alive