Skip to content

Commit

Permalink
Rename to Paddle Client for org move
Browse files Browse the repository at this point in the history
  • Loading branch information
pyepye committed Jun 4, 2020
1 parent 11d4445 commit 8a57d87
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ _Note: As `tox` runs the test suite multiple times, it is configured to skip any

## Submitting changes

Please send a [GitHub Pull Request to paddle-python](https://github.com/pyepye/paddle-python/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).
Please send a [GitHub Pull Request to paddle-python](https://github.com/paddle-python/paddle-client/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).

All changes should have at least one test to accompany it, either to prove the bug it is fixing has indeed been fixed on to ensure a new feature works as expected.

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Paddle Python
# Paddle Client

A python (3.5+) wrapper around the [Paddle.com](https://paddle.com/) [API](https://developer.paddle.com/api-reference/intro)

Expand All @@ -11,7 +11,7 @@ _Note: This is a work in progress, not all of the Paddle endpoints have been imp
### Installation

```bash
pip install paddle-python
pip install paddle-client
```


Expand All @@ -20,10 +20,10 @@ pip install paddle-python
To use the Paddle API you will need a Paddle Vendor ID and API key which can be found on [Paddle's authentication page](https://vendors.paddle.com/authentication)

```python
from paddle import Paddle
from paddle import PaddleClient


paddle = Paddle(vendor_id=12345, api_key='myapikey')
paddle = PaddleClient(vendor_id=12345, api_key='myapikey')
paddle.list_products()
```

Expand All @@ -34,10 +34,10 @@ export PADDLE_API_KEY="myapikey"
```

```python
from paddle import Paddle
from paddle import PaddleClient


paddle = Paddle()
paddle = PaddleClient()
paddle.list_products()
```

Expand All @@ -49,7 +49,7 @@ Coming soon. Please see `Working endpoints` below for basic usage.

## Contributing

All contributions are welcome and appreciated. Please see [CONTRIBUTING.md](https://github.com/pyepye/paddle-python/blob/master/CONTRIBUTING.md) for more details including details on how to run tests etc.
All contributions are welcome and appreciated. Please see [CONTRIBUTING.md](https://github.com/paddle-python/paddle-client/blob/master/CONTRIBUTING.md) for more details including details on how to run tests etc.


## Working endpoints
Expand Down
4 changes: 1 addition & 3 deletions paddle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from .paddle import Paddle, PaddleException # NOQA: F401

__version__ = '0.1.0'
from .paddle import PaddleClient, PaddleException # NOQA: F401
2 changes: 1 addition & 1 deletion paddle/paddle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __str__(self) -> str:
return self.message


class Paddle():
class PaddleClient():

def __init__(self, vendor_id: int = None, api_key: str = None):
if not vendor_id:
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[tool.poetry]
name = "paddle-python"
name = "paddle-client"
packages = [
{include = "paddle"}
]
version = "0.5.1"
version = "0.6.0"
description = "Python wrapper around the Paddle.com API"
license = "MIT"
authors = ["Matt Pye <pyematt@gmail.com>"]
readme = "README.md"
repository = "https://github.com/pyepye/paddle-python"
homepage = "https://github.com/pyepye/paddle-python"
repository = "https://github.com/paddle-python/paddle-client"
homepage = "https://github.com/paddle-python/paddle-client"
keywords = ["paddle", "paddle.com", "payments", "billing", "commerce", "finance", "saas"]

[tool.poetry.dependencies]
Expand Down
24 changes: 10 additions & 14 deletions tests/test_paddle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from paddle import Paddle, PaddleException, __version__
from paddle import PaddleClient, PaddleException


class BadPaddleDataWarning(UserWarning):
Expand All @@ -9,7 +9,7 @@ class BadPaddleDataWarning(UserWarning):

@pytest.fixture(scope='session')
def paddle_client():
paddle = Paddle()
paddle = PaddleClient()
return paddle


Expand All @@ -28,42 +28,38 @@ def unset_api_key(monkeypatch):
monkeypatch.delenv('PADDLE_API_KEY', raising=False)


def test_version():
assert __version__ == '0.1.0'


def test_paddle__manual_vendor_id_and_api_key(unset_vendor_id, unset_api_key):
with pytest.raises(ValueError):
Paddle(api_key='test')
PaddleClient(api_key='test')
try:
Paddle(api_key='test')
PaddleClient(api_key='test')
except ValueError as error:
assert str(error) == 'Vendor ID not set'


def test_paddle_vendor_id_not_set(unset_vendor_id):
with pytest.raises(ValueError):
Paddle(api_key='test')
PaddleClient(api_key='test')
try:
Paddle(api_key='test')
PaddleClient(api_key='test')
except ValueError as error:
assert str(error) == 'Vendor ID not set'


def test_paddle_vendor_id_not_int(set_vendor_id_to_invalid):
with pytest.raises(ValueError):
Paddle(api_key='test')
PaddleClient(api_key='test')
try:
Paddle(api_key='test')
PaddleClient(api_key='test')
except ValueError as error:
assert str(error) == 'Vendor ID must be a number'


def test_paddle_api_key_not_set(unset_api_key):
with pytest.raises(ValueError):
Paddle(vendor_id=1)
PaddleClient(vendor_id=1)
try:
Paddle(vendor_id=1)
PaddleClient(vendor_id=1)
except ValueError as error:
assert str(error) == 'API key not set'

Expand Down
6 changes: 3 additions & 3 deletions tests/test_user_history.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest

from paddle import Paddle, PaddleException
from paddle import PaddleClient, PaddleException

from .test_paddle import paddle_client, unset_vendor_id # NOQA: F401


def test_get_user_history_with_vendor_id(unset_vendor_id): # NOQA: F811
email = 'test@example.com'
vendor_id = 11
paddle = Paddle(vendor_id=vendor_id)
paddle = PaddleClient(vendor_id=vendor_id)
response = paddle.get_user_history(email=email, vendor_id=vendor_id)
assert response == 'We\'ve sent details of your past transactions, licenses and downloads to you via email.' # NOQA: E501

Expand All @@ -33,6 +33,6 @@ def test_get_user_history_with_product_id(paddle_client): # NOQA: F811
def test_get_user_history_missing_vendoer_id_and_product_id(unset_vendor_id): # NOQA: F811, E501
email = 'test@example.com'
vendor_id = 11
paddle = Paddle(vendor_id=vendor_id)
paddle = PaddleClient(vendor_id=vendor_id)
response = paddle.get_user_history(email=email)
assert response == 'We\'ve sent details of your past transactions, licenses and downloads to you via email.' # NOQA: E501

0 comments on commit 8a57d87

Please sign in to comment.