本文介绍了获得on Rails的3个应用程序在Ruby开始使用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我就要开始学习Rails的。现在的Rails 3已经出来了,我要坚持学习Rails的处事3路。有一个问题我想学习如何做的事情是如何使用Web服务与第三方/ REST工作的API /创建混搭的应用程序。我只是做了很少的工作像这样使用PHP和pre-建库。

So I'm getting started learning Rails. Now that Rails 3 is out, I want to stick to learning the Rails 3 way of doing things. One of the things I want to learn how to do is how to consume web services / work with third party REST APIs / create "mashup" applications. I've only done minimal work like this with PHP and pre-built libraries.

可有人请带我到一些资源,最佳实践,或者给我如何启动这些类型的API工作快101教训?我应该使用什么宝石?一些示例code让我开始将是非常美联社preciated。

Can someone please lead me to some resources, best practices, or give me a quick 101 lesson on how to start working with these types of APIs? What gems should I use? Some sample code to get me started would be much appreciated.

更新:我特别想使用谷歌图书API(非认证)。既然有这个API没有客户端库,我不知道如何其他的Ruby / Rails开发者与不拿出自己的Ruby库API的工作。这就是为什么我在寻找一个更通用的解决方案与填空API的工作。

Update: I am specifically trying to use the Google Books API (non-authenticated). Since there is no client library for this API, I'm wondering how other Ruby/Rails developers are working with APIs that don't come with their own Ruby library. That's why I'm looking for a more generic solution to working with "fill in the blank" API.

更新:经过一番研究,我发现的Net :: HTTP库。所有这一切谈论它的教程是相当古老。这仍然是地用于使用REST Web服务最好的图书馆吗?还是有新的宝石,使得这更容易?我只是想知道我应该使用哪种宝石/库,以及如何与返回的XML / JSON结果的工作。

Update: After some research, I noticed the Net::HTTP library. All the tutorials that talked about it were fairly old. Is this still the best library to use for consuming RESTful web services? Or is there a newer Gem that makes this easier? I just want to know which gem/library I should use, and how to work with the XML/JSON result that is returned.

更新::此presentation是真的很有帮助。它提到了一堆不同的库中,并显示一些下面提到的图书馆的例子:http://www.slideshare.net/pengwynn/json-and-the-apinauts

Update: This presentation was really helpful. It mentions a bunch of different libraries and shows examples of some of the libraries mentioned below: http://www.slideshare.net/pengwynn/json-and-the-apinauts

推荐答案

我。

这是对的Net :: HTTP之上的抽象层为使用Web服务一个可爱的小DSL。 这里的是多么易于使用的一个很好的例子。

It's an abstraction layer on top of Net::HTTP with a nice little DSL for consuming web services. Here's a good example of how easy it is to use.

这不是没有一些疣(大量依赖的),但它确实,如果你在消费方的路要走。

It's not without some warts (lots of dependencies) but it's really the way to go if you're on the consuming side.

这篇关于获得on Rails的3个应用程序在Ruby开始使用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 08:21