Commit Graph

14 Commits

Author SHA1 Message Date
Steven Bazyl 8510735db8 Resolve merge conflict, update rspec syntax 2014-12-15 13:32:54 -08:00
Abdelkader Boudih e313235b55 Replace deprecated method that cause ruby warnings File.exit? 2014-10-08 12:02:36 +00:00
Volker Zöpfel 18c4bab286 remove deprecation warning 2013-11-28 12:29:55 +01:00
Volker Zöpfel 80d25c219b bugfix file_storage 2013-11-28 12:26:25 +01:00
Volker Zöpfel 6404615a57 uses new initialize and authorize 2013-11-18 11:39:40 +01:00
Michael C. Beck 34d3c18fed added deprecation warnings to file_storage 2013-11-15 10:27:46 +01:00
Michael C. Beck 0e9637c77c rename file_store 2013-11-15 10:26:18 +01:00
Volker Zöpfel c2135d9dcf split storages in own adapter classes, added redis adapter 2013-11-14 15:50:06 +01:00
Volker Zöpfel bd7cf179f3 adds Constants for Authorization_uri, Token_credentials_uri
extracts authorize
extracts credentials_hash
2013-11-14 14:45:36 +01:00
Volker Zöpfel bbb24a5d2e using the path= method on initialize 2013-11-14 08:32:47 +01:00
Volker Zöpfel 10a337b807 adds method path= to proof if file can be accessed 2013-11-14 08:31:21 +01:00
Volker Zöpfel 146ccad83a using symbols as hash keys 2013-11-14 08:19:21 +01:00
Volker Zöpfel 5538bded1f refactoring load_credentials
adding refresh_authorization

write_credentials now using the authorizations methods not the instance variables, Using the instance variables can cause problems.
2013-11-14 08:17:08 +01:00
Jeff Posnick fb67a021e7 Added Google::APIClient::FileStorage, to save OAuth 2 credentials to disk
This is a (potentially rough) bit of code to persist OAuth 2
credentials to disk, similar to
http://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.
file.Storage-class.html

It can be used in the following manner, which roughly translates to
what the Python client library code looks like.

  file_storage = Google::APIClient::FileStorage.new("#{$0}-oauth2.json")
  if file_storage.authorization.nil?
    client_secrets = Google::APIClient::ClientSecrets.load
    flow = Google::APIClient::InstalledAppFlow.new(
      :client_id => client_secrets.client_id,
      :client_secret => client_secrets.client_secret,
      :scope => [SCOPE1, SCOPE2]
    )
    client.authorization = flow.authorize(file_storage)
  else
    client.authorization = file_storage.authorization
  end
2013-05-29 15:31:44 -04:00