Howto rebuild a object from a received xml hash structure?

im my web server app , i have an action to be used as a REST web
service

GET /user/membership.xml?email=emailaddress

def membership
@user = User.find_by_email(params[:email])
respond_to do |format|
format.xml { render :xml => @user.to_xml( :only =>
[ :first_name, :last_name, :display_name, :membership_type,
:membership_at], :skip_types
=> true)}
end
end

my client web app get it :

@referee = Referee.new(params[:referee])
url = "http://#{WWW_HOST}/user/membership.xml?

email=#{params[:referee][:email]}"
result = Net::HTTP.get(URI(url))
data = XmlSimple.xml_in(result)

------------ GOT IT BACK
data
=> {“last-name”=>[{“nil”=>“true”}], “display-name”=>[“chane850”],
“first-name”=>[{“nil”=>“true”}], “membership-
at”=>[“2007-03-28T21:25:31Z”]}

how can I rebuild a membership object (not active record) from it, to
reuse it late
@membership = Membership.new
@membership.last_name = data ??? that’s the question !!!

thanks for your lights

Erwin

have you tried using the magic of activeresource (the web services bit
not just the nice routes and helpers)

try this link for starters. It’s a little out of date, but
activeresource has just got a whole lot better
http://ryandaigle.com/articles/2007/3/14/rest-activeresource

You should be able to just make a class that inherits from
ActiveResource::Base and it will interface nicely with your web server
app.

Joe