Class: GreyNoise::Clients::Experimental

Inherits:
Client
  • Object
show all
Defined in:
lib/greynoise/clients/experimental.rb

Constant Summary

Constants inherited from Client

Client::BASE_URL, Client::HOST, Client::VERSION

Instance Attribute Summary

Attributes inherited from Client

#key

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from GreyNoise::Clients::Client

Instance Method Details

#gnql(query, size: nil, scroll: nil) ⇒ Hash

GNQL (GreyNoise Query Language) is a domain-specific query language that uses Lucene deep under the hood

Parameters:

  • query (String)

    GNQL query string

  • size (Integer, nil) (defaults to: nil)

    Maximum amount of results to grab

  • scroll (Integer, nil) (defaults to: nil)

    Scroll token to paginate through results

Returns:

  • (Hash)


15
16
17
18
19
20
21
22
# File 'lib/greynoise/clients/experimental.rb', line 15

def gnql(query, size: nil, scroll: nil)
  params = {
    query: query,
    size: size,
    scroll: scroll
  }.compact
  _get("/experimental/gnql", params) { |json| json }
end

#gnql_stats(query, count: nil) ⇒ Hash

Get aggregate statistics for the top organizations, actors, tags, ASNs, countries, classifications, and operating systems of all the results of a given GNQL query.

Parameters:

  • query (String)

    GNQL query string

  • count (Integer, nil) (defaults to: nil)

    Number of top aggregates to grab

Returns:

  • (Hash)


32
33
34
35
36
37
38
# File 'lib/greynoise/clients/experimental.rb', line 32

def gnql_stats(query, count: nil)
  params = {
    query: query,
    count: count
  }.compact
  _get("/experimental/gnql/stats", params) { |json| json }
end