开发者

Best practice of parsing RESTful WebService response with Rails

开发者 https://www.devze.com 2022-12-30 15:08 出处:网络
I\'m developing a开发者_如何转开发 JAX-RS application and it\'s working fine. Now, I want to develop a web service client application using Rails. And my question is which is the best way to parse a R

I'm developing a开发者_如何转开发 JAX-RS application and it's working fine. Now, I want to develop a web service client application using Rails. And my question is which is the best way to parse a RESTful webservice's response in Rails?


It depends on what the service is returning. I'd say that you could use a variety of gems to do it. Lately I've been using HTTParty to get and parse automatically the response of a call to a RESTful API.

Once I get all the data I then map it to a model so that's it's easier to manipulate later on. The way you'll do this mapping will really depend on the type on response you'll get.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号