vpndetection 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 (37) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +171 -0
  4. data/lib/vpndetection/api/database_api.rb +351 -0
  5. data/lib/vpndetection/api/lookup_api.rb +85 -0
  6. data/lib/vpndetection/api_client.rb +397 -0
  7. data/lib/vpndetection/api_error.rb +58 -0
  8. data/lib/vpndetection/api_model_base.rb +88 -0
  9. data/lib/vpndetection/bogon.rb +60 -0
  10. data/lib/vpndetection/bogons.rb +67 -0
  11. data/lib/vpndetection/cache.rb +35 -0
  12. data/lib/vpndetection/client.rb +133 -0
  13. data/lib/vpndetection/configuration.rb +326 -0
  14. data/lib/vpndetection/database.rb +167 -0
  15. data/lib/vpndetection/errors.rb +107 -0
  16. data/lib/vpndetection/models/class_detail.rb +169 -0
  17. data/lib/vpndetection/models/dataset_checksums.rb +174 -0
  18. data/lib/vpndetection/models/dataset_checksums_response.rb +216 -0
  19. data/lib/vpndetection/models/dataset_format_size.rb +201 -0
  20. data/lib/vpndetection/models/dataset_list.rb +166 -0
  21. data/lib/vpndetection/models/dataset_metadata.rb +280 -0
  22. data/lib/vpndetection/models/dataset_metadata_column.rb +199 -0
  23. data/lib/vpndetection/models/download.rb +276 -0
  24. data/lib/vpndetection/models/download_list.rb +166 -0
  25. data/lib/vpndetection/models/error_envelope.rb +164 -0
  26. data/lib/vpndetection/models/licensed_dataset.rb +358 -0
  27. data/lib/vpndetection/models/licensed_version.rb +262 -0
  28. data/lib/vpndetection/models/lookup_error.rb +166 -0
  29. data/lib/vpndetection/models/lookup_response.rb +343 -0
  30. data/lib/vpndetection/models/proxy_detail.rb +199 -0
  31. data/lib/vpndetection/models/vpn_detail.rb +179 -0
  32. data/lib/vpndetection/result.rb +211 -0
  33. data/lib/vpndetection/retries.rb +33 -0
  34. data/lib/vpndetection/transport.rb +116 -0
  35. data/lib/vpndetection/version.rb +5 -0
  36. data/lib/vpndetection.rb +40 -0
  37. metadata +109 -0
