|
Project Information
Featured
Downloads
|
We were working on a Marketplace integration for our rails application, and found scant resources for handling the Oauth and Gdata resources in Ruby without a lot of pain. A lot of information out there is out of date or targeted at consumer accounts, not Apps / Marketplace uses. This simple library is designed as convenience layer so that all you need to accomplish your user provisioning (and other sync points) is your Apps customer's domain name and your oauth consumer key and secret retrieved from your listing. The library layers filters on the return data itself, so you can get raw access if you already have an XML solution, or you can use the included parse to OpenStruct layer. Finally, it implements a Memcache layer around the OpenStruct results. # Example cached openstruct use: # you can turn off cache by setting class var to nil, or # by skipping the cache layer this way: # m.data.users # basically, just insert .data in any request # Just stick this file in your lib dir for your app, or wherever require can find it require 'lib/gdata_marketplace' m = GDataMarketplace::Client.new GOOGLE_CONSUMER_KEY, GOOGLE_CONSUMER_SECRET, 'someone@appsclient.com' # or, if you don't care about default user identity: # m = GDataMarketplace::Client.new GOOGLE_CONSUMER_KEY, GOOGLE_CONSUMER_SECRET, 'appsclient.com' allusers = m.users allgroups = m.groups auser = m.user "someone" agroup = m.group "agroupid" agroup = m.group m.groups.first.groupId agroupsmembers = m.group_members m.groups.first.groupId # Example raw XML string access: # turn off auto response parse m.response_format = :net_http # returns the Net::HTTP response object # get request body xmlstring = (m.request_user_provision :all).body # for all users xmlstring = (m.request_user_provision "username").body # for a user # etc |