class ZaggClient(object):
    """
    wrappers class around REST API so use can use it with python
    """

    def __init__(self, zagg_connection, headers=None):
        # pylint doesn't know where RestAPI is
        #pylint: disable=undefined-variable
        self.zagg_conn = zagg_connection
        self.rest = RestApi(host=self.zagg_conn.url,
                            username=self.zagg_conn.user,
                            password=self.zagg_conn.password,
                            headers=headers,
                            ssl_verify=self.zagg_conn.ssl_verify,
                            debug=self.zagg_conn.verbose,
                           )

    def add_metric(self, unique_metric_list):
        """
        Add a list of UniqueMetrics (unique_metric_list) via rest
        """
        metric_list = []
        for metric in unique_metric_list:
            metric_list.append(metric.to_dict())

        headers = {'content-type': 'application/json; charset=utf8'}
        status, raw_response = self.rest.request(method='POST', url=self.zagg_conn.url + '/metric',
                                                 data=json.dumps(unique_metric_list, default=lambda x: x.__dict__),
                                                 headers=headers)

        return (status, raw_response)
 def __init__(self, zagg_connection, headers=None):
     # pylint doesn't know where RestAPI is
     #pylint: disable=undefined-variable
     self.zagg_conn = zagg_connection
     self.rest = RestApi(host=self.zagg_conn.host,
                         username=self.zagg_conn.user,
                         password=self.zagg_conn.password,
                         headers=headers
                        )
 def __init__(self, zagg_connection, headers=None):
     # pylint doesn't know where RestAPI is
     #pylint: disable=undefined-variable
     self.zagg_conn = zagg_connection
     self.rest = RestApi(host=self.zagg_conn.url,
                         username=self.zagg_conn.user,
                         password=self.zagg_conn.password,
                         headers=headers,
                         ssl_verify=self.zagg_conn.ssl_verify,
                         debug=self.zagg_conn.verbose,
                        )