fluke/devops-service/app/api3/parsers/user.rb

37 lines
825 B
Ruby
Raw Normal View History

2018-04-04 22:44:39 +03:00
require_relative "request_parser"
module Devops
module API3
module Parser
class UserParser < RequestParser
def create
create_object_from_json_body
end
def update_user
create_object_from_json_body
end
def roles
roles = create_object_from_json_body(Array)
check_array(roles, "Body must be a not empty array of strings")
roles
end
def change_password
body = create_object_from_json_body
check_string(body["password"], "Parameter 'password' must be a not empty string")
end
def change action
body = create_object_from_json_body
check_string(body[action], "Parameter '#{action}' must be a not empty string")
end
end
end
end
end