Class: Mihari::Clients::GreyNoise
- Defined in:
- lib/mihari/clients/greynoise.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#gnql_search(query, size: nil, scroll: nil) ⇒ Hash
GNQL (GreyNoise Query Language) is a domain-specific query language that uses Lucene deep under the hood.
-
#initialize(base_url = "https://api.greynoise.io", api_key:, headers: {}) ⇒ GreyNoise
constructor
A new instance of GreyNoise.
Constructor Details
#initialize(base_url = "https://api.greynoise.io", api_key:, headers: {}) ⇒ GreyNoise
Returns a new instance of GreyNoise.
11 12 13 14 15 16 |
# File 'lib/mihari/clients/greynoise.rb', line 11 def initialize(base_url = "https://api.greynoise.io", api_key:, headers: {}) raise(ArgumentError, "'api_key' argument is required") unless api_key headers["key"] = api_key super(base_url, headers: headers) end |
Instance Method Details
#gnql_search(query, size: nil, scroll: nil) ⇒ Hash
GNQL (GreyNoise Query Language) is a domain-specific query language that uses Lucene deep under the hood
27 28 29 30 31 |
# File 'lib/mihari/clients/greynoise.rb', line 27 def gnql_search(query, size: nil, scroll: nil) params = { query: query, size: size, scroll: scroll }.compact res = get("/v2/experimental/gnql", params: params) Structs::GreyNoise::Response.from_dynamic! JSON.parse(res.body.to_s) end |