Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client => FaunaClient #99

Merged
merged 2 commits into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion faunadb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from faunadb._json import parse_json_or_none, to_json


class Client(object):
class FaunaClient(object):
"""
Directly communicates with FaunaDB via JSON.

Expand Down
4 changes: 2 additions & 2 deletions faunadb/client_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

def logger(logger_func):
"""
Function that can be the ``observer`` for a :any:`Client`.
Function that can be the ``observer`` for a :any:`FaunaClient`.
Will call ``logger_func`` on a string representation of each :any:`RequestResult`.

Use it like::

def log(logged):
print logged
client = Client(observer=logger(log), ...)
client = FaunaClient(observer=logger(log), ...)
client.ping() # Calls `log`

:param logger_func: Callback taking a string to be logged.
Expand Down
2 changes: 1 addition & 1 deletion faunadb/query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
This module contains functions that generate query objects,
suitable to be passed into :any:`Client.query`.
suitable to be passed into :any:`FaunaClient.query`.

In addition to these functions, queries may contain:

Expand Down
2 changes: 1 addition & 1 deletion faunadb/request_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(
self.path = path
"""Path that was queried. Relative to client's domain."""
self.query = query
"""URL query. ``None`` unless ``method == GET``. *Not* related to :any:`Client.query`."""
"""URL query. ``None`` unless ``method == GET``. *Not* related to :any:`FaunaClient.query`."""
self.request_content = request_content
"""Request data."""
self.response_raw = response_raw
Expand Down
8 changes: 4 additions & 4 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from requests import codes

from faunadb._json import to_json, parse_json
from faunadb.client import Client
from faunadb.client import FaunaClient
from faunadb.objects import Ref
from faunadb import query

_FAUNA_ROOT_KEY = environ["FAUNA_ROOT_KEY"]
# If None, these have defaults in Client.
# If None, these have defaults in FaunaClient.
_FAUNA_DOMAIN = environ.get("FAUNA_DOMAIN")
_FAUNA_SCHEME = environ.get("FAUNA_SCHEME")
_FAUNA_PORT = environ.get("FAUNA_PORT")
Expand Down Expand Up @@ -69,7 +69,7 @@ def get_client(self, secret=None, observer=None):
args = {"domain": _FAUNA_DOMAIN, "scheme": _FAUNA_SCHEME, "port": _FAUNA_PORT}
# If None, use default instead
non_null_args = {k: v for k, v in args.items() if v is not None}
return Client(secret=secret, observer=observer, **non_null_args)
return FaunaClient(secret=secret, observer=observer, **non_null_args)

def assert_raises(self, exception_class, action):
"""Like self.assertRaises and returns the exception too."""
Expand All @@ -79,7 +79,7 @@ def assert_raises(self, exception_class, action):


def mock_client(response_text, status_code=codes.ok):
c = Client()
c = FaunaClient()
c.session = _MockSession(response_text, status_code)
return c

Expand Down
1 change: 0 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from faunadb.client import Client
from faunadb.objects import Ref
from faunadb.query import create
from tests.helpers import FaunaTestCase
Expand Down