Skip to content

Commit f9a634e

Browse files
authored
Add Clabes resources (#305)
* Add clabe resource * version * new version * Update __init__.py * Update version.py * tests * Update version.py * Cambios requeridos * remove sth
1 parent 508f4ab commit f9a634e

File tree

8 files changed

+289
-1
lines changed

8 files changed

+289
-1
lines changed

cuenca/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'CardActivation',
1010
'CardTransaction',
1111
'CardValidation',
12+
'Clabe',
1213
'CurpValidation',
1314
'Commission',
1415
'Deposit',
@@ -51,6 +52,7 @@
5152
CardActivation,
5253
CardTransaction,
5354
CardValidation,
55+
Clabe,
5456
Commission,
5557
CurpValidation,
5658
Deposit,

cuenca/resources/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'CardActivation',
99
'CardTransaction',
1010
'CardValidation',
11+
'Clabe',
1112
'Commission',
1213
'CurpValidation',
1314
'Deposit',
@@ -43,6 +44,7 @@
4344
from .card_transactions import CardTransaction
4445
from .card_validations import CardValidation
4546
from .cards import Card
47+
from .clabes import Clabe
4648
from .commissions import Commission
4749
from .curp_validations import CurpValidation
4850
from .deposits import Deposit
@@ -81,6 +83,7 @@
8183
CardActivation,
8284
CardTransaction,
8385
CardValidation,
86+
Clabe,
8487
CurpValidation,
8588
Commission,
8689
Deposit,

cuenca/resources/clabes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import ClassVar, cast
2+
3+
from cuenca_validations.types import QueryParams
4+
5+
from ..http import Session, session as global_session
6+
from .base import Creatable, Queryable, Retrievable
7+
8+
9+
class Clabe(Creatable, Queryable, Retrievable):
10+
_resource: ClassVar = 'clabes'
11+
_query_params: ClassVar = QueryParams
12+
clabe: str
13+
user_id: str
14+
15+
@classmethod
16+
def create(cls, session: Session = global_session):
17+
return cast('Clabe', cls._create(session=session))

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.13.9'
1+
__version__ = '0.13.10'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.13.10.dev102
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/clabes
19+
response:
20+
body:
21+
string: '{"items":[{"id":"CLD_zg463BQ6-yEjg8UE0jgQ","clabe":"646180157089988558","created_at":"2022-08-23T05:14:11.862000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLas7ZqaT5Quq6fgeiuel6KA","clabe":"646180157030689013","created_at":"2022-08-23T05:11:53.700000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLu4OYMy1USXOY4tGfGNUUsw","clabe":"646180157073856528","created_at":"2022-08-22T23:54:55.634000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLQSvYrsu7Qqm3WuhG0OVrlg","clabe":"646180157032158283","created_at":"2022-08-22T22:44:00.966000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLFyudOfs9Rt-ratC4WXJAoA","clabe":"646180157027880605","created_at":"2022-08-22T22:41:06.071000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"}],"next_page_uri":null,"count":null}'
22+
headers:
23+
Connection:
24+
- keep-alive
25+
Content-Length:
26+
- '1049'
27+
Content-Type:
28+
- application/json
29+
Date:
30+
- Tue, 23 Aug 2022 05:21:51 GMT
31+
X-Request-Time:
32+
- 'value: 0.083'
33+
x-amz-apigw-id:
34+
- XTSNeEoIIAMFoDQ=
35+
x-amzn-Remapped-Connection:
36+
- keep-alive
37+
x-amzn-Remapped-Content-Length:
38+
- '1049'
39+
x-amzn-Remapped-Date:
40+
- Tue, 23 Aug 2022 05:21:51 GMT
41+
x-amzn-Remapped-Server:
42+
- nginx/1.22.0
43+
x-amzn-RequestId:
44+
- 6f394c5e-b5ff-44fa-9733-3cfb9b965360
45+
status:
46+
code: 200
47+
message: OK
48+
- request:
49+
body: null
50+
headers:
51+
Accept:
52+
- '*/*'
53+
Accept-Encoding:
54+
- gzip, deflate
55+
Authorization:
56+
- DUMMY
57+
Connection:
58+
- keep-alive
59+
User-Agent:
60+
- cuenca-python/0.13.10.dev102
61+
X-Cuenca-Api-Version:
62+
- '2020-03-19'
63+
method: GET
64+
uri: https://sandbox.cuenca.com/clabes?count=1
65+
response:
66+
body:
67+
string: '{"items":[],"next_page_uri":null,"count":5,}}}'
68+
headers:
69+
Connection:
70+
- keep-alive
71+
Content-Length:
72+
- '337'
73+
Content-Type:
74+
- application/json
75+
Date:
76+
- Tue, 23 Aug 2022 05:22:45 GMT
77+
X-Request-Time:
78+
- 'value: 0.067'
79+
x-amz-apigw-id:
80+
- XTSV2FbBoAMFgYA=
81+
x-amzn-Remapped-Connection:
82+
- keep-alive
83+
x-amzn-Remapped-Content-Length:
84+
- '337'
85+
x-amzn-Remapped-Date:
86+
- Tue, 23 Aug 2022 05:22:45 GMT
87+
x-amzn-Remapped-Server:
88+
- nginx/1.22.0
89+
x-amzn-RequestId:
90+
- 91aa3a7f-6d68-44b4-85fb-4192dc51276e
91+
status:
92+
code: 200
93+
message: OK
94+
- request:
95+
body: null
96+
headers:
97+
Accept:
98+
- '*/*'
99+
Accept-Encoding:
100+
- gzip, deflate
101+
Authorization:
102+
- DUMMY
103+
Connection:
104+
- keep-alive
105+
User-Agent:
106+
- cuenca-python/0.13.10.dev102
107+
X-Cuenca-Api-Version:
108+
- '2020-03-19'
109+
method: GET
110+
uri: https://sandbox.cuenca.com/clabes
111+
response:
112+
body:
113+
string: '{"items":[{"id":"CLD_zg463BQ6-yEjg8UE0jgQ","clabe":"646180157089988558","created_at":"2022-08-23T05:14:11.862000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLas7ZqaT5Quq6fgeiuel6KA","clabe":"646180157030689013","created_at":"2022-08-23T05:11:53.700000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLu4OYMy1USXOY4tGfGNUUsw","clabe":"646180157073856528","created_at":"2022-08-22T23:54:55.634000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLQSvYrsu7Qqm3WuhG0OVrlg","clabe":"646180157032158283","created_at":"2022-08-22T22:44:00.966000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"},{"id":"CLFyudOfs9Rt-ratC4WXJAoA","clabe":"646180157027880605","created_at":"2022-08-22T22:41:06.071000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"}],"next_page_uri":null,"count":null}'
114+
headers:
115+
Connection:
116+
- keep-alive
117+
Content-Length:
118+
- '1049'
119+
Content-Type:
120+
- application/json
121+
Date:
122+
- Tue, 23 Aug 2022 05:23:36 GMT
123+
X-Request-Time:
124+
- 'value: 0.070'
125+
x-amz-apigw-id:
126+
- XTSd5EarIAMF42A=
127+
x-amzn-Remapped-Connection:
128+
- keep-alive
129+
x-amzn-Remapped-Content-Length:
130+
- '1049'
131+
x-amzn-Remapped-Date:
132+
- Tue, 23 Aug 2022 05:23:36 GMT
133+
x-amzn-Remapped-Server:
134+
- nginx/1.22.0
135+
x-amzn-RequestId:
136+
- 21c1a41f-857a-4d6f-8ceb-944b4dfa5ffc
137+
status:
138+
code: 200
139+
message: OK
140+
version: 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
interactions:
2+
- request:
3+
body: '{}'
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
Content-Length:
14+
- '2'
15+
Content-Type:
16+
- application/json
17+
User-Agent:
18+
- cuenca-python/0.13.10.dev102
19+
X-Cuenca-Api-Version:
20+
- '2020-03-19'
21+
method: POST
22+
uri: https://sandbox.cuenca.com/clabes
23+
response:
24+
body:
25+
string: '{"id":"CLD_zg463BQ6-yEjg8UE0jgQ","clabe":"646180157089988558","user_id":"USbDnHlZYDShGoTS2NTD-Lmg","created_at":"2022-08-23T05:14:11.862507"}'
26+
headers:
27+
Connection:
28+
- keep-alive
29+
Content-Length:
30+
- '141'
31+
Content-Type:
32+
- application/json
33+
Date:
34+
- Tue, 23 Aug 2022 05:14:11 GMT
35+
X-Request-Time:
36+
- 'value: 0.200'
37+
x-amz-apigw-id:
38+
- XTRFmFanoAMFeOA=
39+
x-amzn-Remapped-Connection:
40+
- keep-alive
41+
x-amzn-Remapped-Content-Length:
42+
- '141'
43+
x-amzn-Remapped-Date:
44+
- Tue, 23 Aug 2022 05:14:11 GMT
45+
x-amzn-Remapped-Server:
46+
- nginx/1.22.0
47+
x-amzn-RequestId:
48+
- 8dce4dbf-eea9-4179-848c-74af94b67c99
49+
status:
50+
code: 201
51+
message: Created
52+
version: 1
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.13.10.dev102
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/clabes/CLD_zg463BQ6-yEjg8UE0jgQ
19+
response:
20+
body:
21+
string: '{"id":"CLD_zg463BQ6-yEjg8UE0jgQ","clabe":"646180157089988558","created_at":"2022-08-23T05:14:11.862000","user_id":"USbDnHlZYDShGoTS2NTD-Lmg"}'
22+
headers:
23+
Connection:
24+
- keep-alive
25+
Content-Length:
26+
- '141'
27+
Content-Type:
28+
- application/json
29+
Date:
30+
- Tue, 23 Aug 2022 05:16:07 GMT
31+
X-Request-Time:
32+
- 'value: 0.080'
33+
x-amz-apigw-id:
34+
- XTRXwGRHoAMFvag=
35+
x-amzn-Remapped-Connection:
36+
- keep-alive
37+
x-amzn-Remapped-Content-Length:
38+
- '141'
39+
x-amzn-Remapped-Date:
40+
- Tue, 23 Aug 2022 05:16:07 GMT
41+
x-amzn-Remapped-Server:
42+
- nginx/1.22.0
43+
x-amzn-RequestId:
44+
- 4d2bfa10-eff8-45c0-ae23-ac20afa45bd9
45+
status:
46+
code: 200
47+
message: OK
48+
version: 1

tests/resources/test_clabes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import pytest
2+
3+
from cuenca import Clabe
4+
5+
6+
@pytest.mark.vcr
7+
def test_clabe_create():
8+
clabe = Clabe.create()
9+
assert clabe
10+
assert clabe.id
11+
assert clabe.clabe
12+
13+
14+
@pytest.mark.vcr
15+
def test_clabe_retrieve():
16+
clabe_id = 'CLD_zg463BQ6-yEjg8UE0jgQ'
17+
clabe = Clabe.retrieve(clabe_id)
18+
assert clabe
19+
assert clabe.id == clabe_id
20+
assert clabe.clabe
21+
22+
23+
@pytest.mark.vcr
24+
def test_clabe_all():
25+
clabes = list(Clabe.all())
26+
assert clabes

0 commit comments

Comments
 (0)