vpndetection 4.0.0 → 5.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.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/lib/vpndetection/api/account_wire_api.rb +16 -16
- data/lib/vpndetection/api/api_keys_wire_api.rb +336 -0
- data/lib/vpndetection/api/authorization_wire_api.rb +421 -0
- data/lib/vpndetection/api/database_wire_api.rb +1 -1
- data/lib/vpndetection/api/entitlement_wire_api.rb +79 -0
- data/lib/vpndetection/api/lookup_wire_api.rb +3 -3
- data/lib/vpndetection/api/organization_wire_api.rb +136 -0
- data/lib/vpndetection/api_client.rb +1 -1
- data/lib/vpndetection/api_error.rb +1 -1
- data/lib/vpndetection/api_model_base.rb +1 -1
- data/lib/vpndetection/client.rb +41 -0
- data/lib/vpndetection/configuration.rb +1 -5
- data/lib/vpndetection/models/account_create_apikey_request.rb +177 -0
- data/lib/vpndetection/models/account_created_apikey.rb +257 -0
- data/lib/vpndetection/models/account_org.rb +183 -0
- data/lib/vpndetection/models/account_org_ref.rb +164 -0
- data/lib/vpndetection/models/account_org_wrap.rb +190 -0
- data/lib/vpndetection/models/account_rc.rb +165 -0
- data/lib/vpndetection/models/account_revealed_apikey.rb +191 -0
- data/lib/vpndetection/models/account_user.rb +182 -0
- data/lib/vpndetection/models/apikey_detail.rb +307 -0
- data/lib/vpndetection/models/apikey_list.rb +192 -0
- data/lib/vpndetection/models/class_detail.rb +1 -1
- data/lib/vpndetection/models/database.rb +1 -1
- data/lib/vpndetection/models/database_checksums_response.rb +1 -1
- data/lib/vpndetection/models/database_format.rb +1 -1
- data/lib/vpndetection/models/database_format_size.rb +2 -2
- data/lib/vpndetection/models/database_list.rb +1 -1
- data/lib/vpndetection/models/database_metadata.rb +1 -1
- data/lib/vpndetection/models/database_metadata_column.rb +1 -1
- data/lib/vpndetection/models/database_version.rb +1 -1
- data/lib/vpndetection/models/db_checksums.rb +1 -1
- data/lib/vpndetection/models/device_authorization.rb +281 -0
- data/lib/vpndetection/models/download.rb +2 -2
- data/lib/vpndetection/models/download_list.rb +1 -1
- data/lib/vpndetection/models/{account_me.rb → entitlement.rb} +7 -7
- data/lib/vpndetection/models/{account_apikey.rb → entitlement_apikey.rb} +4 -4
- data/lib/vpndetection/models/{account_error.rb → entitlement_error.rb} +4 -4
- data/lib/vpndetection/models/{account_plan.rb → entitlement_plan.rb} +4 -4
- data/lib/vpndetection/models/{account_usage.rb → entitlement_usage.rb} +4 -4
- data/lib/vpndetection/models/error_envelope.rb +1 -1
- data/lib/vpndetection/models/identity.rb +245 -0
- data/lib/vpndetection/models/lookup_error.rb +1 -1
- data/lib/vpndetection/models/lookup_response.rb +1 -1
- data/lib/vpndetection/models/oauth_error.rb +173 -0
- data/lib/vpndetection/models/oauth_metadata.rb +288 -0
- data/lib/vpndetection/models/proxy_detail.rb +1 -1
- data/lib/vpndetection/models/standing.rb +1 -1
- data/lib/vpndetection/models/token_response.rb +235 -0
- data/lib/vpndetection/models/vpn_detail.rb +1 -1
- data/lib/vpndetection/transport.rb +25 -0
- data/lib/vpndetection/version.rb +1 -1
- metadata +25 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
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
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
6
|
+
The version of the OpenAPI document: 2026.09.15
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
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
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
6
|
+
The version of the OpenAPI document: 2026.09.15
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
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
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
6
|
+
The version of the OpenAPI document: 2026.09.15
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
data/lib/vpndetection/client.rb
CHANGED
|
@@ -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 what the key you are calling WITH may spend.
|
|
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 [Entitlement]
|
|
105
|
+
def my_entitlement(retries: nil)
|
|
106
|
+
Retries.with_retries(retries || @retries) do
|
|
107
|
+
Transport.entitlement_result(@transport.entitlement_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
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
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
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
6
|
+
The version of the OpenAPI document: 2026.09.15
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
@@ -274,10 +274,6 @@ module VPNDetection
|
|
|
274
274
|
{
|
|
275
275
|
url: "https://api.vpndetection.io",
|
|
276
276
|
description: "Production",
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
url: "https://api-staging.vpndetection.io",
|
|
280
|
-
description: "Staging",
|
|
281
277
|
}
|
|
282
278
|
]
|
|
283
279
|
end
|
|
@@ -0,0 +1,177 @@
|
|
|
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.15
|
|
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 AccountCreateApikeyRequest < ApiModelBase
|
|
18
|
+
# A label you will recognise later. Shown wherever the key is listed.
|
|
19
|
+
attr_accessor :name
|
|
20
|
+
|
|
21
|
+
# What the new key may do. Omit for a key that carries no named scope, which is the safe default.
|
|
22
|
+
attr_accessor :allowed_scopes
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'name' => :'name',
|
|
28
|
+
:'allowed_scopes' => :'allowed_scopes'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns all the JSON keys this model knows about
|
|
38
|
+
def self.acceptable_attributes
|
|
39
|
+
acceptable_attribute_map.values
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.openapi_types
|
|
44
|
+
{
|
|
45
|
+
:'name' => :'String',
|
|
46
|
+
:'allowed_scopes' => :'Array<String>'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountCreateApikeyRequest` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountCreateApikeyRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
|
+
end
|
|
69
|
+
h[k.to_sym] = v
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'name')
|
|
73
|
+
self.name = attributes[:'name']
|
|
74
|
+
else
|
|
75
|
+
self.name = nil
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'allowed_scopes')
|
|
79
|
+
if (value = attributes[:'allowed_scopes']).is_a?(Array)
|
|
80
|
+
self.allowed_scopes = value
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
86
|
+
# @return Array for valid properties with the reasons
|
|
87
|
+
def list_invalid_properties
|
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
89
|
+
invalid_properties = Array.new
|
|
90
|
+
if @name.nil?
|
|
91
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
invalid_properties
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Check to see if the all the properties in the model are valid
|
|
98
|
+
# @return true if the model is valid
|
|
99
|
+
def valid?
|
|
100
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
101
|
+
return false if @name.nil?
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Custom attribute writer method with validation
|
|
106
|
+
# @param [Object] name Value to be assigned
|
|
107
|
+
def name=(name)
|
|
108
|
+
if name.nil?
|
|
109
|
+
fail ArgumentError, 'name cannot be nil'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
@name = name
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Checks equality by comparing each attribute.
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def ==(o)
|
|
118
|
+
return true if self.equal?(o)
|
|
119
|
+
self.class == o.class &&
|
|
120
|
+
name == o.name &&
|
|
121
|
+
allowed_scopes == o.allowed_scopes
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# @see the `==` method
|
|
125
|
+
# @param [Object] Object to be compared
|
|
126
|
+
def eql?(o)
|
|
127
|
+
self == o
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Calculates hash code according to all attributes.
|
|
131
|
+
# @return [Integer] Hash code
|
|
132
|
+
def hash
|
|
133
|
+
[name, allowed_scopes].hash
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the object from hash
|
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
138
|
+
# @return [Object] Returns the model itself
|
|
139
|
+
def self.build_from_hash(attributes)
|
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
|
141
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
142
|
+
transformed_hash = {}
|
|
143
|
+
openapi_types.each_pair do |key, type|
|
|
144
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
145
|
+
transformed_hash["#{key}"] = nil
|
|
146
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
147
|
+
# check to ensure the input is an array given that the attribute
|
|
148
|
+
# is documented as an array but the input is not
|
|
149
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
150
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
151
|
+
end
|
|
152
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
153
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
new(transformed_hash)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Returns the object in the form of hash
|
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
|
161
|
+
def to_hash
|
|
162
|
+
hash = {}
|
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
164
|
+
value = self.send(attr)
|
|
165
|
+
if value.nil?
|
|
166
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
167
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
hash[param] = _to_hash(value)
|
|
171
|
+
end
|
|
172
|
+
hash
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
end
|
|
@@ -0,0 +1,257 @@
|
|
|
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.15
|
|
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 AccountCreatedApikey < ApiModelBase
|
|
18
|
+
attr_accessor :rc
|
|
19
|
+
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# The secret. Returned once, here, and never again.
|
|
25
|
+
attr_accessor :key
|
|
26
|
+
|
|
27
|
+
attr_accessor :key_prefix
|
|
28
|
+
|
|
29
|
+
attr_accessor :allowed_cidrs
|
|
30
|
+
|
|
31
|
+
attr_accessor :allowed_scopes
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'rc' => :'rc',
|
|
37
|
+
:'id' => :'id',
|
|
38
|
+
:'name' => :'name',
|
|
39
|
+
:'key' => :'key',
|
|
40
|
+
:'key_prefix' => :'key_prefix',
|
|
41
|
+
:'allowed_cidrs' => :'allowed_cidrs',
|
|
42
|
+
:'allowed_scopes' => :'allowed_scopes'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Returns attribute mapping this model knows about
|
|
47
|
+
def self.acceptable_attribute_map
|
|
48
|
+
attribute_map
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns all the JSON keys this model knows about
|
|
52
|
+
def self.acceptable_attributes
|
|
53
|
+
acceptable_attribute_map.values
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute type mapping.
|
|
57
|
+
def self.openapi_types
|
|
58
|
+
{
|
|
59
|
+
:'rc' => :'String',
|
|
60
|
+
:'id' => :'String',
|
|
61
|
+
:'name' => :'String',
|
|
62
|
+
:'key' => :'String',
|
|
63
|
+
:'key_prefix' => :'String',
|
|
64
|
+
:'allowed_cidrs' => :'Array<String>',
|
|
65
|
+
:'allowed_scopes' => :'Array<String>'
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# List of attributes with nullable: true
|
|
70
|
+
def self.openapi_nullable
|
|
71
|
+
Set.new([
|
|
72
|
+
])
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Initializes the object
|
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
77
|
+
def initialize(attributes = {})
|
|
78
|
+
if (!attributes.is_a?(Hash))
|
|
79
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountCreatedApikey` initialize method"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
83
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
85
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountCreatedApikey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
87
|
+
end
|
|
88
|
+
h[k.to_sym] = v
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'rc')
|
|
92
|
+
self.rc = attributes[:'rc']
|
|
93
|
+
else
|
|
94
|
+
self.rc = nil
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'id')
|
|
98
|
+
self.id = attributes[:'id']
|
|
99
|
+
else
|
|
100
|
+
self.id = nil
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'name')
|
|
104
|
+
self.name = attributes[:'name']
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'key')
|
|
108
|
+
self.key = attributes[:'key']
|
|
109
|
+
else
|
|
110
|
+
self.key = nil
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'key_prefix')
|
|
114
|
+
self.key_prefix = attributes[:'key_prefix']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'allowed_cidrs')
|
|
118
|
+
if (value = attributes[:'allowed_cidrs']).is_a?(Array)
|
|
119
|
+
self.allowed_cidrs = value
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'allowed_scopes')
|
|
124
|
+
if (value = attributes[:'allowed_scopes']).is_a?(Array)
|
|
125
|
+
self.allowed_scopes = value
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
131
|
+
# @return Array for valid properties with the reasons
|
|
132
|
+
def list_invalid_properties
|
|
133
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
134
|
+
invalid_properties = Array.new
|
|
135
|
+
if @rc.nil?
|
|
136
|
+
invalid_properties.push('invalid value for "rc", rc cannot be nil.')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if @id.nil?
|
|
140
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if @key.nil?
|
|
144
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
invalid_properties
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Check to see if the all the properties in the model are valid
|
|
151
|
+
# @return true if the model is valid
|
|
152
|
+
def valid?
|
|
153
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
154
|
+
return false if @rc.nil?
|
|
155
|
+
return false if @id.nil?
|
|
156
|
+
return false if @key.nil?
|
|
157
|
+
true
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Custom attribute writer method with validation
|
|
161
|
+
# @param [Object] rc Value to be assigned
|
|
162
|
+
def rc=(rc)
|
|
163
|
+
if rc.nil?
|
|
164
|
+
fail ArgumentError, 'rc cannot be nil'
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
@rc = rc
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Custom attribute writer method with validation
|
|
171
|
+
# @param [Object] id Value to be assigned
|
|
172
|
+
def id=(id)
|
|
173
|
+
if id.nil?
|
|
174
|
+
fail ArgumentError, 'id cannot be nil'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@id = id
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Custom attribute writer method with validation
|
|
181
|
+
# @param [Object] key Value to be assigned
|
|
182
|
+
def key=(key)
|
|
183
|
+
if key.nil?
|
|
184
|
+
fail ArgumentError, 'key cannot be nil'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
@key = key
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Checks equality by comparing each attribute.
|
|
191
|
+
# @param [Object] Object to be compared
|
|
192
|
+
def ==(o)
|
|
193
|
+
return true if self.equal?(o)
|
|
194
|
+
self.class == o.class &&
|
|
195
|
+
rc == o.rc &&
|
|
196
|
+
id == o.id &&
|
|
197
|
+
name == o.name &&
|
|
198
|
+
key == o.key &&
|
|
199
|
+
key_prefix == o.key_prefix &&
|
|
200
|
+
allowed_cidrs == o.allowed_cidrs &&
|
|
201
|
+
allowed_scopes == o.allowed_scopes
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# @see the `==` method
|
|
205
|
+
# @param [Object] Object to be compared
|
|
206
|
+
def eql?(o)
|
|
207
|
+
self == o
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Calculates hash code according to all attributes.
|
|
211
|
+
# @return [Integer] Hash code
|
|
212
|
+
def hash
|
|
213
|
+
[rc, id, name, key, key_prefix, allowed_cidrs, allowed_scopes].hash
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Builds the object from hash
|
|
217
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
218
|
+
# @return [Object] Returns the model itself
|
|
219
|
+
def self.build_from_hash(attributes)
|
|
220
|
+
return nil unless attributes.is_a?(Hash)
|
|
221
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
222
|
+
transformed_hash = {}
|
|
223
|
+
openapi_types.each_pair do |key, type|
|
|
224
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
225
|
+
transformed_hash["#{key}"] = nil
|
|
226
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
227
|
+
# check to ensure the input is an array given that the attribute
|
|
228
|
+
# is documented as an array but the input is not
|
|
229
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
230
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
231
|
+
end
|
|
232
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
233
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
new(transformed_hash)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Returns the object in the form of hash
|
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
|
241
|
+
def to_hash
|
|
242
|
+
hash = {}
|
|
243
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
244
|
+
value = self.send(attr)
|
|
245
|
+
if value.nil?
|
|
246
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
247
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
hash[param] = _to_hash(value)
|
|
251
|
+
end
|
|
252
|
+
hash
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
end
|