Exemplo n.º 1
0
    def deserialize(cls, data):
        # type: (dict) -> Job

        sources = [Source.deserialize(source) for source in data['sources']]
        date_created = datetime_serialization.deserialize(data['dateCreated'])
        date_updated = datetime_serialization.deserialize(data['dateUpdated'])
        callback_data = data.get('callback')
        callback = Callback.deserialize(
            callback_data) if callback_data else None
        specification = data['specification']
        if cls.specification_type:
            specification = cls.specification_type.deserialize(specification)

        result_data = data.get('result')
        if result_data:
            # todo: deserialize result payload as specific type
            result = RestResult.deserialize(result_data)
        else:
            result = None

        job = cls(data['id'], data['issuer'],
                  data['status'], specification, sources, callback,
                  data.get('flowId'), result, date_created, date_updated)
        job.type = data['type']
        return job
Exemplo n.º 2
0
    def deserialize(cls, data):
        # type: (dict) -> Invocation
        sources = [Source.deserialize(s) for s in data['sources']]
        callback_data = data.get('callback')
        callback = Callback.deserialize(
            callback_data) if callback_data else None

        return cls(data['entryPoints'], sources, callback,
                   data.get('errorStrategy'))
Exemplo n.º 3
0
    def test_deserialize(self):
        data = {
            'fileId': None,
            'path': '/fish.jpg',
        }

        source = Source.deserialize(data)

        assert_that(source.serialize(), is_(data))
    def deserialize(cls, data):
        # type: (dict) -> Component
        specification_type = _SPECIFICATIONS[data['type']]
        specification = specification_type.deserialize(
            data['specification']) if specification_type else None

        callback_data = data.get('callback')
        callback = Callback.deserialize(
            callback_data) if callback_data else None
        sources = [Source.deserialize(s) for s in data.get('sources', [])]

        return cls(data['type'], data.get('successors', []), specification,
                   data.get('deleteSources', False), callback, sources)
    def deserialize(cls, data):
        # type: (dict) -> ExtractArchiveSpecification

        extraction_report_data = data.get('extractedFilesReport')
        if extraction_report_data:
            extraction_report = ExtractionReport.deserialize(
                extraction_report_data)
        else:
            extraction_report = None

        source_data = data.get('source')
        source = Source.deserialize(source_data) if source_data else None
        return ExtractArchiveSpecification(
            source, Destination.deserialize(data['destination']),
            extraction_report)