Created
May 29, 2015 02:57
Revisions
-
nagachika created this gist
May 29, 2015 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ /.bundle /vendor/bundle /.envrc This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ source "https://rubygems.org" gem "signet" gem "picasa" This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ GEM remote: https://rubygems.org/ specs: addressable (2.3.8) extlib (0.9.16) faraday (0.9.1) multipart-post (>= 1.2, < 3) httparty (0.13.5) json (~> 1.8) multi_xml (>= 0.5.2) json (1.8.2) jwt (1.5.0) multi_json (1.11.0) multi_xml (0.5.5) multipart-post (2.0.0) picasa (0.7.5) httparty signet (0.6.0) addressable (~> 2.3) extlib (~> 0.9) faraday (~> 0.9) jwt (~> 1.0) multi_json (~> 1.10) PLATFORMS ruby DEPENDENCIES picasa signet This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # coding: utf-8 require "picasa" require "signet/oauth_2" require "signet/oauth_2/client" oauth2_client = Signet::OAuth2::Client.new( token_credential_uri: "https://accounts.google.com/o/oauth2/token", client_id: ENV["GOOGLE_OAUTH_CLIENT_ID"], client_secret: ENV["GOOGLE_OAUTH_CLIENT_SECRET"], redirect_uri: ENV["GOOGLE_OAUTH_REDIRECT"], scope: "https://picasaweb.google.com/data/", refresh_token: ENV["GOOGLE_OAUTH_REFRESH_TOKEN"] ) p oauth2_client.refresh! p ::Signet::OAuth2.generate_bearer_authorization_header(oauth2_client.access_token) picasa = Picasa::Client.new(user_id: ENV["GOOGLE_ACOUNT"], authorization_header: Signet::OAuth2.generate_bearer_authorization_header(oauth2_client.access_token)) p picasa.album.create(title: "api test", timestamp: Time.now.to_i)