Пример #1
0
    def get(self, request, *args, **kwargs):  # pylint: disable=arguments-differ
        enterprise_customer_uuid = request.GET.get('ciid')
        if not enterprise_customer_uuid:
            return Response(
                status=status.HTTP_400_BAD_REQUEST,
                data={
                    "message":
                    (u"Cornerstone course list API expects ciid parameter.")
                })

        enterprise_customer = get_enterprise_customer(enterprise_customer_uuid)
        if not enterprise_customer:
            return Response(status=status.HTTP_404_NOT_FOUND,
                            data={
                                "message":
                                (u"No enterprise data found for given ciid.")
                            })

        worker_user = get_enterprise_worker_user()
        enterprise_config = CornerstoneEnterpriseCustomerConfiguration.objects.get(
            enterprise_customer=enterprise_customer)
        exporter = enterprise_config.get_content_metadata_exporter(worker_user)
        transmitter = enterprise_config.get_content_metadata_transmitter()
        data = transmitter.transmit(exporter.export())
        return Response(data)
Пример #2
0
 def __init__(self, user=None):
     user = user if user else utils.get_enterprise_worker_user()
     super().__init__(user)
Пример #3
0
 def __init__(self, user=None):
     user = user if user else utils.get_enterprise_worker_user()
     super(EnterpriseCatalogApiClient, self).__init__(user)
Пример #4
0
 def __init__(self, user=None):
     user = user if user else get_enterprise_worker_user()
     super(EnrollmentApiClient, self).__init__(user)