Updates this item :param kwargs: all the properties to be updated. only name and description are allowed at the moment. :return: Success / Failure :rtype: bool
(self, **kwargs)
| 628 | return data |
| 629 | |
| 630 | def update(self, **kwargs): |
| 631 | """ Updates this item |
| 632 | |
| 633 | :param kwargs: all the properties to be updated. |
| 634 | only name and description are allowed at the moment. |
| 635 | :return: Success / Failure |
| 636 | :rtype: bool |
| 637 | """ |
| 638 | if not self.object_id: |
| 639 | return False |
| 640 | |
| 641 | url = self.build_url( |
| 642 | self._endpoints.get('item').format(id=self.object_id)) |
| 643 | |
| 644 | data = {self._cc(key): value for key, value in kwargs.items() if |
| 645 | key in {'name', |
| 646 | 'description'}} # convert keys to protocol casing |
| 647 | if not data: |
| 648 | return False |
| 649 | |
| 650 | response = self.con.patch(url, data=data) |
| 651 | if not response: |
| 652 | return False |
| 653 | |
| 654 | new_data = response.json() |
| 655 | |
| 656 | for key in data: |
| 657 | value = new_data.get(key, None) |
| 658 | if value: |
| 659 | setattr(self, self.protocol.to_api_case(key), value) |
| 660 | |
| 661 | return True |
| 662 | |
| 663 | def delete(self): |
| 664 | """ Moves this item to the Recycle Bin |