Class: BackscatterIO::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/backscatterio/api/default_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ Api

Returns a new instance of Api.



19
20
21
# File 'lib/backscatterio/api/default_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/backscatterio/api/default_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#enrich_asn(query, opts = {}) ⇒ ASNEnrichment

enriches asn returns enrichment data for an ASN

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/backscatterio/api/default_api.rb', line 27

def enrich_asn(query, opts = {})
  data, _status_code, _headers = enrich_asn_with_http_info(query, opts)
  data
end

#enrich_asn_with_http_info(query, opts = {}) ⇒ Array<(ASNEnrichment, Fixnum, Hash)>

enriches asn returns enrichment data for an ASN

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ASNEnrichment, Fixnum, Hash)>)

    ASNEnrichment data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/backscatterio/api/default_api.rb', line 37

def enrich_asn_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.enrich_asn ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_asn"
  end
  # resource path
  local_var_path = '/enrichment/asn'

  # query parameters
  query_params = {}
  query_params[:'query'] = query

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ASNEnrichment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#enrich_asn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#enrich_ip(query, opts = {}) ⇒ IPEnrichment

enriches ip returns enrichment data for an ip

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



80
81
82
83
# File 'lib/backscatterio/api/default_api.rb', line 80

def enrich_ip(query, opts = {})
  data, _status_code, _headers = enrich_ip_with_http_info(query, opts)
  data
end

#enrich_ip_with_http_info(query, opts = {}) ⇒ Array<(IPEnrichment, Fixnum, Hash)>

enriches ip returns enrichment data for an ip

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(IPEnrichment, Fixnum, Hash)>)

    IPEnrichment data, response status code and response headers



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/backscatterio/api/default_api.rb', line 90

def enrich_ip_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.enrich_ip ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_ip"
  end
  # resource path
  local_var_path = '/enrichment/ip'

  # query parameters
  query_params = {}
  query_params[:'query'] = query

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'IPEnrichment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#enrich_ip\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#enrich_network(query, opts = {}) ⇒ NetworkEnrichment

enriches network returns enrichment data for a network

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



133
134
135
136
# File 'lib/backscatterio/api/default_api.rb', line 133

def enrich_network(query, opts = {})
  data, _status_code, _headers = enrich_network_with_http_info(query, opts)
  data
end

#enrich_network_with_http_info(query, opts = {}) ⇒ Array<(NetworkEnrichment, Fixnum, Hash)>

enriches network returns enrichment data for a network

Parameters:

  • query
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(NetworkEnrichment, Fixnum, Hash)>)

    NetworkEnrichment data, response status code and response headers



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/backscatterio/api/default_api.rb', line 143

def enrich_network_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.enrich_network ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_network"
  end
  # resource path
  local_var_path = '/enrichment/network'

  # query parameters
  query_params = {}
  query_params[:'query'] = query

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'NetworkEnrichment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#enrich_network\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#hello(opts = {}) ⇒ Hello

authenticate to the service

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



184
185
186
187
# File 'lib/backscatterio/api/default_api.rb', line 184

def hello(opts = {})
  data, _status_code, _headers = hello_with_http_info(opts)
  data
end

#hello_with_http_info(opts = {}) ⇒ Array<(Hello, Fixnum, Hash)>

authenticate to the service

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hello, Fixnum, Hash)>)

    Hello data, response status code and response headers



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/backscatterio/api/default_api.rb', line 192

def hello_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.hello ...'
  end
  # resource path
  local_var_path = '/hello'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Hello')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#hello\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#observations(query_type, query, opts = {}) ⇒ Observations

fetches observations for a given ip address

Parameters:

  • query_type

    query type ip, network, asn, port, country

  • query

    ip address, cidr block, asn, port, or country

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :scope (String)

    timeframe to search over, e.g., 1d, 7d

Returns:



233
234
235
236
# File 'lib/backscatterio/api/default_api.rb', line 233

def observations(query_type, query, opts = {})
  data, _status_code, _headers = observations_with_http_info(query_type, query, opts)
  data
end

#observations_with_http_info(query_type, query, opts = {}) ⇒ Array<(Observations, Fixnum, Hash)>

fetches observations for a given ip address

Parameters:

  • query_type

    query type ip, network, asn, port, country

  • query

    ip address, cidr block, asn, port, or country

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :scope (String)

    timeframe to search over, e.g., 1d, 7d

Returns:

  • (Array<(Observations, Fixnum, Hash)>)

    Observations data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/backscatterio/api/default_api.rb', line 244

def observations_with_http_info(query_type, query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.observations ...'
  end
  # verify the required parameter 'query_type' is set
  if @api_client.config.client_side_validation && query_type.nil?
    fail ArgumentError, "Missing the required parameter 'query_type' when calling Api.observations"
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling Api.observations"
  end
  # resource path
  local_var_path = '/observations/{queryType}'.sub('{' + 'queryType' + '}', query_type.to_s)

  # query parameters
  query_params = {}
  query_params[:'query'] = query
  query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Observations')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#observations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Top N items A listing of the top N items observered over the query scope

Parameters:

  • trend_type

    which item type you want to perform a trend over

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :scope (String)

    timeframe to search over, e.g., 1d, 7d

Returns:



295
296
297
298
# File 'lib/backscatterio/api/default_api.rb', line 295

def trends(trend_type, opts = {})
  data, _status_code, _headers = trends_with_http_info(trend_type, opts)
  data
end

Top N items A listing of the top N items observered over the query scope

Parameters:

  • trend_type

    which item type you want to perform a trend over

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :scope (String)

    timeframe to search over, e.g., 1d, 7d

Returns:

  • (Array<(Trends, Fixnum, Hash)>)

    Trends data, response status code and response headers



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/backscatterio/api/default_api.rb', line 306

def trends_with_http_info(trend_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Api.trends ...'
  end
  # verify the required parameter 'trend_type' is set
  if @api_client.config.client_side_validation && trend_type.nil?
    fail ArgumentError, "Missing the required parameter 'trend_type' when calling Api.trends"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['ip', 'network', 'asn', 'port', 'country'].include?(trend_type)
    fail ArgumentError, "invalid value for 'trend_type', must be one of ip, network, asn, port, country"
  end
  # resource path
  local_var_path = '/trends/popular/{trendType}'.sub('{' + 'trendType' + '}', trend_type.to_s)

  # query parameters
  query_params = {}
  query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Trends')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Api#trends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end