diff --git a/Gemfile.lock b/Gemfile.lock index d11fd70..c5f1210 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: git@github.com:alphagov/google-auth-bridge.git - revision: 61b3d98bb8139c9ece885ae336619b34c46e583d + revision: f641ca1e1f9eded25456e3af0099d694f9e654a5 specs: - google-auth-bridge (0.0.1) + google-auth-bridge (0.0.2) google-api-client oauth2 @@ -12,11 +12,11 @@ GEM activesupport (3.2.6) i18n (~> 0.6) multi_json (~> 1.0) - addressable (2.2.8) - autoparse (0.2.3) - addressable (~> 2.2.2) + addressable (2.3.2) + autoparse (0.3.2) + addressable (>= 2.3.1) extlib (>= 0.9.15) - json (>= 1.4.6) + multi_json (>= 1.0.0) builder (3.0.0) bunny (0.8.0) chronic (0.6.7) @@ -24,30 +24,28 @@ GEM builder (>= 2.1.2) diff-lcs (1.1.3) extlib (0.9.15) - faraday (0.8.1) + faraday (0.8.4) multipart-post (~> 1.1) gli (1.6.0) - google-api-client (0.3.0) - addressable (~> 2.2.2) - autoparse (~> 0.2.0) + google-api-client (0.4.5) + addressable (>= 2.3.2) + autoparse (>= 0.3.2) extlib (>= 0.9.15) - httpadapter (~> 1.0.1) - json (>= 1.4.6) - launchy (>= 2.0.0) - signet (~> 0.2.2) + faraday (~> 0.8.1) + launchy (>= 2.1.1) + multi_json (>= 1.0.0) + signet (>= 0.4.1) + uuidtools (>= 2.1.0) google_drive (0.3.1) nokogiri (>= 1.4.4, != 1.5.2, != 1.5.1) oauth (>= 0.3.6) oauth2 (>= 0.5.0) - httpadapter (1.0.1) - addressable (~> 2.2.0) httpauth (0.1) i18n (0.6.0) - json (1.7.4) jwt (0.1.5) multi_json (>= 1.0) - launchy (2.1.0) - addressable (~> 2.2.6) + launchy (2.1.2) + addressable (~> 2.3) metaclass (0.0.1) mocha (0.10.5) metaclass (~> 0.0.1) @@ -71,11 +69,12 @@ GEM rspec-expectations (2.11.2) diff-lcs (~> 1.1.3) rspec-mocks (2.11.1) - signet (0.2.4) - addressable (~> 2.2.1) - httpadapter (~> 1.0.0) - json (>= 1.4.6) - jwt (>= 0.1.4) + signet (0.4.1) + addressable (>= 2.2.3) + faraday (~> 0.8.1) + jwt (>= 0.1.5) + multi_json (>= 1.0.0) + uuidtools (2.1.3) whenever (0.7.3) activesupport (>= 2.3.4) chronic (~> 0.6.3) diff --git a/lib/narrative.rb b/lib/narrative.rb index 8233145..b9b3294 100644 --- a/lib/narrative.rb +++ b/lib/narrative.rb @@ -66,11 +66,16 @@ def response def get_worksheet(authorization_code) key = ENV['WORKSHEET'] || '0AhRGSTCqlCiqdDNiVXFsdmh6RVV5N1lENE14X3lTcmc' - authentication = GoogleAuthenticationBridge::GoogleAuthentication.create_from_config_file(API_SCOPE, '/var/tmp/google_credentials.yml') - token = authentication.get_oauth2_access_token(authorization_code) + token = get_google_auth.get_oauth2_access_token(authorization_code) session = GoogleDrive.login_with_oauth(token) session.spreadsheet_by_key(key).worksheets[0] end + def get_google_auth + GoogleAuthenticationBridge::GoogleAuthentication.create_from_config_file( + API_SCOPE, '/etc/gds/google_credentials.yml', "/var/lib/gds/google-drive-token.yml" + ) + end + end end