예제 #1
0
    def get_links(self, instance):
        """
        Translate the `links` property to a custom array of Hyperlink values.

        Parameters
        ----------
        instance : Target Obj instance

        Returns
        -------
        Hyperlink url for Target detail API endpoint
        """
        list_of_actions = action_checker(self.context.get('target_name'))
        # Build a list of endpoint_actions and compare with list_of_actions
        if self.context.get('target_name') == 'github':
            github_endpoint_actions = ['resource_download']
            resource_actions = list_intersection(list_of_actions,
                                                 github_endpoint_actions)
        else:
            endpoint_actions = [
                'resource_download',
                'resource_upload',
                'resource_transfer_in',
            ]
            resource_actions = list_intersection(list_of_actions,
                                                 endpoint_actions)

        links = link_builder(self, instance, resource_actions)

        return links
예제 #2
0
    def get_links(self, instance):
        """
        Translate the `links` property to a custom array of Hyperlink values.

        Parameters
        ----------
        instance : Target Obj instance

        Returns
        -------
        Hyperlink url for Target detail API endpoint
        """
        list_of_actions = action_checker(self.context.get('target_name'))
        # Build a list of endpoint_actions and compare with list of actions
        resources_actions = list_intersection(list_of_actions, ['resource_detail'])

        links = link_builder(self, instance, resources_actions)

        return links
예제 #3
0
    def get_links(self, instance):
        """
        Translate the `links` property to a custom array of Hyperlink values.

        Parameters
        ----------
        instance : Target Obj instance

        Returns
        -------
        A list of hyperlink urls for Target detail API endpoint
        """
        list_of_actions = action_checker(instance['name'])
        # Build a list of endpoint_actions to compare with list of actions
        endpoint_actions = [
            'resource_collection', 'resource_upload', 'resource_transfer_in'
        ]
        resources_actions = list_intersection(list_of_actions,
                                              endpoint_actions)

        links = link_builder(self, instance, resources_actions)

        return links