backscatterio 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +201 -0
  4. data/README.md +120 -0
  5. data/Rakefile +8 -0
  6. data/backscatterio.gemspec +45 -0
  7. data/docs/ASNEnrichment.md +9 -0
  8. data/docs/ASNEnrichmentResults.md +11 -0
  9. data/docs/Api.md +339 -0
  10. data/docs/Hello.md +9 -0
  11. data/docs/IPEnrichment.md +9 -0
  12. data/docs/IPEnrichmentResults.md +25 -0
  13. data/docs/NetworkEnrichment.md +9 -0
  14. data/docs/NetworkEnrichmentResults.md +10 -0
  15. data/docs/Observation.md +21 -0
  16. data/docs/Observations.md +10 -0
  17. data/docs/Query.md +11 -0
  18. data/docs/Results.md +10 -0
  19. data/docs/Summary.md +15 -0
  20. data/docs/Trends.md +10 -0
  21. data/docs/Unique.md +13 -0
  22. data/git_push.sh +55 -0
  23. data/lib/backscatterio.rb +54 -0
  24. data/lib/backscatterio/api/default_api.rb +349 -0
  25. data/lib/backscatterio/api_client.rb +389 -0
  26. data/lib/backscatterio/api_error.rb +38 -0
  27. data/lib/backscatterio/configuration.rb +209 -0
  28. data/lib/backscatterio/models/asn_enrichment.rb +192 -0
  29. data/lib/backscatterio/models/asn_enrichment_results.rb +212 -0
  30. data/lib/backscatterio/models/hello.rb +192 -0
  31. data/lib/backscatterio/models/ip_enrichment.rb +192 -0
  32. data/lib/backscatterio/models/ip_enrichment_results.rb +336 -0
  33. data/lib/backscatterio/models/network_enrichment.rb +192 -0
  34. data/lib/backscatterio/models/network_enrichment_results.rb +203 -0
  35. data/lib/backscatterio/models/observation.rb +300 -0
  36. data/lib/backscatterio/models/observations.rb +201 -0
  37. data/lib/backscatterio/models/query.rb +244 -0
  38. data/lib/backscatterio/models/results.rb +203 -0
  39. data/lib/backscatterio/models/summary.rb +248 -0
  40. data/lib/backscatterio/models/trends.rb +201 -0
  41. data/lib/backscatterio/models/unique.rb +240 -0
  42. data/lib/backscatterio/version.rb +15 -0
  43. data/spec/api/default_api_spec.rb +107 -0
  44. data/spec/api_client_spec.rb +226 -0
  45. data/spec/configuration_spec.rb +42 -0
  46. data/spec/models/asn_enrichment_results_spec.rb +59 -0
  47. data/spec/models/asn_enrichment_spec.rb +47 -0
  48. data/spec/models/hello_spec.rb +47 -0
  49. data/spec/models/ip_enrichment_results_spec.rb +143 -0
  50. data/spec/models/ip_enrichment_spec.rb +47 -0
  51. data/spec/models/network_enrichment_results_spec.rb +53 -0
  52. data/spec/models/network_enrichment_spec.rb +47 -0
  53. data/spec/models/observation_spec.rb +119 -0
  54. data/spec/models/observations_spec.rb +53 -0
  55. data/spec/models/query_spec.rb +63 -0
  56. data/spec/models/results_spec.rb +53 -0
  57. data/spec/models/summary_spec.rb +83 -0
  58. data/spec/models/trends_spec.rb +53 -0
  59. data/spec/models/unique_spec.rb +71 -0
  60. data/spec/spec_helper.rb +111 -0
  61. metadata +301 -0
