Skip to content

Commit 28adb02

Browse files
committed
googleapis#189 - Fix legacy file storage
1 parent 21cd5b2 commit 28adb02

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

lib/google/api_client/auth/file_storage.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ class APIClient
2929
#
3030
class FileStorage
3131

32-
attr_accessor :storage,
33-
:path
32+
attr_accessor :storage
3433

3534
def initialize(path)
36-
@path = path
37-
store = Google::APIClient::FileStore.new(@path)
35+
store = Google::APIClient::FileStore.new(path)
3836
@storage = Google::APIClient::Storage.new(store)
3937
@storage.authorize
4038
end
@@ -54,8 +52,7 @@ def authorization
5452
# Optional authorization instance. If not provided, the authorization
5553
# already associated with this instance will be written.
5654
def write_credentials(auth=nil)
57-
self.authorization = auth unless auth.nil?
58-
storage.write_credentials(self.authorization)
55+
storage.write_credentials(auth)
5956
end
6057
end
6158
end

lib/google/api_client/auth/installed_app.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class APIClient
3232
# client.authorization = flow.authorize
3333
#
3434
class InstalledAppFlow
35-
35+
3636
RESPONSE_BODY = <<-HTML
3737
<html>
3838
<head>
3939
<script>
40-
function closeWindow() {
40+
function closeWindow() {
4141
window.open('', '_self', '');
4242
window.close();
4343
}
@@ -47,14 +47,14 @@ class InstalledAppFlow
4747
<body>You may close this window.</body>
4848
</html>
4949
HTML
50-
50+
5151
##
5252
# Configure the flow
5353
#
5454
# @param [Hash] options The configuration parameters for the client.
5555
# @option options [Fixnum] :port
5656
# Port to run the embedded server on. Defaults to 9292
57-
# @option options [String] :client_id
57+
# @option options [String] :client_id
5858
# A unique identifier issued to the client to identify itself to the
5959
# authorization server.
6060
# @option options [String] :client_secret
@@ -73,19 +73,19 @@ def initialize(options)
7373
:redirect_uri => "http://localhost:#{@port}/"}.update(options)
7474
)
7575
end
76-
76+
7777
##
7878
# Request authorization. Opens a browser and waits for response.
7979
#
80-
# @param [Google::APIClient::FileStorage] storage
80+
# @param [Google::APIClient::Storage] storage
8181
# Optional object that responds to :write_credentials, used to serialize
8282
# the OAuth 2 credentials after completing the flow.
8383
#
8484
# @return [Signet::OAuth2::Client]
8585
# Authorization instance, nil if user cancelled.
8686
def authorize(storage=nil)
8787
auth = @authorization
88-
88+
8989
server = WEBrick::HTTPServer.new(
9090
:Port => @port,
9191
:BindAddress =>"localhost",

0 commit comments

Comments
 (0)