使用httparty处理json
require 'rubygems' require 'httparty' class Demo include HTTParty base_uri "localhost:3000/" def posts self.class.get('/users.json') end end demo = Demo.new puts demo.posts