data/docs/Hello.md ADDED
@@ -0,0 +1,9 @@
1
+ # SwaggerClient::Hello
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **message** | **String** | | [optional]
7
+ **success** | **BOOLEAN** | | [optional]
8
+
9
+
@@ -0,0 +1,9 @@
1
+ # SwaggerClient::IPEnrichment
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **results** | [**IPEnrichmentResults**](IPEnrichmentResults.md) | | [optional]
7
+ **success** | **BOOLEAN** | | [optional]
8
+
9
+
@@ -0,0 +1,25 @@
1
+ # SwaggerClient::IPEnrichmentResults
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **as_name** | **String** | | [optional]
7
+ **as_num** | **Integer** | | [optional]
8
+ **city** | **String** | | [optional]
9
+ **country_iso** | **String** | | [optional]
10
+ **country_name** | **String** | | [optional]
11
+ **ip** | **String** | | [optional]
12
+ **ip_hex** | **String** | | [optional]
13
+ **ip_version** | **Integer** | | [optional]
14
+ **latitude** | **Float** | | [optional]
15
+ **longitude** | **Float** | | [optional]
16
+ **network** | **String** | | [optional]
17
+ **network_broadcast** | **String** | | [optional]
18
+ **network_hostmask** | **String** | | [optional]
19
+ **network_netmask** | **String** | | [optional]
20
+ **network_size** | **Integer** | | [optional]
21
+ **postal_code** | **String** | | [optional]
22
+ **region_iso** | **String** | | [optional]
23
+ **region_name** | **String** | | [optional]
24
+
25
+
@@ -0,0 +1,9 @@
1
+ # SwaggerClient::NetworkEnrichment
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **results** | [**NetworkEnrichmentResults**](NetworkEnrichmentResults.md) | | [optional]
7
+ **success** | **BOOLEAN** | | [optional]
8
+
9
+
@@ -0,0 +1,10 @@
1
+ # SwaggerClient::NetworkEnrichmentResults
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **cidr** | **String** | | [optional]
7
+ **network_addresses** | **Array<String>** | | [optional]
8
+ **network_size** | **Integer** | | [optional]
9
+
10
+
@@ -0,0 +1,21 @@
1
+ # SwaggerClient::Observation
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **dst_port** | **String** | | [optional]
7
+ **fragment_flags** | **String** | | [optional]
8
+ **id** | **String** | | [optional]
9
+ **length** | **String** | | [optional]
10
+ **observed** | **String** | | [optional]
11
+ **precedence** | **String** | | [optional]
12
+ **protocol** | **String** | | [optional]
13
+ **res** | **String** | | [optional]
14
+ **src_ip** | **String** | | [optional]
15
+ **src_port** | **String** | | [optional]
16
+ **tcp_flags** | **String** | | [optional]
17
+ **tos** | **String** | | [optional]
18
+ **ttl** | **String** | | [optional]
19
+ **window** | **String** | | [optional]
20
+
21
+
@@ -0,0 +1,10 @@
1
+ # SwaggerClient::Observations
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **query** | [**Query**](Query.md) | | [optional]
7
+ **results** | [**Results**](Results.md) | | [optional]
8
+ **success** | **BOOLEAN** | | [optional]
9
+
10
+
data/docs/Query.md ADDED
@@ -0,0 +1,11 @@
1
+ # SwaggerClient::Query
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **after_time** | **String** | | [optional]
7
+ **focus** | **String** | | [optional]
8
+ **scope** | **String** | | [optional]
9
+ **type** | **String** | | [optional]
10
+
11
+
data/docs/Results.md ADDED
@@ -0,0 +1,10 @@
1
+ # SwaggerClient::Results
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **observations** | [**Array<Observation>**](Observation.md) | | [optional]
7
+ **summary** | [**Summary**](Summary.md) | | [optional]
8
+ **unique** | [**Unique**](Unique.md) | | [optional]
9
+
10
+
data/docs/Summary.md ADDED
@@ -0,0 +1,15 @@
1
+ # SwaggerClient::Summary
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **autonomous_system_count** | **Integer** | | [optional]
7
+ **has_observations** | **BOOLEAN** | | [optional]
8
+ **ip_address_count** | **Array<String>** | | [optional]
9
+ **network_count** | **Integer** | | [optional]
10
+ **observations** | **BOOLEAN** | | [optional]
11
+ **observations_count** | **Integer** | | [optional]
12
+ **port_count** | **Integer** | | [optional]
13
+ **protocol_count** | **Integer** | | [optional]
14
+
15
+
data/docs/Trends.md ADDED
@@ -0,0 +1,10 @@
1
+ # SwaggerClient::Trends
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **query** | [**Query**](Query.md) | | [optional]
7
+ **results** | **Object** | | [optional]
8
+ **success** | **BOOLEAN** | | [optional]
9
+
10
+
data/docs/Unique.md ADDED
@@ -0,0 +1,13 @@
1
+ # SwaggerClient::Unique
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **autonomous_systems** | **Array<String>** | | [optional]
7
+ **countries** | **Array<String>** | | [optional]
8
+ **ip_addresses** | **Array<String>** | | [optional]
9
+ **networks** | **Array<String>** | | [optional]
10
+ **ports** | **Array<String>** | | [optional]
11
+ **protocols** | **Array<String>** | | [optional]
12
+
13
+
data/git_push.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id=""
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id=""
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note=""
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+
@@ -0,0 +1,54 @@
1
+ =begin
2
+ #Backscatter.io
3
+
4
+ #[This is the Backscatter.io API.](https://backscatter.io/developers)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: info@backscatter.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'backscatterio/api_client'
15
+ require 'backscatterio/api_error'
16
+ require 'backscatterio/version'
17
+ require 'backscatterio/configuration'
18
+
19
+ # Models
20
+ require 'backscatterio/models/asn_enrichment'
21
+ require 'backscatterio/models/asn_enrichment_results'
22
+ require 'backscatterio/models/hello'
23
+ require 'backscatterio/models/ip_enrichment'
24
+ require 'backscatterio/models/ip_enrichment_results'
25
+ require 'backscatterio/models/network_enrichment'
26
+ require 'backscatterio/models/network_enrichment_results'
27
+ require 'backscatterio/models/observation'
28
+ require 'backscatterio/models/observations'
29
+ require 'backscatterio/models/query'
30
+ require 'backscatterio/models/results'
31
+ require 'backscatterio/models/summary'
32
+ require 'backscatterio/models/trends'
33
+ require 'backscatterio/models/unique'
34
+
35
+ # APIs
36
+ require 'backscatterio/api/default_api'
37
+
38
+ module BackscatterIO
39
+ class << self
40
+ # Customize default settings for the SDK using block.
41
+ # BackscatterIO.configure do |config|
42
+ # config.username = "xxx"
43
+ # config.password = "xxx"
44
+ # end
45
+ # If no block given, return the default Configuration object.
46
+ def configure
47
+ if block_given?
48
+ yield(Configuration.default)
49
+ else
50
+ Configuration.default
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,349 @@
1
+ =begin
2
+ #Backscatter.io
3
+
4
+ #[This is the Backscatter.io API.](https://backscatter.io/developers)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: info@backscatter.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module BackscatterIO
16
+ class Api
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # enriches asn
23
+ # returns enrichment data for an ASN
24
+ # @param query
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ASNEnrichment]
27
+ def enrich_asn(query, opts = {})
28
+ data, _status_code, _headers = enrich_asn_with_http_info(query, opts)
29
+ data
30
+ end
31
+
32
+ # enriches asn
33
+ # returns enrichment data for an ASN
34
+ # @param query
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ASNEnrichment, Fixnum, Hash)>] ASNEnrichment data, response status code and response headers
37
+ def enrich_asn_with_http_info(query, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: Api.enrich_asn ...'
40
+ end
41
+ # verify the required parameter 'query' is set
42
+ if @api_client.config.client_side_validation && query.nil?
43
+ fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_asn"
44
+ end
45
+ # resource path
46
+ local_var_path = '/enrichment/asn'
47
+
48
+ # query parameters
49
+ query_params = {}
50
+ query_params[:'query'] = query
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
56
+
57
+ # form parameters
58
+ form_params = {}
59
+
60
+ # http body (model)
61
+ post_body = nil
62
+ auth_names = ['ApiKeyAuth']
63
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => 'ASNEnrichment')
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: Api#enrich_asn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+ # enriches ip
76
+ # returns enrichment data for an ip
77
+ # @param query
78
+ # @param [Hash] opts the optional parameters
79
+ # @return [IPEnrichment]
80
+ def enrich_ip(query, opts = {})
81
+ data, _status_code, _headers = enrich_ip_with_http_info(query, opts)
82
+ data
83
+ end
84
+
85
+ # enriches ip
86
+ # returns enrichment data for an ip
87
+ # @param query
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [Array<(IPEnrichment, Fixnum, Hash)>] IPEnrichment data, response status code and response headers
90
+ def enrich_ip_with_http_info(query, opts = {})
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug 'Calling API: Api.enrich_ip ...'
93
+ end
94
+ # verify the required parameter 'query' is set
95
+ if @api_client.config.client_side_validation && query.nil?
96
+ fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_ip"
97
+ end
98
+ # resource path
99
+ local_var_path = '/enrichment/ip'
100
+
101
+ # query parameters
102
+ query_params = {}
103
+ query_params[:'query'] = query
104
+
105
+ # header parameters
106
+ header_params = {}
107
+ # HTTP header 'Accept' (if needed)
108
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
109
+
110
+ # form parameters
111
+ form_params = {}
112
+
113
+ # http body (model)
114
+ post_body = nil
115
+ auth_names = ['ApiKeyAuth']
116
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
117
+ :header_params => header_params,
118
+ :query_params => query_params,
119
+ :form_params => form_params,
120
+ :body => post_body,
121
+ :auth_names => auth_names,
122
+ :return_type => 'IPEnrichment')
123
+ if @api_client.config.debugging
124
+ @api_client.config.logger.debug "API called: Api#enrich_ip\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
125
+ end
126
+ return data, status_code, headers
127
+ end
128
+ # enriches network
129
+ # returns enrichment data for a network
130
+ # @param query
131
+ # @param [Hash] opts the optional parameters
132
+ # @return [NetworkEnrichment]
133
+ def enrich_network(query, opts = {})
134
+ data, _status_code, _headers = enrich_network_with_http_info(query, opts)
135
+ data
136
+ end
137
+
138
+ # enriches network
139
+ # returns enrichment data for a network
140
+ # @param query
141
+ # @param [Hash] opts the optional parameters
142
+ # @return [Array<(NetworkEnrichment, Fixnum, Hash)>] NetworkEnrichment data, response status code and response headers
143
+ def enrich_network_with_http_info(query, opts = {})
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug 'Calling API: Api.enrich_network ...'
146
+ end
147
+ # verify the required parameter 'query' is set
148
+ if @api_client.config.client_side_validation && query.nil?
149
+ fail ArgumentError, "Missing the required parameter 'query' when calling Api.enrich_network"
150
+ end
151
+ # resource path
152
+ local_var_path = '/enrichment/network'
153
+
154
+ # query parameters
155
+ query_params = {}
156
+ query_params[:'query'] = query
157
+
158
+ # header parameters
159
+ header_params = {}
160
+ # HTTP header 'Accept' (if needed)
161
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
162
+
163
+ # form parameters
164
+ form_params = {}
165
+
166
+ # http body (model)
167
+ post_body = nil
168
+ auth_names = ['ApiKeyAuth']
169
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
170
+ :header_params => header_params,
171
+ :query_params => query_params,
172
+ :form_params => form_params,
173
+ :body => post_body,
174
+ :auth_names => auth_names,
175
+ :return_type => 'NetworkEnrichment')
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug "API called: Api#enrich_network\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
178
+ end
179
+ return data, status_code, headers
180
+ end
181
+ # authenticate to the service
182
+ # @param [Hash] opts the optional parameters
183
+ # @return [Hello]
184
+ def hello(opts = {})
185
+ data, _status_code, _headers = hello_with_http_info(opts)
186
+ data
187
+ end
188
+
189
+ # authenticate to the service
190
+ # @param [Hash] opts the optional parameters
191
+ # @return [Array<(Hello, Fixnum, Hash)>] Hello data, response status code and response headers
192
+ def hello_with_http_info(opts = {})
193
+ if @api_client.config.debugging
194
+ @api_client.config.logger.debug 'Calling API: Api.hello ...'
195
+ end
196
+ # resource path
197
+ local_var_path = '/hello'
198
+
199
+ # query parameters
200
+ query_params = {}
201
+
202
+ # header parameters
203
+ header_params = {}
204
+ # HTTP header 'Accept' (if needed)
205
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
206
+ # HTTP header 'Content-Type'
207
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
208
+
209
+ # form parameters
210
+ form_params = {}
211
+
212
+ # http body (model)
213
+ post_body = nil
214
+ auth_names = ['ApiKeyAuth']
215
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
216
+ :header_params => header_params,
217
+ :query_params => query_params,
218
+ :form_params => form_params,
219
+ :body => post_body,
220
+ :auth_names => auth_names,
221
+ :return_type => 'Hello')
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug "API called: Api#hello\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
224
+ end
225
+ return data, status_code, headers
226
+ end
227
+ # fetches observations for a given ip address
228
+ # @param query_type query type ip, network, asn, port, country
229
+ # @param query ip address, cidr block, asn, port, or country
230
+ # @param [Hash] opts the optional parameters
231
+ # @option opts [String] :scope timeframe to search over, e.g., 1d, 7d
232
+ # @return [Observations]
233
+ def observations(query_type, query, opts = {})
234
+ data, _status_code, _headers = observations_with_http_info(query_type, query, opts)
235
+ data
236
+ end
237
+
238
+ # fetches observations for a given ip address
239
+ # @param query_type query type ip, network, asn, port, country
240
+ # @param query ip address, cidr block, asn, port, or country
241
+ # @param [Hash] opts the optional parameters
242
+ # @option opts [String] :scope timeframe to search over, e.g., 1d, 7d
243
+ # @return [Array<(Observations, Fixnum, Hash)>] Observations data, response status code and response headers
244
+ def observations_with_http_info(query_type, query, opts = {})
245
+ if @api_client.config.debugging
246
+ @api_client.config.logger.debug 'Calling API: Api.observations ...'
247
+ end
248
+ # verify the required parameter 'query_type' is set
249
+ if @api_client.config.client_side_validation && query_type.nil?
250
+ fail ArgumentError, "Missing the required parameter 'query_type' when calling Api.observations"
251
+ end
252
+ # verify the required parameter 'query' is set
253
+ if @api_client.config.client_side_validation && query.nil?
254
+ fail ArgumentError, "Missing the required parameter 'query' when calling Api.observations"
255
+ end
256
+ # resource path
257
+ local_var_path = '/observations/{queryType}'.sub('{' + 'queryType' + '}', query_type.to_s)
258
+
259
+ # query parameters
260
+ query_params = {}
261
+ query_params[:'query'] = query
262
+ query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
263
+
264
+ # header parameters
265
+ header_params = {}
266
+ # HTTP header 'Accept' (if needed)
267
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
268
+ # HTTP header 'Content-Type'
269
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
270
+
271
+ # form parameters
272
+ form_params = {}
273
+
274
+ # http body (model)
275
+ post_body = nil
276
+ auth_names = ['ApiKeyAuth']
277
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
278
+ :header_params => header_params,
279
+ :query_params => query_params,
280
+ :form_params => form_params,
281
+ :body => post_body,
282
+ :auth_names => auth_names,
283
+ :return_type => 'Observations')
284
+ if @api_client.config.debugging
285
+ @api_client.config.logger.debug "API called: Api#observations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
286
+ end
287
+ return data, status_code, headers
288
+ end
289
+ # Top N items
290
+ # A listing of the top N items observered over the query scope
291
+ # @param trend_type which item type you want to perform a trend over
292
+ # @param [Hash] opts the optional parameters
293
+ # @option opts [String] :scope timeframe to search over, e.g., 1d, 7d
294
+ # @return [Trends]
295
+ def trends(trend_type, opts = {})
296
+ data, _status_code, _headers = trends_with_http_info(trend_type, opts)
297
+ data
298
+ end
299
+
300
+ # Top N items
301
+ # A listing of the top N items observered over the query scope
302
+ # @param trend_type which item type you want to perform a trend over
303
+ # @param [Hash] opts the optional parameters
304
+ # @option opts [String] :scope timeframe to search over, e.g., 1d, 7d
305
+ # @return [Array<(Trends, Fixnum, Hash)>] Trends data, response status code and response headers
306
+ def trends_with_http_info(trend_type, opts = {})
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug 'Calling API: Api.trends ...'
309
+ end
310
+ # verify the required parameter 'trend_type' is set
311
+ if @api_client.config.client_side_validation && trend_type.nil?
312
+ fail ArgumentError, "Missing the required parameter 'trend_type' when calling Api.trends"
313
+ end
314
+ # verify enum value
315
+ if @api_client.config.client_side_validation && !['ip', 'network', 'asn', 'port', 'country'].include?(trend_type)
316
+ fail ArgumentError, "invalid value for 'trend_type', must be one of ip, network, asn, port, country"
317
+ end
318
+ # resource path
319
+ local_var_path = '/trends/popular/{trendType}'.sub('{' + 'trendType' + '}', trend_type.to_s)
320
+
321
+ # query parameters
322
+ query_params = {}
323
+ query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
324
+
325
+ # header parameters
326
+ header_params = {}
327
+ # HTTP header 'Accept' (if needed)
328
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
329
+
330
+ # form parameters
331
+ form_params = {}
332
+
333
+ # http body (model)
334
+ post_body = nil
335
+ auth_names = ['ApiKeyAuth']
336
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
337
+ :header_params => header_params,
338
+ :query_params => query_params,
339
+ :form_params => form_params,
340
+ :body => post_body,
341
+ :auth_names => auth_names,
342
+ :return_type => 'Trends')
343
+ if @api_client.config.debugging
344
+ @api_client.config.logger.debug "API called: Api#trends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
345
+ end
346
+ return data, status_code, headers
347
+ end
348
+ end
349
+ end