aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/examples/simple.rb
blob: 6d2c6e3b1bc4a9721ac9e9f9aff5a03a692553b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
require 'active_support/core_ext/hash/conversions'

ActiveSupport::XmlMini.backend = ENV['XMLMINI'] || 'REXML'
ActiveResource::HttpMock.respond_to do |mock|
  mock.get '/people/1.xml', {}, { :id => 1, :name => 'bob' }.to_xml(:root => 'person')
end

class Person < ActiveResource::Base
  self.site = 'http://localhost/'
end

bob = Person.find(1)
puts bob.inspect