Пример #1
0
    def create(self, activityType):
        response = self._create(data=activityType.to_primitive())
        return dict_to_model(response.json()['data'], self.MODEL_CLASS)

    def list(self, **params):
        return CollectionResponse(self._list(params=params), self.MODEL_CLASS)

    def delete(self, activityType):
        response = self._delete(activityType.id)
        return response.json()

    def bulk_delete(self, activityTypes):
        activityTypes_ids = [activityType.id for activityType in activityTypes]

        response = self._bulk_delete(activities_ids)
        return response.json()


# Registers the resources
for resource_class in [
        UserResource,
        PipelineResource,
        StageResource,
        SearchResource,
        OrganizationResource,
        DealResource,
        ActivityResource,
        ActivityTypeResource,
]:
    PipedriveAPI.register_resource(resource_class)
Пример #2
0
    def create(self, activityType):
        response = self._create(data=activityType.to_primitive())
        return dict_to_model(response.json()['data'], self.MODEL_CLASS)

    def list(self, **params):
        return CollectionResponse(self._list(params=params), self.MODEL_CLASS)

    def delete(self, activityType):
        response = self._delete(activityType.id)
        return response.json()

    def bulk_delete(self, activityTypes):
        activityTypes_ids = [activityType.id for activityType in activityTypes]

        response = self._bulk_delete(activities_ids)
        return response.json()

# Registers the resources
for resource_class in [
    UserResource,
    PipelineResource,
    StageResource,
    SearchResource,
    OrganizationResource,
    DealResource,
    ActivityResource,
    ActivityTypeResource,
]:
    PipedriveAPI.register_resource(resource_class)
Пример #3
0
    API_ACESSOR_NAME = 'dealField'
    LIST_REQ_PATH = '/dealFields'
    DETAIL_REQ_PATH = '/dealFields/{id}'


class OrganizationFieldResource(FieldResource):
    FIELD_CLASS = OrganizationField
    API_ACESSOR_NAME = 'organizationField'
    LIST_REQ_PATH = '/organizationFields'
    DETAIL_REQ_PATH = '/organizationFields/{id}'


class PersonFieldResource(FieldResource):
    FIELD_CLASS = PersonField
    API_ACESSOR_NAME = 'personField'
    LIST_REQ_PATH = '/personFields'
    DETAIL_REQ_PATH = '/personFields/{id}'


class ProductFieldResource(FieldResource):
    FIELD_CLASS = ProductField
    API_ACESSOR_NAME = 'productField'
    LIST_REQ_PATH = '/productFields'
    DETAIL_REQ_PATH = '/productFields/{id}'


PipedriveAPI.register_resource(DealFieldResource)
PipedriveAPI.register_resource(OrganizationFieldResource)
PipedriveAPI.register_resource(PersonFieldResource)
PipedriveAPI.register_resource(ProductFieldResource)