ActiveResource as API test rig?

Hi,

I’m using ActiveResource as an API test rig for an API we’re developing for our PHP app - the goal being to validate that we’re following some externally validated conventions for ReSTful API and that we can support at least one external framework. ;^) I’m open to opinions on the wisdom of this approach.

Meanwhile, I’m getting some strange behavior when running from command line vs. running w/in rails:

First, from command line:

require ‘rubygems’

require ‘activesupport’
require ‘activeresource’

class Channel < ActiveResource::Base
self.site = “http://192.168.1.101/

self.format = :json
end

c = Channel.find(:all , :params => {:owner => “iamwill”})

Result is:
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/json/decoding.rb:14:in `decode’: Invalid JSON string (ActiveSupport::JSON::ParseError)

from /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/formats/json_format.rb:19:in `decode'
from /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/connection.rb:116:in `get'

from /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:576:in `find_every'
from /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:519:in `find'

from channels.rb:10

But when I run from rails, it parses no problem.

I gave the rails version malformed json to cause it to choke to figure out the difference:

vendor/rails/activesupport/lib/active_support/json/decoding.rb:14:in `decode'

Is it possible to coerce the non-rails version to use the rails json parser? Why are there two different versions?

Thanks,

m