gdrivestrg 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,15 +46,16 @@ class GdriveStrg < CloudStrg::CloudStorage
46
46
  elsif params[:error] # User denied the oauth grant
47
47
  puts "Denied: #{params[:error]}"
48
48
  else
49
- if params[:refresh_token] and params[:access_token] and params[:expires_in]
50
- session[:gdrive_access_token] = params[:access_token]
51
- # user.gdrive_access_token = @client.authorization.access_token
49
+ if params[:refresh_token] and params[:expires_in]
52
50
  user_params.refresh_token = params[:refresh_token]
53
51
  user_params.expires_in = params[:expires_in]
54
52
  user_params.save()
55
53
  user_params.issued_at = user_params.updated_at
56
54
  user_params.save()
57
55
  end
56
+ if params[:access_token]
57
+ session[:gdrive_access_token] = params[:access_token]
58
+ end
58
59
  @client.authorization.update_token!(:access_token => session[:gdrive_access_token] , #:access_token => user_params.access_token,
59
60
  :refresh_token => user_params.refresh_token,
60
61
  :expires_in => user_params.expires_in,
@@ -46,15 +46,16 @@ class GdriveStrg < CloudStrg::CloudStorage
46
46
  elsif params[:error] # User denied the oauth grant
47
47
  puts "Denied: #{params[:error]}"
48
48
  else
49
- if params[:refresh_token] and params[:access_token] and params[:expires_in]
50
- session[:gdrive_access_token] = params[:access_token]
51
- # user.gdrive_access_token = @client.authorization.access_token
49
+ if params[:refresh_token] and params[:expires_in]
52
50
  user_params.refresh_token = params[:refresh_token]
53
51
  user_params.expires_in = params[:expires_in]
54
52
  user_params.save()
55
53
  user_params.issued_at = user_params.updated_at
56
54
  user_params.save()
57
55
  end
56
+ if params[:access_token]
57
+ session[:gdrive_access_token] = params[:access_token]
58
+ end
58
59
  @client.authorization.update_token!(:access_token => session[:gdrive_access_token] , #:access_token => user_params.access_token,
59
60
  :refresh_token => user_params.refresh_token,
60
61
  :expires_in => user_params.expires_in,
@@ -71,7 +72,7 @@ class GdriveStrg < CloudStrg::CloudStorage
71
72
  end
72
73
  else
73
74
  begin
74
- @client.execute!(:api_method => @auth_api.userinfo.get)
75
+ r = @client.execute!(:api_method => @auth_api.userinfo.get)
75
76
  rescue Exception => e
76
77
  session.delete(:gdrive_access_token)
77
78
  session = requestAccessToken(session, user_params)
@@ -152,7 +153,7 @@ class GdriveStrg < CloudStrg::CloudStorage
152
153
  return result.data[:id]
153
154
  else
154
155
  puts "An error occurred: #{result.data['error']['message']}"
155
- return false
156
+ return nil
156
157
  end
157
158
 
158
159
  end
@@ -1,3 +1,3 @@
1
1
  module Gdrivestrg
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdrivestrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-05 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails