开始使用 Ruby on Rails、Web 服务和 OAuth [英] Start using Ruby on Rails, Web Services and OAuth

查看:39
本文介绍了开始使用 Ruby on Rails、Web 服务和 OAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Ruby on Rails 3,我想创建一个应用程序 APP1 作为 Web 服务.然后创建另一个 RoR 应用程序 APP2,它可以使用 OAuth 协议与 APP1 通信(发送/获取信息).

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.

我必须做什么才能开始(我不是这些主题的编程专家,但我读了很多书,我知道它们在概念上\理论上是如何工作的)?考虑实现我的自定义代码好还是使用插件或 gem 更好?为什么?

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?

如果可能,你能写一个TODO list和实现我目标的步骤吗?

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

而且,更重要你能给我推荐一些有用的(很棒)资源(比如书籍、博客文章……)关于创建 RoR 网络服务?

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

推荐答案

假设您可以决定您想要哪种种类的 Web Service,并且 RESTful XML Web Service 是可接受的选择,那么 Rails应用程序实际上默认执行此操作.当您生成脚手架代码时,您的控制器实际上已准备好作为 RESTful Web 服务进行交互.

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/休息与导轨-第 2 部分服务
  3. http://css.dzone.com/news/rest-with-rails-part-iii-using

不幸的是,这些页面上似乎存在一些 JavaScript 错误,但它们仍然可用.

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

我知道这不能回答您问题的 OAuth 部分,但是这篇文章 ( http://stakeventures.com/articles/2009/07/21/sumption-oauth-intelligently-in-rails )似乎有一些关于该主题的有用信息.请注意,如果您将使用 Rails 3,这里的信息会稍微过时,因为您需要在 Gemfile 中列出 gem 并运行 bundle install 而不是添加 config.gem... 行到您的 environment.rb 文件.

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.

这篇关于开始使用 Ruby on Rails、Web 服务和 OAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