Skip to content

Commit 9b59477

Browse files
committed
edited the docs and class initializer
1 parent c832fa8 commit 9b59477

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ pip install pythepeer
1414
```
1515

1616
## Usage
17-
Instantiate the ThePeerInit class like so:
17+
Instantiate the ThepeerInit class like so:
1818
```python
1919
import thepeer
20-
from thepeer.main import ThePeerInit
20+
from thepeer.main import ThepeerInit
2121

2222
# create an instance of ThePeerInit class
2323

24-
thepeer_instance = ThePeerInit("YOUR_API_KEY_HERE")
24+
thepeer_instance = ThepeerInit("YOUR_API_KEY_HERE")
2525

2626
```
2727

@@ -30,7 +30,7 @@ thepeer_instance = ThePeerInit("YOUR_API_KEY_HERE")
3030
**Note:**
3131
- For More info about the exposed methods, please refer to the general [documentation](https://docs.thepeer.co/)
3232
- Be sure to keep your API Credentials securely in [environment variables](https://www.twilio.com/blog/environment-variables-python)
33-
#### ```Indexing A User```
33+
### Indexing A User
3434
This describes how to index a user on your account (this is usually the first step before using other methods)
3535

3636
```python
@@ -41,11 +41,11 @@ test = thepeer_instance.index_user("Osagie Iyayi", "[email protected]", "
4141

4242
| Parameters | Data Type | Required | Description |
4343
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
44-
| name | string | true | The name of user to be indexed.
45-
| identifier | string | true | the identifier of the account(either email or username).
46-
| email | string | true | the email of the user |
44+
| ```name``` | ```string``` | ```true``` | ```The name of user to be indexed```.
45+
| ```identifier``` | ```string``` | ```true``` | ```the identifier of the account(either email or username).```
46+
| ```email``` | ```string``` | ```true``` | ```the email of the user``` |
4747

48-
#### ```Validating a HMAC signature```
48+
### Validating a HMAC signature
4949
This method validates incoming an [hmac](https://www.okta.com/identity-101/hmac/) signature with the payload and credentials that was passed with it
5050

5151
**Pro Tip:** it is used to verify that an incoming webhook event/response is coming from thepeer's servers
@@ -57,10 +57,10 @@ test = thepeer_instance.validate_signature(data,signature)
5757

5858
| Parameters | Data Type | Required | Description |
5959
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
60-
| data | dictionary | true | the payload containing the data to be authenticated
61-
| signature | string | true | The HMAC signature |
60+
| ```data``` | ```dictionary``` | ```true``` | ```the payload containing the data to be authenticated```
61+
| ```signature``` | ```string``` | ```true``` | ```The HMAC signature``` |
6262

63-
#### ```Get an Indexed User```
63+
### Get an Indexed User
6464
This method gets the information of an indexed user
6565

6666
```python
@@ -72,9 +72,9 @@ test = thepeer_instance.view_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")
7272

7373
| Parameters | Data Type | Required | Description |
7474
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75-
| reference | string | true | the unique reference returned when the user was indexed
75+
| ```reference``` | ```string``` | ```true``` | ```the unique reference returned when the user was indexed```
7676

77-
#### ```Get All Indexed Users```
77+
### Get All Indexed Users
7878
This method returns all indexed users for a specific account
7979

8080
```python
@@ -85,11 +85,11 @@ test = thepeer_instance.all_users(1,15)
8585

8686
| Parameters | Data Type | Required | Description |
8787
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
88-
| page | integer | false | the first page displaying all the indexed users. defaults to 1
89-
| per_page | integer | false | The number of users to display per page. defaults to 15 |
88+
| ```page``` | ```integer``` | ```false``` | ```the first page displaying all the indexed users. defaults to 1```
89+
| ```per_page``` | ```integer``` | ```false``` | ```The number of users to display per page. defaults to 15 ``` |
9090

9191

92-
#### ```Update an Indexed User```
92+
### Update an Indexed User
9393
This methods helps to update the details of an indexed user
9494

9595
```python
@@ -99,16 +99,16 @@ test = thepeer_instance.update_user(reference,**data)
9999

100100
| Parameters | Data Type | Required | Description |
101101
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
102-
| reference | string | true | the unique reference returned when the user was indexed
103-
| data | Any | true | A keyword argument which contains on or more of the indexed user's email, name or identifier |
102+
| ```reference``` | ```string``` | ```true``` | ```the unique reference returned when the user was indexed```
103+
| ```data``` | ```Any``` | ```true``` | ```A keyword argument which contains on or more of the indexed user's email, name or identifier``` |
104104

105105
### Sample
106106
```python
107-
test = thepeer_instance.update_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd", identifier="iyayiemmanuel1@gmail.com",
108-
name="Osagie Iyayi",
109-
email="iyayiemmanuel1@gmail.com")
107+
test = thepeer_instance.update_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd", identifier="dwave101@yahoo.com",
108+
name="Edmond Kirsch",
109+
email="dwave101@gmail.com")
110110
```
111-
#### ```Remove an Indexed User```
111+
### Remove an Indexed User
112112
This methods helps to remove the details of an indexed user from a specific account
113113

114114
```python
@@ -119,9 +119,9 @@ test = thepeer_instance.delete_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")
119119

120120
| Parameters | Data Type | Required | Description |
121121
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
122-
| reference | string | true | the unique reference returned when the user was indexed
122+
| ```reference``` | ```string``` | ```true``` | ```the unique reference returned when the user was indexed```
123123

124-
#### ```Get User Links```
124+
### Get User Links
125125

126126
This method gets all payment links associated to an indexed user
127127
```python
@@ -131,10 +131,10 @@ test = thepeer_instance.get_user_links("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd")
131131

132132
| Parameters | Data Type | Required | Description |
133133
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
134-
| reference | string | true | the unique reference returned when the user was indexed
134+
| ```reference``` | ```string``` | ```true``` | ```the unique reference returned when the user was indexed```
135135

136136

137-
### ```Get Single Link```
137+
### Get Single Link
138138

139139
This method gets the payment information located in a payment link
140140

@@ -146,10 +146,10 @@ test = thepeer_instance.get_single_link("da14a90c-61c2-4cf7-a837-e3112a2d0c3d")
146146

147147
| Parameters | Data Type | Required | Description |
148148
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
149-
| link_id | string | true | the unique link_id containing the payment information
149+
| ```link_id``` | ```string``` | ```true``` | ```the unique link_id containing the payment information```
150150

151151

152-
### ``` Charge A Link```
152+
### Charge A Link
153153
This method allows a business to charge a user via their linked account
154154
```python
155155
test = thepeer_instance.charge_link(link_id, amount, remark, currency)
@@ -159,12 +159,12 @@ test = thepeer_instance.charge_link(link_id, amount, remark, currency)
159159

160160
| Parameters | Data Type | Required | Description |
161161
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
162-
| link_id | string | true | the unique link_id containing the payment information
163-
| amount | integer | true | the amount of the whole transaction
164-
| remark | string | true | short detail about the transaction |
165-
| currency | string | false | The denomination medium of paying (either one of NGN and USD). defaults to NGN
162+
| ```link_id``` | ```string``` | ```true``` | ```the unique link_id containing the payment information```
163+
| ```amount``` | ```integer``` | ```true``` | ```the amount of the whole transaction```
164+
| ```remark``` | ```string``` | ```true``` | ```short detail about the transaction``` |
165+
| ```currency``` | ```string``` | ```false``` | ```The denomination medium of paying (either one of NGN and USD). defaults to NGN```
166166

167-
### ```Authorize Direct Charge```
167+
### Authorize Direct Charge
168168
This method allows a business to authorize a direct charge request made by a user
169169

170170
```python
@@ -174,13 +174,13 @@ test = thepeer_instance.authorize_direct_charge(auth_charge_reference, event)
174174

175175
| Parameters | Data Type | Required | Description |
176176
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
177-
| auth_charge_reference | string | true | the reference associated to a pending charge request
178-
| event | string | true | the type of webhook event |
177+
| ```auth_charge_reference``` | ```string``` | ```true``` | ```the reference associated to a pending charge request```
178+
| ```event``` | ```string``` | ```true``` | ```the type of webhook event``` |
179179

180180
**Pro Tip:** the various types of webhook events are available [here](https://docs.thepeer.co/authorization/process-authorization-requests#supported-events)
181181

182182

183-
### ```Get Transaction Detail```
183+
### Get Transaction Detail
184184
This method gets the details of a transaction
185185
```python
186186
test = thepeer_instance.get_transaction_detail("eda58ee3-4f2c-4aa4-9da7-10a2b8ced453")
@@ -190,9 +190,9 @@ test = thepeer_instance.get_transaction_detail("eda58ee3-4f2c-4aa4-9da7-10a2b8ce
190190

191191
| Parameters | Data Type | Required | Description |
192192
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
193-
| transaction_id | string | true | the unique transaction identifier
193+
| ```transaction_id``` | ```string``` | ```true``` | ```the unique transaction identifier```
194194

195-
### ```Refund Transaction```
195+
### Refund Transaction
196196
This method allows a business to refund a transaction back to the user for obvious reasons
197197
```python
198198
test = thepeer_instance.refund_transaction("28e52edf-16d9-4921-8a54-ef34d7029707", "possible threat actor"):
@@ -201,8 +201,8 @@ test = thepeer_instance.refund_transaction("28e52edf-16d9-4921-8a54-ef34d7029707
201201
#### Parameters Required
202202
| Parameters | Data Type | Required | Description |
203203
|----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
204-
| transaction_id | string | true | the unique transaction identifier
205-
| reason | string | false | a short sentence explaining reasons for the refund |
204+
| ```transaction_id``` | ```string``` | ```true``` | ```the unique transaction identifier```
205+
| ```reason``` | ```string``` | ```false``` | ```a short sentence explaining reasons for the refund``` |
206206

207207

208208

thepeer/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from utils.exceptions.handleErrors import SwitchErrorStates # noqa: E402
1313

1414

15-
class ThePeerInit:
15+
class ThepeerInit:
1616
def __init__(self, secret):
1717
# pass a default value for the url
1818
self.url = BASE_URL

thepeer/tests/thepeer_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from thepeer import main # type: ignore
33

4-
thepeer_test_suites = main.ThePeerInit("pssk_test_vwww1yvvpymamtut26x5tvpx1znrcmeis2k0kvcmwzjax")
4+
thepeer_test_suites = main.ThepeerInit("pssk_test_vwww1yvvpymamtut26x5tvpx1znrcmeis2k0kvcmwzjax")
55

66

77
class ThePeerInitMethods(unittest.TestCase):

0 commit comments

Comments
 (0)