fluke/devops-service/app/api2/parsers/deploy.rb
2016-03-01 22:05:25 +03:00

23 lines
848 B
Ruby

require_relative "request_parser"
module Devops
module API2_0
module Parser
class DeployParser < RequestParser
def deploy
r = create_object_from_json_body
names = check_array(r["names"], "Parameter 'names' should be a not empty array of strings")
tags = check_array(r["tags"], "Parameter 'tags' should be an array of strings", String, true)
build_number = check_string(r["build_number"], "Parameter 'build_number' should be a not empty string", true)
rl = check_array(r["run_list"], "Parameter 'run_list' should be an array of string", String, true)
Validators::Helpers::RunList.new(rl).validate! unless rl.nil?
check_string(r["named_task"], "Parameter 'named_task' should be a not empty string", true)
r
end
end
end
end
end