Start using Ruby on Rails, Web Services and OAuth

匿名 (未验证) 提交于 2019-12-03 02:50:02

问题:

I am running Ruby on Rails 3 and I would like to create an application APP1 that acts as a Web Service. Then create another RoR application APP2 that can communicate (send/get information) with APP1 using the OAuth protocol.

What I have to do to start (I am not expert about programming in those topics but I read a lot and I know how they conceptually\theoretically works)? Is it good to think to implement my custom code or maybe it is better to use plugin or gem? Why?

If it is possible, can you write a TODO list and steps to accomplish what I aim?

And, more important, can you suggest me some useful (awesome) resources (like books, blog posts, ...) about creating RoR Web Services?

回答1:

Assuming you get to decide what kind of Web Service you want, and a RESTful XML Web Service is an acceptable choice, then Rails applications practically do this by default. When you generate scaffolding code, your controller will actually be ready to interface with as a RESTful Web Service.

Of course, that's not everything you need to know and do, but the subject seems to be covered very well by the following series of articles...

  1. http://css.dzone.com/news/rest-with-rails-part-1
  2. http://css.dzone.com/news/rest-with-rails-part-2-serving
  3. http://css.dzone.com/news/rest-with-rails-part-iii-using

Unfortunately, there seem to be some JavaScript errors on those pages, but they're still usable.

I know this doesn't answer the OAuth part of your question, but this article ( http://stakeventures.com/articles/2009/07/21/consuming-oauth-intelligently-in-rails ) apears to have some useful information on that subject. Note that the info here is slightly out of date if you'll be using Rails 3 because you'll want to list the gems in your Gemfile and run bundle install rather than adding config.gem ... lines to your environment.rb file.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!