<?xml version="1.0" encoding="UTF-8" ?><ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009"> <Name>[ApplicationName]</Name><Description>[Description]</Description> <!-- Administrators and users will be sent to this URL for application support --><Support><!-- URL for application setup as an optional redirect during the install --><Link rel="setup" href="[ApplicationSetupUrl]?domain=${DOMAIN_NAME}" /> <!-- URL for application configuration, accessed from the app settings page in the control panel --><Link rel="manage" href="[ApplicationAdminUrl]?domain=${DOMAIN_NAME}" /> <!-- URL explaining how customers get support. --><Link rel="support" href="[ApplicationHelpUrl]" /> <!-- URL that is displayed to admins during the deletion process, to specify policies such as data retention, how to claim accounts, etc. --><Link rel="deletion-policy" href="[ApplicationPolicyUrl]" /></Support> <!-- Show this link in Google's universal navigation for all users --><Extension id="navLink" type="link"> <Name>[ApplicationName]</Name> <Url>[ApplicationLoginUrl]?domain=${DOMAIN_NAME}</Url> <!-- Used API's --> <Scope ref="contactFeed"/> <Scope ref="spreadsheetFeed"/> <Scope ref="doclistFeed"/></Extension> <!-- Declare our OpenID realm so our app is white listed --><Extension id="realm" type="openIdRealm"> <Url>[ApplicationRealm]</Url></Extension> <Scope id="doclistFeed"> <Url>https://docs.google.com/feeds/</Url> <Reason>[Reason]</Reason></Scope> <Scope id="contactFeed"> <Url>https://www.google.com/m8/feeds/</Url> <Reason>[Reason]</Reason></Scope> </ApplicationManifest>
def login # The domain needs to be set. For example with params[:domain]authenticate_with_open_id(params[:domain]), { :required => ["http://axschema.org/contact/email"], :return_to => '/login'}) do |result, identity_url, registration| if result.successful? # Succesfully logged in, retrieve email address email = get_email(registration) else # Failed to login endend end def get_email(registration) ax_response = OpenID::AX::FetchResponse.from_success_response( request.env[Rack::OpenID::RESPONSE]) ax_response.data["http://axschema.org/contact/email"].first end
CONSUMER_KEY = "Your-consumer-key"CONSUMER_SECRET = "Your-consumer-secret" def get_contacts # Retrieve contacts email = "user@email.com" url = "https://www.google.com/m8/feeds/contacts/default/full?xoauth_requestor_id=#{email}" contacts = gdata_request(url, :get)end def gdata_request(url, method, headers = {}, data = "") uri = URI.parse(url) # Setting up two-legged-oauth consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET) oauth_params = {:consumer => consumer, :method => method, :request_uri => uri.to_s} # Set Net:HTTP connection http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.port == 443) if method == :post req = Net::HTTP::Post.new(uri.request_uri) req.body = data else req = Net::HTTP::Get.new(uri.request_uri) end # Set authorization header oauth_helper = OAuth::Client::Helper.new(req, oauth_params) req.initialize_http_header(headers.merge({'Authorization' => oauth_helper.header})) # Execute request response = http.request(req) response.body end
def submit_csv_to_gdocs email = 'user@email.com' url = 'https://docs.google.com/feeds/default/private/full?xoauth_requestor_id=#{email}' # Create new CSV csv = StringIO.new CSV::Writer.generate(csv, ',') do |line| line << ["Example 1", "Example 2"] end csv.rewind # Send request gdata_request(url, :post, { 'Content-Type' => 'text/csv', 'Slug' => 'test.csv', 'GData-Version' => '3.0' }, csv.read)end
Want to weigh in on this topic? Discuss on Buzz
Posted by Rui Jiang, Google Apps Marketplace Team
We just released version 1.7 of the .NET GData client library which adds support for two extensions of the Google Apps Provisioning API: Organization Units and Multiple Domains. It also adds a default retry count for failed HTTP requests and fixes a set of issues, including one on the implementation of the ResumableUploader component introduced in the previous version.
For the complete list of changes, check the Release Notes: http://google-gdata.googlecode.com/svn/trunk/clients/cs/RELEASE_NOTES.HTML
The new version of the .NET GData client library can be downloaded from http://code.google.com/p/google-gdata/downloads/list and, as usual, you are invited to report issues of file feature requests at http://code.google.com/p/google-gdata/issues/list.
Posted by Claudio Cherubino, Developer Relations Team