def parse_method(c, parent_object): """ Parse RAML method :param c: ParseContext object which contains RamlMethod :type c: ParseContext :param parent_object: RamlRoot, RamlResource or RamlResourceType object :type parent_object: RamlRoot or RamlResource or RamlResourceType :return: RamlMethod or None :rtype: RamlMethod """ method = RamlMethod() method.responses = c.get_property_with_schema("responses", RamlMethod.responses) method.description = c.get_string_property("description") #print "parse_method", method.description #print "parse_method",c.data context = ParseContext(c.get("body"), c.relative_path) method.body = parse_body(context) method.queryParameters = c.get_property_with_schema( "queryParameters", RamlMethod.queryParameters) method.is_ = c.get_string_property("is") return method
def parse_method(ctx): """ Parse RAML resource method. Parsing happens in a separate function(here) because of need to parse ``is`` key as ``is_`` field. :param ctx: ParseContext object which contains RamlMethod :type ctx: ParseContext :param parent_object: RamlRoot, RamlResource or RamlResourceType object :type parent_object: RamlRoot or RamlResource or RamlResourceType :return: RamlMethod or None :rtype: RamlMethod """ method = RamlMethod() method.description = ctx.get_property_with_schema( "description", RamlMethod.description) method.body = ctx.get_property_with_schema("body", RamlMethod.body) method.baseUriParameters = ctx.get_property_with_schema( "baseUriParameters", RamlMethod.baseUriParameters) method.headers = ctx.get_property_with_schema( "headers", RamlMethod.headers) method.protocols = ctx.get_property_with_schema( "protocols", RamlMethod.protocols) method.responses = ctx.get_property_with_schema( "responses", RamlMethod.responses) method.is_ = ctx.get_property_with_schema( RamlMethod.is_.field_name, RamlMethod.is_) method.queryParameters = ctx.get_property_with_schema( "queryParameters", RamlMethod.queryParameters) method.securedBy = ctx.get_property_with_schema( 'securedBy', RamlMethod.securedBy) return method
def parse_method(ctx): """ Parse RAML resource method. Parsing happens in a separate function(here) because of need to parse ``is`` key as ``is_`` field. :param ctx: ParseContext object which contains RamlMethod :type ctx: ParseContext :param parent_object: RamlRoot, RamlResource or RamlResourceType object :type parent_object: RamlRoot or RamlResource or RamlResourceType :return: RamlMethod or None :rtype: RamlMethod """ method = RamlMethod() method.description = ctx.get_property_with_schema("description", RamlMethod.description) method.body = ctx.get_property_with_schema("body", RamlMethod.body) method.baseUriParameters = ctx.get_property_with_schema( "baseUriParameters", RamlMethod.baseUriParameters) method.headers = ctx.get_property_with_schema("headers", RamlMethod.headers) method.protocols = ctx.get_property_with_schema("protocols", RamlMethod.protocols) method.responses = ctx.get_property_with_schema("responses", RamlMethod.responses) method.is_ = ctx.get_property_with_schema(RamlMethod.is_.field_name, RamlMethod.is_) method.queryParameters = ctx.get_property_with_schema( "queryParameters", RamlMethod.queryParameters) method.securedBy = ctx.get_property_with_schema('securedBy', RamlMethod.securedBy) return method
def parse_method(c, parent_object): """ Parse RAML method :param c: ParseContext object which contains RamlMethod :type c: ParseContext :param parent_object: RamlRoot, RamlResource or RamlResourceType object :type parent_object: RamlRoot or RamlResource or RamlResourceType :return: RamlMethod or None :rtype: RamlMethod """ method = RamlMethod() method.responses = c.get_property_with_schema("responses", RamlMethod.responses) method.description = c.get_string_property("description") method.body = parse_body(ParseContext(c.get("body"), c.relative_path), method) return method