質問

I'm building a XML API with the help of the Grape gem. What is the best way to building XML for API actions? Since Grape isn't using standart rails controllers, i can't use views/../xml.builder. What did you suggest? Maybe there are some best practices for building xml api?

役に立ちましたか?

解決

Sinece there are no any answers, i will answer my own question. I ended up with modules where are i declare different kind of xml responses and include this modules into my Grape API. In API actions i just calling response methods from this modules. With this approach my code is clear and separated.

他のヒント

It seems to be sample. Just provide format to tell grape your default format

format :xml
content_type :xml, "text/xml"

Then add .xml to the end of request url.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top