Coverage for hexonet/apiconnector/record.py: 100%
12 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-09 09:07 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-09 09:07 +0000
1# -*- coding: utf-8 -*-
2"""
3 hexonet.apiconnector.record
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 This module covers all necessary functionality to
6 work with a record and wrapped data.
7 :copyright: © 2018 by HEXONET GmbH.
8 :license: MIT, see LICENSE for more details.
9"""
12class Record(object):
13 """
14 The Record class covers all you need to access record data of a Backend API response.
15 """
17 def __init__(self, data):
18 self.__data = data
20 def getData(self):
21 """
22 get row data
23 """
24 return self.__data
26 def getDataByKey(self, key):
27 """
28 get row data for given column name
29 """
30 if self.__hasData(key):
31 return self.__data[key]
32 return None
34 def __hasData(self, key):
35 """
36 check if record has data for given column name
37 """
38 return key in self.__data