# Path: pydomo/Transport.py
# class HTTPMethod:
#     GET = 'GET'
#     POST = 'POST'
#     PUT = 'PUT'
#     PATCH = 'PATCH'
#     DELETE = 'DELETE'


import json
import requests
from pydomo.Transport import HTTPMethod
    """

    def __init__(self, transport, logger):
        self.transport = transport
        self.logger = logger

    def _create(self, url, request, params, obj_desc):
        response = self.transport.post(url=url, params=params, body=request)
        if response.status_code in (requests.codes.CREATED, requests.codes.OK):
            obj = response.json()
            self.print_json("Created", obj)
            return obj
        else:
            self.logger.debug("Error creating " + obj_desc + ": "
                              + self.transport.dump_response(response))
            raise Exception("Error creating " + obj_desc + ": " + response.text)

    def _get(self, url, obj_desc):
        response = self.transport.get(url=url, params={})
        if response.status_code == requests.codes.OK:
            return response.json()
        else:
            self.logger.debug("Error retrieving " + obj_desc + ": "
                              + self.transport.dump_response(response))
            raise Exception("Error retrieving " + obj_desc + ": "
                            + response.text)

    def _update(self, url, method, success_code, obj_update, obj_desc):
        if method == HTTPMethod.PUT:
            response = self.transport.put(url, obj_update)

# Path: pydomo/Transport.py
# class HTTPMethod:
#     GET = 'GET'
#     POST = 'POST'
#     PUT = 'PUT'
#     PATCH = 'PATCH'
#     DELETE = 'DELETE'


# Path: pydomo/DomoAPIClient.py
import json
import requests
from pydomo.Transport import HTTPMethod

    """

    def __init__(self, transport, logger):
        self.transport = transport
        self.logger = logger

    def _create(self, url, request, params, obj_desc):
        response = self.transport.post(url=url, params=params, body=request)
        if response.status_code in (requests.codes.CREATED, requests.codes.OK):
            obj = response.json()
            self.print_json("Created", obj)
            return obj
        else:
            self.logger.debug("Error creating " + obj_desc + ": "
                              + self.transport.dump_response(response))
            raise Exception("Error creating " + obj_desc + ": " + response.text)

    def _get(self, url, obj_desc):
        response = self.transport.get(url=url, params={})
        if response.status_code == requests.codes.OK:
            return response.json()
        else:
            self.logger.debug("Error retrieving " + obj_desc + ": "
                              + self.transport.dump_response(response))
            raise Exception("Error retrieving " + obj_desc + ": "
                            + response.text)

    def _update(self, url, method, success_code, obj_update, obj_desc):
        if method == HTTPMethod.PUT:
            response = self.transport.put(url, obj_update)

        elif method == HTTPMethod.PATCH: