Sha256: 13a2fcbd9d468d6bafeb50abaefbd80fcbea6b53af040a383e44ebcffd4e680c

Contents?: true

Size: 896 Bytes

Versions: 3

Compression:

Stored size: 896 Bytes

Contents

require 'async'
require 'vaas/client_credentials_grant_authenticator'
require 'vaas/vaas_main'

CLIENT_ID = ENV.fetch('CLIENT_ID')
CLIENT_SECRET = ENV.fetch('CLIENT_SECRET')
VAAS_URL = ENV.fetch('VAAS_URL', "wss://gateway.production.vaas.gdatasecurity.de")
TOKEN_URL = ENV.fetch('TOKEN_URL', 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token')

URL = ENV.fetch('URL')

def main
  authenticator = VAAS::ClientCredentialsGrantAuthenticator.new(
    CLIENT_ID,
    CLIENT_SECRET,
    TOKEN_URL
  )

  # create a vaas object and get a token to authenticate
  vaas = VAAS::VaasMain.new(VAAS_URL)
  token = authenticator.get_token

  Async do
    vaas.connect(token)

    verdict = vaas.for_url(URL)
    puts "Verdict #{verdict.wait.sha256} is detected as #{verdict.wait.verdict}"

    vaas.close
  end
end

if __FILE__  == $0
  main
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vaas-4.1.0 examples/simple_example.rb
vaas-4.0.0 examples/simple_example.rb
vaas-3.1.0 examples/simple_example.rb