Coverage for hexonet/apiconnector/record.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-11-08 15:49 +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""" 

10 

11 

12class Record(object): 

13 """ 

14 The Record class covers all you need to access record data of a Backend API response. 

15 """ 

16 

17 def __init__(self, data): 

18 self.__data = data 

19 

20 def getData(self): 

21 """ 

22 get row data 

23 """ 

24 return self.__data 

25 

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 

33 

34 def __hasData(self, key): 

35 """ 

36 check if record has data for given column name 

37 """ 

38 return key in self.__data