User AppData Get (Spacer hack)

2 views
Skip to first unread message

scott persinger

unread,
Jul 22, 2008, 2:14:20 PM7/22/08
to Spacer: The MySpace Platform Ruby Client
Oh btw, adding function to Spacer to query appdata was easy:

-- spacer/lib/spacer/client.rb --

def appdata(user_id)
response = do_request "users/#{user_id}/appdata"
response['keyvaluecollection']
end

scott persinger

unread,
Jul 22, 2008, 2:19:46 PM7/22/08
to Spacer: The MySpace Platform Ruby Client
Ok, sorry, that version was crappy. This one converts the results back
to a nice ruby hash. So
far this stuff will only work with a simple name,value list. Note sure
how to handle nested data yet.

def appdata(user_id)
response = do_request "users/#{user_id}/appdata"
if (res = response['keyvaluecollection'])
hash = {}
res.each {|pair| hash[pair['key']] = pair['value']}
hash
else
{}
end
end
Reply all
Reply to author
Forward
0 new messages