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.
@@ -23,6 +23,7 @@ module VPNDetection
23
23
 
24
24
  attr_accessor :summary
25
25
 
26
+ # What a license permits you to do with the data. Null for a family you hold no license for, which is every one with standing `unlicensed`.
26
27
  attr_accessor :license_type
27
28
 
28
29
  attr_accessor :starts
@@ -99,7 +100,7 @@ module VPNDetection
99
100
  :'base' => :'String',
100
101
  :'name' => :'String',
101
102
  :'summary' => :'String',
102
- :'license_type' => :'LicenseType',
103
+ :'license_type' => :'String',
103
104
  :'starts' => :'Time',
104
105
  :'expires' => :'Time',
105
106
  :'renews_at' => :'Time',
@@ -113,6 +114,7 @@ module VPNDetection
113
114
  # List of attributes with nullable: true
114
115
  def self.openapi_nullable
115
116
  Set.new([
117
+ :'license_type',
116
118
  :'starts',
117
119
  :'expires',
118
120
  :'renews_at',
@@ -222,10 +224,6 @@ module VPNDetection
222
224
  invalid_properties.push('invalid value for "summary", summary cannot be nil.')
223
225
  end
224
226
 
225
- if @license_type.nil?
226
- invalid_properties.push('invalid value for "license_type", license_type cannot be nil.')
227
- end
228
-
229
227
  if @in_term.nil?
230
228
  invalid_properties.push('invalid value for "in_term", in_term cannot be nil.')
231
229
  end
@@ -248,7 +246,8 @@ module VPNDetection
248
246
  return false if @base.nil?
249
247
  return false if @name.nil?
250
248
  return false if @summary.nil?
251
- return false if @license_type.nil?
249
+ license_type_validator = EnumAttributeValidator.new('String', ["evaluation", "standard", "redistribute"])
250
+ return false unless license_type_validator.valid?(@license_type)
252
251
  return false if @in_term.nil?
253
252
  return false if @standing.nil?
254
253
  return false if @versions.nil?
@@ -285,13 +284,13 @@ module VPNDetection
285
284
  @summary = summary
286
285
  end
287
286
 
288
- # Custom attribute writer method with validation
289
- # @param [Object] license_type Value to be assigned
287
+ # Custom attribute writer method checking allowed values (enum).
288
+ # @param [Object] license_type Object to be assigned
290
289
  def license_type=(license_type)
291
- if license_type.nil?
292
- fail ArgumentError, 'license_type cannot be nil'
290
+ validator = EnumAttributeValidator.new('String', ["evaluation", "standard", "redistribute"])
291
+ unless validator.valid?(license_type)
292
+ fail ArgumentError, "invalid value for \"license_type\", must be one of #{validator.allowable_values}."
293
293
  end
294
-
295
294
  @license_type = license_type
296
295
  end
297
296
 
@@ -13,6 +13,8 @@ module VPNDetection
13
13
  # requests to queue them on a hydra and cannot go through the generated
14
14
  # method, which runs each request as it builds it.
15
15
  LOOKUP_PATH = '/{ip}'
16
+ MYIP_PATH = '/myip'
17
+ ACCOUNT_ME_PATH = '/api/v1/account/me'
16
18
 
17
19
  # The generated Configuration applies EVERY security scheme the spec lists,
18
20
  # so a keyless client would send `Authorization: Bearer `, an empty
@@ -89,6 +91,29 @@ module VPNDetection
89
91
  )
90
92
  end
91
93
 
94
+ def myip_request
95
+ build_request(
96
+ :GET, MYIP_PATH,
97
+ header_params: { 'Accept' => 'application/json' },
98
+ auth_names: %w[bearerAuth apiKeyHeader apiKeyQuery],
99
+ )
100
+ end
101
+
102
+ def account_request
103
+ build_request(
104
+ :GET, ACCOUNT_ME_PATH,
105
+ header_params: { 'Accept' => 'application/json' },
106
+ auth_names: %w[bearerAuth apiKeyHeader apiKeyQuery],
107
+ )
108
+ end
109
+
110
+ def self.account_result(response)
111
+ raise Error.from_transport(response) if transport_failure?(response)
112
+ raise Error.from_status(response.code, response.headers, response.body) unless response.success?
113
+
114
+ AccountMe.build_from_hash(parse_object(response))
115
+ end
116
+
92
117
  def self.lookup_result(response)
93
118
  raise Error.from_transport(response) if transport_failure?(response)
94
119
  raise Error.from_status(response.code, response.headers, response.body) unless response.success?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VPNDetection
4
- VERSION = '3.2.1'
4
+ VERSION = '4.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpndetection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mslm Dev
@@ -48,6 +48,7 @@ files:
48
48
  - LICENSE
49
49
  - README.md
50
50
  - lib/vpndetection.rb
51
+ - lib/vpndetection/api/account_wire_api.rb
51
52
  - lib/vpndetection/api/database_wire_api.rb
52
53
  - lib/vpndetection/api/lookup_wire_api.rb
53
54
  - lib/vpndetection/api_client.rb
@@ -63,6 +64,11 @@ files:
63
64
  - lib/vpndetection/middleware.rb
64
65
  - lib/vpndetection/middleware/condition.rb
65
66
  - lib/vpndetection/middleware/core.rb
67
+ - lib/vpndetection/models/account_apikey.rb
68
+ - lib/vpndetection/models/account_error.rb
69
+ - lib/vpndetection/models/account_me.rb
70
+ - lib/vpndetection/models/account_plan.rb
71
+ - lib/vpndetection/models/account_usage.rb
66
72
  - lib/vpndetection/models/class_detail.rb
67
73
  - lib/vpndetection/models/database.rb
68
74
  - lib/vpndetection/models/database_checksums_response.rb
@@ -76,7 +82,6 @@ files:
76
82
  - lib/vpndetection/models/download.rb
77
83
  - lib/vpndetection/models/download_list.rb
78
84
  - lib/vpndetection/models/error_envelope.rb
79
- - lib/vpndetection/models/license_type.rb
80
85
  - lib/vpndetection/models/lookup_error.rb
81
86
  - lib/vpndetection/models/lookup_response.rb
82
87
  - lib/vpndetection/models/proxy_detail.rb
@@ -1,41 +0,0 @@
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 LicenseType
18
- EVALUATION = "evaluation".freeze
19
- STANDARD = "standard".freeze
20
- REDISTRIBUTE = "redistribute".freeze
21
-
22
- def self.all_vars
23
- @all_vars ||= [EVALUATION, STANDARD, REDISTRIBUTE].freeze
24
- end
25
-
26
- # Builds the enum from string
27
- # @param [String] The enum value in the form of the string
28
- # @return [String] The enum value
29
- def self.build_from_hash(value)
30
- new.build_from_hash(value)
31
- end
32
-
33
- # Builds the enum from string
34
- # @param [String] The enum value in the form of the string
35
- # @return [String] The enum value
36
- def build_from_hash(value)
37
- return value if LicenseType.all_vars.include?(value)
38
- raise "Invalid ENUM value #{value} for class #LicenseType"
39
- end
40
- end
41
- end