vpndetection 3.2.1 → 4.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 968cc7e17b2c94d267e03fe6110e7780fc6c2f8a5710b1f642ce433013ecce65
4
- data.tar.gz: e3d165e53eb9e0aaffb73cf35710970727f9e0e5c163c1ac7132dfbb694b63de
3
+ metadata.gz: 164314052bfd32f74acb272ff59c077ab1a841395c9818954ea83f6b167464ce
4
+ data.tar.gz: e41ccca025ec996d64861e26ba7fc6c3bbcca85628d9c402dedc35f372f96f6d
5
5
  SHA512:
6
- metadata.gz: 463de94ed352de2c514a1614ae59b37021ec28faa33c5c664b11c33124c551ba00f30fc457e4f1a3c1864b5d8d6dd0ae630c86598629af79e50d818c89952aac
7
- data.tar.gz: fc051a127d33bff9c8bd5cac109807f493baf4876c9fc5b673ba6d22e485fab026f8ef81a2d66ea0714233d004c4af6cddf4a7b85b5e8964707113ef2d051f88
6
+ metadata.gz: 7b65573bf40eed189922a26a7131225bf1ba805a671404dd506a23d948e4ca98b2b4bf774dbeb3bcffdc1b7821fad819c3d9d19e75dbcf8ab46470c4a8a2f26d
7
+ data.tar.gz: c9685a07643394cd7eef10034b740fb119bf1d16d89be927baf80f8db342e99fb0aa5ba073614196ba31d32e84c4e3ddebdf594e9d919afac193e38c78326e1b
@@ -0,0 +1,79 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases 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.13
7
+ Contact: support@vpndetection.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module VPNDetection
16
+ class AccountWireApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Your key, plan and usage
23
+ # Answers what the presented key is, what plan is behind it, and what has been spent against that plan's allowance in the current window.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [AccountMe]
26
+ def account_me(opts = {})
27
+ data, _status_code, _headers = account_me_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Your key, plan and usage
32
+ # Answers what the presented key is, what plan is behind it, and what has been spent against that plan's allowance in the current window.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(AccountMe, Integer, Hash)>] AccountMe data, response status code and response headers
35
+ def account_me_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: AccountWireApi.account_me ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/api/v1/account/me'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'AccountMe'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || ['apiKeyQuery', 'bearerAuth', 'apiKeyHeader']
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"AccountWireApi.account_me",
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 => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: AccountWireApi#account_me\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -226,7 +226,7 @@ module VPNDetection
226
226
  end
227
227
 
228
228
  # List
229
- # Every database this organization holds a licence for, with the term and the license_type right beside each one.
229
+ # Every database this organization may SEE, with where its licence stands. Not just the ones you hold: a customer with one grant should be able to tell what else is published without asking. `standing` is the difference - `licensed`, `expired`, or `unlicensed` for one never bought.
230
230
  # @param [Hash] opts the optional parameters
231
231
  # @return [DatabaseList]
232
232
  def list_databases(opts = {})
@@ -235,7 +235,7 @@ module VPNDetection
235
235
  end
236
236
 
237
237
  # List
238
- # Every database this organization holds a licence for, with the term and the license_type right beside each one.
238
+ # Every database this organization may SEE, with where its licence stands. Not just the ones you hold: a customer with one grant should be able to tell what else is published without asking. &#x60;standing&#x60; is the difference - &#x60;licensed&#x60;, &#x60;expired&#x60;, or &#x60;unlicensed&#x60; for one never bought.
239
239
  # @param [Hash] opts the optional parameters
240
240
  # @return [Array<(DatabaseList, Integer, Hash)>] DatabaseList data, response status code and response headers
241
241
  def list_databases_with_http_info(opts = {})
@@ -67,6 +67,47 @@ module VPNDetection
67
67
  result
68
68
  end
69
69
 
70
+ # Classify the address this client is calling from.
71
+ #
72
+ # The same answer {#lookup} would give for that address, at the same cost
73
+ # against your allowance. The address is the one our edge observed, so a
74
+ # call made through a proxy or a VPN reports the exit it left through -
75
+ # usually the point of asking.
76
+ #
77
+ # Deliberately NOT cached. The cache is keyed by address, and which address
78
+ # this is IS the question: a machine that moves between networks would
79
+ # otherwise be told where it used to be.
80
+ def my_ip(retries: nil)
81
+ Retries.with_retries(retries || @retries) do
82
+ Transport.lookup_result(@transport.myip_request.run)
83
+ end
84
+ end
85
+
86
+ # What this client's key is entitled to, and how much of it has been used.
87
+ #
88
+ # Named for what it answers rather than `me`, which sits one letter from
89
+ # {#my_ip} and means something quite different: one is which address you are
90
+ # calling FROM, the other is which account you are calling AS.
91
+ #
92
+ # Unlike a lookup there is no useful unauthenticated answer, so a client
93
+ # built without an API key gets an unauthorized error rather than a partial
94
+ # one.
95
+ #
96
+ # Usage counts against the ALLOWANCE WINDOW - the anniversary of the
97
+ # subscription, not the calendar month and not the billing period - and it
98
+ # is the same number a lookup is gated on. It can lag by a few seconds,
99
+ # because requests are counted in memory and flushed in aggregate.
100
+ #
101
+ # Deliberately NOT cached: the whole point is what has been spent, and a
102
+ # cached answer is a wrong one within seconds of the next request.
103
+ #
104
+ # @return [AccountMe]
105
+ def my_account(retries: nil)
106
+ Retries.with_retries(retries || @retries) do
107
+ Transport.account_result(@transport.account_request.run)
108
+ end
109
+ end
110
+
70
111
  # Classify many addresses in parallel.
