Beispiel #1
0
    def update(self) -> Dict:
        """
        Update your custom basket

        :return: dictionary containing asset id and report id

        **Usage**

        Make updates to your basket's metadata, pricing options, publishing options, or composition

        **See also**

        :func:`get_details` :func:`poll_status` :func:`create`

        """
        edit_inputs, rebal_inputs = self.__get_updates()
        entitlements = self.__entitlements.to_target()
        if not entitlements == self.__initial_entitlements:
            response = GsAssetApi.update_asset_entitlements(
                self.id, entitlements)
        if edit_inputs is None and rebal_inputs is None:
            if response:
                return response.as_dict()
            raise MqValueError(
                'Update failed: Nothing on the basket was changed')
        elif edit_inputs is not None and rebal_inputs is None:
            response = GsIndexApi.edit(self.id, edit_inputs)
        elif rebal_inputs is not None and edit_inputs is None:
            response = GsIndexApi.rebalance(self.id, rebal_inputs)
        else:
            response = self.__edit_and_rebalance(edit_inputs, rebal_inputs)
        gs_asset = GsAssetApi.get_asset(self.id)
        self.__latest_create_report = GsReportApi.get_report(
            response.report_id)
        self.__init__(gs_asset=gs_asset, _finish_init=True)
        return response.as_dict()
Beispiel #2
0
 def remove_view_permissions(self, user_tokens: List[str]) -> Dict:
     self.entitlements.view = self.__get_updated_tokens(
         self.entitlements.view, tokens_to_remove=user_tokens)
     return GsAssetApi.update_asset_entitlements(self.__id,
                                                 self.entitlements)
Beispiel #3
0
 def add_admin_permissions(self, user_tokens: List[str]) -> Dict:
     self.entitlements.admin = self.__get_updated_tokens(
         self.entitlements.admin, tokens_to_add=user_tokens)
     return GsAssetApi.update_asset_entitlements(self.__id,
                                                 self.entitlements)