require_relative "request_parser"

module Devops
  module API3
    module Parser
      class ScriptParser < RequestParser

        def body
          @body ||= @request.body.read
        end

        def run_script
          body = create_object_from_json_body
          nodes = check_array(body["nodes"], "Parameter 'nodes' must be a not empty array of strings")
          p = check_array(body["params"], "Parameter 'params' should be a not empty array of strings", String, true)
          return nodes, p
        end

      end
    end
  end
end