@@ -0,0 +1,262 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the datasets behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
+
6
+ The version of the OpenAPI document: 2026.09.04
7
+ Contact: support@vpndetection.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VPNDetection
17
+ class LicensedVersion < ApiModelBase
18
+ # The versioned dataset id, e.g. `vpn_ip_v1`. Pass this to download.
19
+ attr_accessor :id
20
+
21
+ attr_accessor :version
22
+
23
+ attr_accessor :summary
24
+
25
+ attr_accessor :formats
26
+
27
+ # The formats an evaluation sample is published in, if any.
28
+ attr_accessor :sample_formats
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'id' => :'id',
56
+ :'version' => :'version',
57
+ :'summary' => :'summary',
58
+ :'formats' => :'formats',
59
+ :'sample_formats' => :'sampleFormats'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'id' => :'String',
77
+ :'version' => :'Integer',
78
+ :'summary' => :'String',
79
+ :'formats' => :'Array<DatasetFormatSize>',
80
+ :'sample_formats' => :'Array<String>'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::LicensedVersion` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::LicensedVersion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ else
109
+ self.id = nil
110
+ end
111
+
112
+ if attributes.key?(:'version')
113
+ self.version = attributes[:'version']
114
+ else
115
+ self.version = nil
116
+ end
117
+
118
+ if attributes.key?(:'summary')
119
+ self.summary = attributes[:'summary']
120
+ end
121
+
122
+ if attributes.key?(:'formats')
123
+ if (value = attributes[:'formats']).is_a?(Array)
124
+ self.formats = value
125
+ end
126
+ else
127
+ self.formats = nil
128
+ end
129
+
130
+ if attributes.key?(:'sample_formats')
131
+ if (value = attributes[:'sample_formats']).is_a?(Array)
132
+ self.sample_formats = value
133
+ end
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
141
+ invalid_properties = Array.new
142
+ if @id.nil?
143
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
144
+ end
145
+
146
+ if @version.nil?
147
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
148
+ end
149
+
150
+ if @formats.nil?
151
+ invalid_properties.push('invalid value for "formats", formats cannot be nil.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ warn '[DEPRECATED] the `valid?` method is obsolete'
161
+ return false if @id.nil?
162
+ return false if @version.nil?
163
+ return false if @formats.nil?
164
+ true
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] id Value to be assigned
169
+ def id=(id)
170
+ if id.nil?
171
+ fail ArgumentError, 'id cannot be nil'
172
+ end
173
+
174
+ @id = id
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] version Value to be assigned
179
+ def version=(version)
180
+ if version.nil?
181
+ fail ArgumentError, 'version cannot be nil'
182
+ end
183
+
184
+ @version = version
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] formats Value to be assigned
189
+ def formats=(formats)
190
+ if formats.nil?
191
+ fail ArgumentError, 'formats cannot be nil'
192
+ end
193
+
194
+ @formats = formats
195
+ end
196
+
197
+ # Checks equality by comparing each attribute.
198
+ # @param [Object] Object to be compared
199
+ def ==(o)
200
+ return true if self.equal?(o)
201
+ self.class == o.class &&
202
+ id == o.id &&
203
+ version == o.version &&
204
+ summary == o.summary &&
205
+ formats == o.formats &&
206
+ sample_formats == o.sample_formats
207
+ end
208
+
209
+ # @see the `==` method
210
+ # @param [Object] Object to be compared
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculates hash code according to all attributes.
216
+ # @return [Integer] Hash code
217
+ def hash
218
+ [id, version, summary, formats, sample_formats].hash
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def self.build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ attributes = attributes.transform_keys(&:to_sym)
227
+ transformed_hash = {}
228
+ openapi_types.each_pair do |key, type|
229
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
230
+ transformed_hash["#{key}"] = nil
231
+ elsif type =~ /\AArray<(.*)>/i
232
+ # check to ensure the input is an array given that the attribute
233
+ # is documented as an array but the input is not
234
+ if attributes[attribute_map[key]].is_a?(Array)
235
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
236
+ end
237
+ elsif !attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
239
+ end
240
+ end
241
+ new(transformed_hash)
242
+ end
243
+
244
+ # Returns the object in the form of hash
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_hash
247
+ hash = {}
248
+ self.class.attribute_map.each_pair do |attr, param|
249
+ value = self.send(attr)
250
+ if value.nil?
251
+ is_nullable = self.class.openapi_nullable.include?(attr)
252
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
253
+ end
254
+
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ end
261
+
262
+ end
@@ -0,0 +1,166 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the datasets behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
+
6
+ The version of the OpenAPI document: 2026.09.04
7
+ Contact: support@vpndetection.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VPNDetection
17
+ # Every non-2xx response carries this shape.
18
+ class LookupError < ApiModelBase
19
+ # A human-readable explanation of the failure.
20
+ attr_accessor :error
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'error' => :'error'
26
+ }
27
+ end
28
+
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ acceptable_attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'error' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::LookupError` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ acceptable_attribute_map = self.class.acceptable_attribute_map
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!acceptable_attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::LookupError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'error')
69
+ self.error = attributes[:'error']
70
+ else
71
+ self.error = nil
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ if @error.nil?
81
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ return false if @error.nil?
92
+ true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] error Value to be assigned
97
+ def error=(error)
98
+ if error.nil?
99
+ fail ArgumentError, 'error cannot be nil'
100
+ end
101
+
102
+ @error = error
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ error == o.error
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [error].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = self.send(attr)
154
+ if value.nil?
155
+ is_nullable = self.class.openapi_nullable.include?(attr)
156
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
157
+ end
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ end
165
+
166
+ end