Skip to content

Commit

Permalink
fix: Change parameter name id_ to identifier to avoid collision (#9)
Browse files Browse the repository at this point in the history
* fix: Change parameter name id_ to identifier

Fix test
  • Loading branch information
akalex authored Jan 24, 2023
1 parent 825fb22 commit df611b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.1

- [FIX] Change parameter name from ``id_`` to ``identifier`` of the method ``identify`` to avoid naming collision.

## 0.5.0

- Add a couple of new attributes to object ``SendEmailRequest``
Expand Down
10 changes: 5 additions & 5 deletions async_customerio/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ def setup_base_url(host: str, port: int, prefix: str) -> str:

return template.format(host=host.strip("/"), port=port, prefix=prefix.strip("/"))

async def identify(self, id_: t.Union[str, int], **attrs) -> None:
async def identify(self, identifier: t.Union[str, int], **attrs) -> None:
"""
Identify a single customer by their unique id, and optionally add attributes.
:param id_: the unique value representing a person. The values you use to identify a person may be an
:param identifier: the unique value representing a person. The values you use to identify a person may be an
``id``, ``email`` address, or the ``cio_id`` (when updating people), depending on your workspace settings.
When you reference people by ``cio_id``, you must prefix the value with ``cio_``.
"""
if not id_:
raise AsyncCustomerIOError("id_ cannot be blank in identify")
if not identifier:
raise AsyncCustomerIOError("identifier cannot be blank in identify")
await self.send_request(
"PUT", join_url(self.base_url, self.CUSTOMER_ENDPOINT.format(id=id_)), json_payload=attrs
"PUT", join_url(self.base_url, self.CUSTOMER_ENDPOINT.format(id=identifier)), json_payload=attrs
)

async def track(self, customer_id: t.Union[str, int], name: str, **data) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "async-customerio"
version = "0.5.0"
version = "0.5.1"
description = "Async CustomerIO Client - a Python client to interact with CustomerIO in an async fashion."
license = "MIT"
authors = [
Expand Down
4 changes: 2 additions & 2 deletions tests/test_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def test_identify(fake_async_customerio, faker_, httpx_mock: HTTPXMock):


async def test_identify_empty_id(fake_async_customerio):
with pytest.raises(AsyncCustomerIOError, match="id_ cannot be blank in identify"):
with pytest.raises(AsyncCustomerIOError, match="identifier cannot be blank in identify"):
await fake_async_customerio.identify(0, first_name="John", last_name="Smith")


Expand Down Expand Up @@ -197,7 +197,7 @@ async def test_merge_customers_empty_customer_id(

@pytest.mark.parametrize(
"method, method_arguments", (
("identify", {"id_": 1, "name": "Jack"}),
("identify", {"identifier": 1, "name": "Jack"}),
("track", {"customer_id": 1, "name": "some-event"}),
("track_anonymous", {"anonymous_id": "1111-2", "name": "some-event"}),
("pageview", {"customer_id": 1, "page": "home-screen"}),
Expand Down

0 comments on commit df611b1

Please sign in to comment.