I'm actually doing almost the exact same thing right now, so I know what you are going through. For ruby on rails, there's a gem out there called Garb. So far it has worked pretty well for me. Example:
results = []
Garb::Session.login(analytics_email_address, analytics_password)
web_properties = Garb::Profile.all #you can filter here with a clojure or something
for profile in web_properties
report = Garb::Report.new(profile, start_date, end_date)
report.metrics MY_METRICS #you can read about these on the analytics api docs
report.dimensions MY_DIMENSIONS #same here
results << report.results
end
#do more stuff
This is a simple/quick/dirty example, but it works; you can get the information you need about the metrics and dimensions here:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html
and Garb information here:
http://www.viget.com/extend/introducing-garb-access-the-google-analytics-data-export-api-with-ruby/
I know that reporting is really frustrating, so I wish you the best of luck!