from flask import jsonify
from flask.views import View

from pycs.jobs.JobRunner import JobRunner


class ListJobs(View):
    """
    return a list ob jobs
    """
    # pylint: disable=arguments-differ
    methods = ['GET']

    def __init__(self, jobs: JobRunner):
        # pylint: disable=invalid-name
        self.jobs = jobs

    def dispatch_request(self):
        return jsonify(self.jobs.list())
