def update_entity(self, dict_data, **kwargs): if not self.is_admin: raise exceptions.WhoDaHellYouThinkYouAre('Not now!') if self.entity_key == 'raw_resource': return self.__update_raw_resource(kwargs['raw_resource_id'], dict_data) if self.entity_key == 'processed_material': return self.__update_processed_material(kwargs['processed_material_id'], dict_data) if self.entity_key == 'refined_commodity': return self.__update_refined_commodity(kwargs['refined_commodity_id'], dict_data) return None
def create_new_entity(self, dict_data, **kwargs): if not self.is_admin: raise exceptions.WhoDaHellYouThinkYouAre('Not now!') if self.entity_key == 'raw_resource': return self.__create_raw_resource(dict_data) if self.entity_key == 'processed_material': return self.__create_processed_material(dict_data) if self.entity_key == 'refined_commodity': return self.__create_refined_commodity(dict_data) if self.entity_key == 'colony': return self.__create_account_character_colonies(kwargs['account_id'], kwargs['character_id']) return None
def get_list(self, payload, **kwargs): if not self.is_admin: raise exceptions.WhoDaHellYouThinkYouAre('Not now!') if self.entity_key == 'raw_resource': return self.__get_raw_resources() if self.entity_key == 'processed_material': return self.__get_processed_materials() if self.entity_key == 'refined_commodity': return self.__get_refined_commodities() if self.entity_key == 'colony': return self.__get_account_character_colonies(**kwargs) if self.entity_key == 'account': return self.__get_accounts() return []
def get_item(self, payload, **kwargs): if not self.is_admin: raise exceptions.WhoDaHellYouThinkYouAre('Not now!') if self.entity_key == 'raw_resource': return self.__get_raw_resource(kwargs['raw_resource_id']) if self.entity_key == 'processed_material': return self.__get_processed_material(kwargs['processed_material_id']) if self.entity_key == 'refined_commodity': return self.__get_refined_commodity(kwargs['refined_commodity_id']) if self.entity_key == 'colony': if payload.get('calculate') is not None: return self.__calculate_account_character_colony_production_target(kwargs['account_id'], kwargs['character_id'], kwargs['colony_id'], production_target=payload.get('production_target')) return self.__get_account_character_colony(kwargs['account_id'], kwargs['character_id'], kwargs['colony_id']) return None
def delete_entity(self, **kwargs): if not self.is_admin: raise exceptions.WhoDaHellYouThinkYouAre('Not now!') if self.entity_key == 'colony': self.__delete_account_character_colony(kwargs['account_id'], kwargs['character_id'], kwargs['colony_id'])