Roland asked that I put a quick Ruby snippet up for gaining access to your blog's ID. Remember, we are trying to work within the existing APIs and have not yet released an API of our own which would ride on top of (or directly along-side) what is already out there. We tend to move slowly here out of respect for the developers.:)
--------------------------------------------------------------------
require 'xmlrpc/client'
USER = 'XXX'
PASS = 'XXX'
begin
server = XMLRPC::Client.new('www.blogware.com', '/xmlrpc.cgi', 80)
puts "XMLRPC Methods:"
puts server.call('system.listMethods2')
puts
# create a few "proxy" objects to make our code look nicer
mt = server.proxy("mt")
blogger = server.proxy("blogger", "some_appkey")
meta = server.proxy("metaWeblog")
blogs = blogger.getUsersBlogs(USER, PASS)
if blogs.empty?
raise("You don't own any blogs!")
end
blog = blogs.first
puts "Categories for blog # #{blog['blogid']} - #{blog['blogName']}:"
cats = meta.getCategories(blog['blogid'], USER, PASS)
cats.each { |name, struct|
puts "#{name}"
struct.each { |key, val|
puts "\t#{key}: #{val}"
}
}
rescue XMLRPC::FaultException => err
puts "Error: #{err.faultString}"
exit
end
----------------------------------------------------------------------------------------
No error checking was performed for this - just a quick implementation based on a request. Hope it helps. And, does this satisfy my post for today? Yeah baby!
PS, I did not write this code, it was one of my cool partners in crime.
|
|
||||
|
Comments
Re: Ruby request from Roland
by
Anonymous
on Wed 21 Jun 2006 01:31 PM PDT | Permanent Link
What do you mean? Please tell me more.
|
||||
|
||||