Class: GoogleSpreadsheets::Auth::ServiceAccountsAccessToken
- Inherits:
-
Object
- Object
- GoogleSpreadsheets::Auth::ServiceAccountsAccessToken
- Defined in:
- lib/google_spreadsheets/auth/service_accounts_access_token.rb
Instance Method Summary collapse
- #call(connection) ⇒ Object
-
#initialize(options = {}) ⇒ ServiceAccountsAccessToken
constructor
A new instance of ServiceAccountsAccessToken.
Constructor Details
#initialize(options = {}) ⇒ ServiceAccountsAccessToken
Returns a new instance of ServiceAccountsAccessToken.
6 7 8 9 |
# File 'lib/google_spreadsheets/auth/service_accounts_access_token.rb', line 6 def initialize( = {}) @options = @options[:scope] ||= 'https://spreadsheets.google.com/feeds/' end |
Instance Method Details
#call(connection) ⇒ Object
11 12 13 14 15 |
# File 'lib/google_spreadsheets/auth/service_accounts_access_token.rb', line 11 def call(connection) @authorizer ||= Google::Auth::ServiceAccountCredentials.make_creds(@options) @authorizer.refresh! if @authorizer.expires_at.nil? || @authorizer.expired? @authorizer.access_token end |