71
112
  #
72
113
  # Keyed by address rather than positional, so duplicates in the input
@@ -177,10 +177,6 @@ module VPNDetection
177
177
  @ignore_operation_servers = false
178
178
  @inject_format = false
179
179
  @force_ending_format = false
180
- # `::Rails`, not `Rails`: this file is inside `module VPNDetection`, so a
181
- # bare constant resolves to `VPNDetection::Rails` first if one exists -
182
- # and one does, as soon as the vpndetection-rails gem is loaded. The
183
- # intent has always been the top-level Rails.
184
180
  @logger = defined?(::Rails) ? ::Rails.logger : Logger.new(STDOUT)
185
181
 
186
182
  yield(self) if block_given?
@@ -278,10 +274,6 @@ module VPNDetection
278
274
  {
279
275
  url: "https://api.vpndetection.io",
280
276
  description: "Production",
281
- },
282
- {
283
- url: "https://api-staging.vpndetection.io",
284
- description: "Staging",
285
277
  }
286
278
  ]
287
279
  end
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases 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.13
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
+ # The credential itself. The key is never echoed - only its id, which is what the console shows and what you can act on.
18
+ class AccountApikey < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ # Null for a key with no end date, which is the normal case.
22
+ attr_accessor :expires
23
+
24
+ # The source addresses this key may be used from. EMPTY means unrestricted, never \"deny all\".
25
+ attr_accessor :allowed_cidrs
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'expires' => :'expires',
32
+ :'allowed_cidrs' => :'allowed_cidrs'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'id' => :'String',
50
+ :'expires' => :'Time',
51
+ :'allowed_cidrs' => :'Array<String>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'expires',
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountApikey` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountApikey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ else
81
+ self.id = nil
82
+ end
83
+
84
+ if attributes.key?(:'expires')
85
+ self.expires = attributes[:'expires']
86
+ else
87
+ self.expires = nil
88
+ end
89
+
90
+ if attributes.key?(:'allowed_cidrs')
91
+ if (value = attributes[:'allowed_cidrs']).is_a?(Array)
92
+ self.allowed_cidrs = value
93
+ end
94
+ else
95
+ self.allowed_cidrs = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @id.nil?
105
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
106
+ end
107
+
108
+ if @allowed_cidrs.nil?
109
+ invalid_properties.push('invalid value for "allowed_cidrs", allowed_cidrs cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ warn '[DEPRECATED] the `valid?` method is obsolete'
119
+ return false if @id.nil?
120
+ return false if @allowed_cidrs.nil?
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method with validation
125
+ # @param [Object] id Value to be assigned
126
+ def id=(id)
127
+ if id.nil?
128
+ fail ArgumentError, 'id cannot be nil'
129
+ end
130
+
131
+ @id = id
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] allowed_cidrs Value to be assigned
136
+ def allowed_cidrs=(allowed_cidrs)
137
+ if allowed_cidrs.nil?
138
+ fail ArgumentError, 'allowed_cidrs cannot be nil'
139
+ end
140
+
141
+ @allowed_cidrs = allowed_cidrs
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ id == o.id &&
150
+ expires == o.expires &&
151
+ allowed_cidrs == o.allowed_cidrs
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [id, expires, allowed_cidrs].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ transformed_hash = {}
173
+ openapi_types.each_pair do |key, type|
174
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = nil
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[attribute_map[key]].is_a?(Array)
180
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
181
+ end
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
184
+ end
185
+ end
186
+ new(transformed_hash)
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,164 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases 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.13
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 AccountError < ApiModelBase
18
+ attr_accessor :error
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'error' => :'error'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'error' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountError` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'error')
67
+ self.error = attributes[:'error']
68
+ else
69
+ self.error = nil
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ if @error.nil?
79
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ return false if @error.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] error Value to be assigned
95
+ def error=(error)
96
+ if error.nil?
97
+ fail ArgumentError, 'error cannot be nil'
98
+ end
99
+
100
+ @error = error
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ error == o.error
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [error].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Returns the object in the form of hash
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_hash
149
+ hash = {}
150
+ self.class.attribute_map.each_pair do |attr, param|
151
+ value = self.send(attr)
152
+ if value.nil?
153
+ is_nullable = self.class.openapi_nullable.include?(attr)
154
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
155
+ end
156
+
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ end
163
+
164
+ end