Skip to content
This repository has been archived by the owner on Apr 4, 2018. It is now read-only.

Commit

Permalink
Explicitly set google token file
Browse files Browse the repository at this point in the history
author: @jthoenes
author: @robyoung
  • Loading branch information
robyoung committed Aug 22, 2012
1 parent b8574fa commit a7f9320
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
47 changes: 23 additions & 24 deletions 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

Expand All @@ -12,42 +12,40 @@ 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)
ci_reporter (1.7.0)
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)
Expand All @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions lib/narrative.rb
Expand Up @@ -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

0 comments on commit a7f9320

Please sign in to comment.