Module: TQ::ServiceAccount

Extended by:
ServiceAccount
Included in:
ServiceAccount
Defined in:
lib/tq.rb

Instance Method Summary collapse

Instance Method Details

#client(file) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/tq.rb', line 72

def client(file)
  creds = Google::Auth::ServiceAccountCredentials.make_creds(
     :json_key_io => File.open(file, 'r'),
     :scope => TQ::API_SCOPES
  )
  creds.fetch_access_token!

  client = CloudTasks::CloudTasksService.new
  client.authorization = creds
  client
end