Sha256: 17e64762b432590b9521c212c622ff4d3292a10f8a05198f03a3c7d1d6b4d4fe
Contents?: true
Size: 635 Bytes
Versions: 2
Compression:
Stored size: 635 Bytes
Contents
# frozen_string_literal: true require 'googleauth' require 'google/apis/calendar_v3' require 'fileutils' module Vgcal # Class for authentication of Google API class Authorizer def initialize @credentials_path = "#{Dir.home}/.vgcal/credentials.json" @token_path = "#{Dir.home}/.vgcal/token.yaml" @scope = Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY end def credentials credential = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open(@credentials_path), scope: @scope ) credential.fetch_access_token! credential end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vgcal-0.5.1 | lib/vgcal/google/authorizer.rb |
vgcal-0.5.0 | lib/vgcal/google/authorizer.rb |