-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4318460
commit b373194
Showing
10 changed files
with
508 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
starkcore==0.2.1 | ||
starkcore==0.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,3 +110,6 @@ | |
|
||
from . import splitprofile | ||
from .splitprofile.__splitprofile import SplitProfile | ||
|
||
from . import request | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .__request import (get, post, patch, put, delete) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
from ..utils import rest | ||
|
||
|
||
def get(path, query=None, user=None): | ||
"""# Retrieve any StarkBank resource | ||
Receive a json of resources previously created in StarkBank's API | ||
## Parameters (required): | ||
- path [string]: StarkBank resource's route. ex: "/invoice/" | ||
- query [dict, default None]: Query parameters. ex: {"limit": 1, "status": paid} | ||
## Parameters (optional): | ||
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user | ||
was set before function call | ||
## Return: | ||
- dict of StarkBank objects with updated attributes | ||
""" | ||
return rest.get_raw( | ||
path=path, | ||
query=query, | ||
user=user | ||
) | ||
|
||
|
||
def post(path, body=None, query=None, user=None): | ||
"""# Create any StarkBank resource | ||
Send a list of jsons and create any StarkBank resource objects | ||
## Parameters (required): | ||
- path [string]: StarkBank resource's route. ex: "/invoice/" | ||
- body [dict]: request parameters. ex: {"invoices": [{"amount": 100, "name": "Iron Bank S.A.", "taxId": "20.018.183/0001-80"}]} | ||
## Parameters (optional): | ||
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user | ||
was set before function call | ||
- query [dict, default None]: Query parameters. ex: {"limit": 1, "status": paid} | ||
## Return: | ||
- list of resources jsons with updated attributes | ||
""" | ||
return rest.post_raw( | ||
path=path, | ||
payload=body, | ||
query=query, | ||
user=user | ||
) | ||
|
||
|
||
def patch(path, body=None, user=None): | ||
"""# Update any StarkBank resource | ||
Send a json with parameters of a single StarkBank resource object and update it | ||
## Parameters (required): | ||
- path [string]: StarkBank resource's route. ex: "/invoice/5699165527090460" | ||
- body [dict]: request parameters. ex: {"amount": 100} | ||
## Parameters (optional): | ||
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user | ||
was set before function call | ||
## Return: | ||
- json of the resource with updated attributes | ||
""" | ||
return rest.patch_raw( | ||
path=path, | ||
payload=body, | ||
user=user | ||
) | ||
|
||
|
||
def put(path, body=None, user=None): | ||
"""# Put any StarkBank resource | ||
Send a json with parameters of a single StarkBank resource object and create it, if the resource alredy exists, | ||
you will update it. | ||
## Parameters (required): | ||
- path [string]: StarkBank resource's route. ex: "/invoice" | ||
- body [dict]: request parameters. ex: {"amount": 100} | ||
## Parameters (optional): | ||
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user | ||
was set before function call | ||
## Return: | ||
- json of the resource with updated attributes | ||
""" | ||
return rest.put_raw( | ||
path=path, | ||
payload=body, | ||
user=user | ||
) | ||
|
||
|
||
def delete(path, body=None, user=None): | ||
"""# Delete any StarkBank resource | ||
Send a json with parameters of a single StarkBank resource object and delete it | ||
you will update it. | ||
## Parameters (required): | ||
- path [string]: StarkBank resource's route. ex: "/invoice/5699165527090460" | ||
- body [dict]: request parameters. ex: {"amount": 100} | ||
## Parameters (optional): | ||
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user | ||
was set before function call | ||
## Return: | ||
- json of the resource with updated attributes | ||
""" | ||
return rest.delete_raw( | ||
path=path, | ||
payload=body, | ||
user=user | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.