Restfulie

码农软件 · 软件分类 · WEB服务/SOAP/SOA · 2019-04-09 21:13:29

软件介绍

RESTfulie 是一个创建超媒体感知服务与客户端的Gem。在开发超媒体感知的服务和客户端的时候使用RESTfulie将非常容易。

下面描述了定义一个订单的例子,这一订单将经过一系列定义好的转变,比如从未结算到结算等等。它允许将各种各样的转变映射到对应的动作...

class Order < ActiveRecord::Base 
state :unpaid, :allow => [:latest, :pay, :cancel]
state :cancelled, :allow => :latest

transition :latest, {:action => :show}
transition :cancel, {:action => :destroy}, :cancelled
transition :pay, {}, :preparing
end

它将会生成诸如这样的一个基于atom的嵌入超媒体的资源表示:

<order> 
<product>basic rails course</product>
<product>RESTful training</product>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom"
target="_blank" rel="nofollow" href="http://www.caelum.com.br/orders/1" rel="latest" />
<atom:link xmlns:atom="http://www.w3.org/2005/Atom"
target="_blank" rel="nofollow" href="http://www.caelum.com.br/orders/1/pay" rel="pay" />
<atom:link xmlns:atom="http://www.w3.org/2005/Atom"
target="_blank" rel="nofollow" href="http://www.caelum.com.br/orders/1" rel="cancel" />

</order>

并且支持客户端调用通过消费这一资源表示而动态创建的方法:

order = Order.from_web 'http://caelum.com.br/orders/1' 
order.pay(payment)

 

本文地址:https://codercto.com/soft/d/3233.html

推荐系统实践

推荐系统实践

项亮 / 人民邮电出版社 / 2012-6-1 / 49.00元

内容简介: 随着信息技术和互联网的发展,人们逐渐从信息匮乏的时代走入了信息过载(information overload)的时代 。在这个时代,无论是信息消费者还是信息生产者都遇到了很大的挑战:对于信息消费者,从大量信息中找到自己感兴趣的信息是一件非常困难的事情;对于信息生产者,让自己生产的信息脱颖而出,受到广大用户的关注,也是一件非常困难的事情。推荐系统就是解决这一矛盾的重要工具。推荐系统......一起来看看 《推荐系统实践》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具