Total Complexity | 2 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 60% |
Changes | 0 |
1 | #!/usr/bin/python |
||
2 | # -*- coding: utf-8 -*- |
||
3 | 1 | from time import time |
|
4 | |||
5 | 1 | from kuon.watcher.adapters.models import AbstractEntity |
|
6 | |||
7 | |||
8 | 1 | class SoldItem(AbstractEntity): |
|
9 | |||
10 | 1 | def __init__(self, price: int, wear_value: float, sold_at: [float, int] = time()) -> None: |
|
11 | """Initializing function |
||
12 | |||
13 | :type price: |
||
14 | :type wear_value: |
||
15 | :type sold_at: |
||
16 | """ |
||
17 | self._price = price |
||
18 | self._wear_value = wear_value |
||
19 | self._sold_at = int(sold_at) |
||
20 | |||
21 | 1 | @property |
|
22 | 1 | def value(self) -> dict: |
|
23 | """Return all important information from the API response like price, wear value and the time it was sold |
||
24 | |||
25 | :return: |
||
26 | """ |
||
27 | return { |
||
28 | 'price': self._price, |
||
29 | 'wear_value': self._wear_value, |
||
30 | 'sold_at': self._sold_at |
||
31 | } |
||
32 |