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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +171 -0
- data/lib/vpndetection/api/database_api.rb +351 -0
- data/lib/vpndetection/api/lookup_api.rb +85 -0
- data/lib/vpndetection/api_client.rb +397 -0
- data/lib/vpndetection/api_error.rb +58 -0
- data/lib/vpndetection/api_model_base.rb +88 -0
- data/lib/vpndetection/bogon.rb +60 -0
- data/lib/vpndetection/bogons.rb +67 -0
- data/lib/vpndetection/cache.rb +35 -0
- data/lib/vpndetection/client.rb +133 -0
- data/lib/vpndetection/configuration.rb +326 -0
- data/lib/vpndetection/database.rb +167 -0
- data/lib/vpndetection/errors.rb +107 -0
- data/lib/vpndetection/models/class_detail.rb +169 -0
- data/lib/vpndetection/models/dataset_checksums.rb +174 -0
- data/lib/vpndetection/models/dataset_checksums_response.rb +216 -0
- data/lib/vpndetection/models/dataset_format_size.rb +201 -0
- data/lib/vpndetection/models/dataset_list.rb +166 -0
- data/lib/vpndetection/models/dataset_metadata.rb +280 -0
- data/lib/vpndetection/models/dataset_metadata_column.rb +199 -0
- data/lib/vpndetection/models/download.rb +276 -0
- data/lib/vpndetection/models/download_list.rb +166 -0
- data/lib/vpndetection/models/error_envelope.rb +164 -0
- data/lib/vpndetection/models/licensed_dataset.rb +358 -0
- data/lib/vpndetection/models/licensed_version.rb +262 -0
- data/lib/vpndetection/models/lookup_error.rb +166 -0
- data/lib/vpndetection/models/lookup_response.rb +343 -0
- data/lib/vpndetection/models/proxy_detail.rb +199 -0
- data/lib/vpndetection/models/vpn_detail.rb +179 -0
- data/lib/vpndetection/result.rb +211 -0
- data/lib/vpndetection/retries.rb +33 -0
- data/lib/vpndetection/transport.rb +116 -0
- data/lib/vpndetection/version.rb +5 -0
- data/lib/vpndetection.rb +40 -0
- metadata +109 -0
|
@@ -0,0 +1,201 @@
|
|
|
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 DatasetFormatSize < ApiModelBase
|
|
18
|
+
attr_accessor :format
|
|
19
|
+
|
|
20
|
+
# Size of the published file, or null when it has not been published yet
|
|
21
|
+
attr_accessor :bytes
|
|
22
|
+
|
|
23
|
+
class EnumAttributeValidator
|
|
24
|
+
attr_reader :datatype
|
|
25
|
+
attr_reader :allowable_values
|
|
26
|
+
|
|
27
|
+
def initialize(datatype, allowable_values)
|
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
|
29
|
+
case datatype.to_s
|
|
30
|
+
when /Integer/i
|
|
31
|
+
value.to_i
|
|
32
|
+
when /Float/i
|
|
33
|
+
value.to_f
|
|
34
|
+
else
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?(value)
|
|
41
|
+
!value || allowable_values.include?(value)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
|
+
def self.attribute_map
|
|
47
|
+
{
|
|
48
|
+
:'format' => :'format',
|
|
49
|
+
:'bytes' => :'bytes'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns attribute mapping this model knows about
|
|
54
|
+
def self.acceptable_attribute_map
|
|
55
|
+
attribute_map
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns all the JSON keys this model knows about
|
|
59
|
+
def self.acceptable_attributes
|
|
60
|
+
acceptable_attribute_map.values
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.openapi_types
|
|
65
|
+
{
|
|
66
|
+
:'format' => :'String',
|
|
67
|
+
:'bytes' => :'Integer'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
:'bytes'
|
|
75
|
+
])
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Initializes the object
|
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
80
|
+
def initialize(attributes = {})
|
|
81
|
+
if (!attributes.is_a?(Hash))
|
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::DatasetFormatSize` initialize method"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
86
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
88
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
89
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::DatasetFormatSize`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
90
|
+
end
|
|
91
|
+
h[k.to_sym] = v
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'format')
|
|
95
|
+
self.format = attributes[:'format']
|
|
96
|
+
else
|
|
97
|
+
self.format = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'bytes')
|
|
101
|
+
self.bytes = attributes[:'bytes']
|
|
102
|
+
else
|
|
103
|
+
self.bytes = nil
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
108
|
+
# @return Array for valid properties with the reasons
|
|
109
|
+
def list_invalid_properties
|
|
110
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
111
|
+
invalid_properties = Array.new
|
|
112
|
+
if @format.nil?
|
|
113
|
+
invalid_properties.push('invalid value for "format", format cannot be nil.')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
invalid_properties
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Check to see if the all the properties in the model are valid
|
|
120
|
+
# @return true if the model is valid
|
|
121
|
+
def valid?
|
|
122
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
123
|
+
return false if @format.nil?
|
|
124
|
+
format_validator = EnumAttributeValidator.new('String', ["csvgz", "mmdb"])
|
|
125
|
+
return false unless format_validator.valid?(@format)
|
|
126
|
+
true
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
130
|
+
# @param [Object] format Object to be assigned
|
|
131
|
+
def format=(format)
|
|
132
|
+
validator = EnumAttributeValidator.new('String', ["csvgz", "mmdb"])
|
|
133
|
+
unless validator.valid?(format)
|
|
134
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
|
|
135
|
+
end
|
|
136
|
+
@format = format
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Checks equality by comparing each attribute.
|
|
140
|
+
# @param [Object] Object to be compared
|
|
141
|
+
def ==(o)
|
|
142
|
+
return true if self.equal?(o)
|
|
143
|
+
self.class == o.class &&
|
|
144
|
+
format == o.format &&
|
|
145
|
+
bytes == o.bytes
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# @see the `==` method
|
|
149
|
+
# @param [Object] Object to be compared
|
|
150
|
+
def eql?(o)
|
|
151
|
+
self == o
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Calculates hash code according to all attributes.
|
|
155
|
+
# @return [Integer] Hash code
|
|
156
|
+
def hash
|
|
157
|
+
[format, bytes].hash
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Builds the object from hash
|
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
162
|
+
# @return [Object] Returns the model itself
|
|
163
|
+
def self.build_from_hash(attributes)
|
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
|
165
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
166
|
+
transformed_hash = {}
|
|
167
|
+
openapi_types.each_pair do |key, type|
|
|
168
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
169
|
+
transformed_hash["#{key}"] = nil
|
|
170
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
171
|
+
# check to ensure the input is an array given that the attribute
|
|
172
|
+
# is documented as an array but the input is not
|
|
173
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
174
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
175
|
+
end
|
|
176
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
177
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
new(transformed_hash)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Returns the object in the form of hash
|
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
|
185
|
+
def to_hash
|
|
186
|
+
hash = {}
|
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
188
|
+
value = self.send(attr)
|
|
189
|
+
if value.nil?
|
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
hash[param] = _to_hash(value)
|
|
195
|
+
end
|
|
196
|
+
hash
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
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
|
+
class DatasetList < ApiModelBase
|
|
18
|
+
attr_accessor :datasets
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'datasets' => :'datasets'
|
|
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
|
+
:'datasets' => :'Array<LicensedDataset>'
|
|
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::DatasetList` 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::DatasetList`. 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?(:'datasets')
|
|
67
|
+
if (value = attributes[:'datasets']).is_a?(Array)
|
|
68
|
+
self.datasets = value
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
self.datasets = 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 @datasets.nil?
|
|
81
|
+
invalid_properties.push('invalid value for "datasets", datasets 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 @datasets.nil?
|
|
92
|
+
true
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Custom attribute writer method with validation
|
|
96
|
+
# @param [Object] datasets Value to be assigned
|
|
97
|
+
def datasets=(datasets)
|
|
98
|
+
if datasets.nil?
|
|
99
|
+
fail ArgumentError, 'datasets cannot be nil'
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
@datasets = datasets
|
|
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
|
+
datasets == o.datasets
|
|
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
|
+
[datasets].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
|
|
@@ -0,0 +1,280 @@
|
|
|
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 DatasetMetadata < ApiModelBase
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
# How often a new build is published
|
|
21
|
+
attr_accessor :update_freq
|
|
22
|
+
|
|
23
|
+
attr_accessor :updated
|
|
24
|
+
|
|
25
|
+
# Row count in the current build
|
|
26
|
+
attr_accessor :entries
|
|
27
|
+
|
|
28
|
+
# Columns, keyed by format
|
|
29
|
+
attr_accessor :schema
|
|
30
|
+
|
|
31
|
+
# A few real rows, keyed by format
|
|
32
|
+
attr_accessor :sample
|
|
33
|
+
|
|
34
|
+
# Bytes per format
|
|
35
|
+
attr_accessor :size
|
|
36
|
+
|
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
38
|
+
def self.attribute_map
|
|
39
|
+
{
|
|
40
|
+
:'id' => :'id',
|
|
41
|
+
:'update_freq' => :'update_freq',
|
|
42
|
+
:'updated' => :'updated',
|
|
43
|
+
:'entries' => :'entries',
|
|
44
|
+
:'schema' => :'schema',
|
|
45
|
+
:'sample' => :'sample',
|
|
46
|
+
:'size' => :'size'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns attribute mapping this model knows about
|
|
51
|
+
def self.acceptable_attribute_map
|
|
52
|
+
attribute_map
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns all the JSON keys this model knows about
|
|
56
|
+
def self.acceptable_attributes
|
|
57
|
+
acceptable_attribute_map.values
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute type mapping.
|
|
61
|
+
def self.openapi_types
|
|
62
|
+
{
|
|
63
|
+
:'id' => :'String',
|
|
64
|
+
:'update_freq' => :'String',
|
|
65
|
+
:'updated' => :'Date',
|
|
66
|
+
:'entries' => :'Integer',
|
|
67
|
+
:'schema' => :'Hash<String, Array<DatasetMetadataColumn>>',
|
|
68
|
+
:'sample' => :'Hash<String, Array<Object>>',
|
|
69
|
+
:'size' => :'Hash<String, Integer>'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::DatasetMetadata` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::DatasetMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'id')
|
|
96
|
+
self.id = attributes[:'id']
|
|
97
|
+
else
|
|
98
|
+
self.id = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'update_freq')
|
|
102
|
+
self.update_freq = attributes[:'update_freq']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'updated')
|
|
106
|
+
self.updated = attributes[:'updated']
|
|
107
|
+
else
|
|
108
|
+
self.updated = nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'entries')
|
|
112
|
+
self.entries = attributes[:'entries']
|
|
113
|
+
else
|
|
114
|
+
self.entries = nil
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'schema')
|
|
118
|
+
if (value = attributes[:'schema']).is_a?(Hash)
|
|
119
|
+
self.schema = value
|
|
120
|
+
end
|
|
121
|
+
else
|
|
122
|
+
self.schema = nil
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'sample')
|
|
126
|
+
if (value = attributes[:'sample']).is_a?(Hash)
|
|
127
|
+
self.sample = value
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'size')
|
|
132
|
+
if (value = attributes[:'size']).is_a?(Hash)
|
|
133
|
+
self.size = value
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
139
|
+
# @return Array for valid properties with the reasons
|
|
140
|
+
def list_invalid_properties
|
|
141
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
142
|
+
invalid_properties = Array.new
|
|
143
|
+
if @id.nil?
|
|
144
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if @updated.nil?
|
|
148
|
+
invalid_properties.push('invalid value for "updated", updated cannot be nil.')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if @entries.nil?
|
|
152
|
+
invalid_properties.push('invalid value for "entries", entries cannot be nil.')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if @schema.nil?
|
|
156
|
+
invalid_properties.push('invalid value for "schema", schema cannot be nil.')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
invalid_properties
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Check to see if the all the properties in the model are valid
|
|
163
|
+
# @return true if the model is valid
|
|
164
|
+
def valid?
|
|
165
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
166
|
+
return false if @id.nil?
|
|
167
|
+
return false if @updated.nil?
|
|
168
|
+
return false if @entries.nil?
|
|
169
|
+
return false if @schema.nil?
|
|
170
|
+
true
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Custom attribute writer method with validation
|
|
174
|
+
# @param [Object] id Value to be assigned
|
|
175
|
+
def id=(id)
|
|
176
|
+
if id.nil?
|
|
177
|
+
fail ArgumentError, 'id cannot be nil'
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@id = id
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Custom attribute writer method with validation
|
|
184
|
+
# @param [Object] updated Value to be assigned
|
|
185
|
+
def updated=(updated)
|
|
186
|
+
if updated.nil?
|
|
187
|
+
fail ArgumentError, 'updated cannot be nil'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
@updated = updated
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Custom attribute writer method with validation
|
|
194
|
+
# @param [Object] entries Value to be assigned
|
|
195
|
+
def entries=(entries)
|
|
196
|
+
if entries.nil?
|
|
197
|
+
fail ArgumentError, 'entries cannot be nil'
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
@entries = entries
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Custom attribute writer method with validation
|
|
204
|
+
# @param [Object] schema Value to be assigned
|
|
205
|
+
def schema=(schema)
|
|
206
|
+
if schema.nil?
|
|
207
|
+
fail ArgumentError, 'schema cannot be nil'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
@schema = schema
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Checks equality by comparing each attribute.
|
|
214
|
+
# @param [Object] Object to be compared
|
|
215
|
+
def ==(o)
|
|
216
|
+
return true if self.equal?(o)
|
|
217
|
+
self.class == o.class &&
|
|
218
|
+
id == o.id &&
|
|
219
|
+
update_freq == o.update_freq &&
|
|
220
|
+
updated == o.updated &&
|
|
221
|
+
entries == o.entries &&
|
|
222
|
+
schema == o.schema &&
|
|
223
|
+
sample == o.sample &&
|
|
224
|
+
size == o.size
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# @see the `==` method
|
|
228
|
+
# @param [Object] Object to be compared
|
|
229
|
+
def eql?(o)
|
|
230
|
+
self == o
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Calculates hash code according to all attributes.
|
|
234
|
+
# @return [Integer] Hash code
|
|
235
|
+
def hash
|
|
236
|
+
[id, update_freq, updated, entries, schema, sample, size].hash
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Builds the object from hash
|
|
240
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
241
|
+
# @return [Object] Returns the model itself
|
|
242
|
+
def self.build_from_hash(attributes)
|
|
243
|
+
return nil unless attributes.is_a?(Hash)
|
|
244
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
245
|
+
transformed_hash = {}
|
|
246
|
+
openapi_types.each_pair do |key, type|
|
|
247
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
248
|
+
transformed_hash["#{key}"] = nil
|
|
249
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
250
|
+
# check to ensure the input is an array given that the attribute
|
|
251
|
+
# is documented as an array but the input is not
|
|
252
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
253
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
254
|
+
end
|
|
255
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
256
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
new(transformed_hash)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Returns the object in the form of hash
|
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
|
264
|
+
def to_hash
|
|
265
|
+
hash = {}
|
|
266
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
267
|
+
value = self.send(attr)
|
|
268
|
+
if value.nil?
|
|
269
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
270
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
hash[param] = _to_hash(value)
|
|
274
|
+
end
|
|
275
|
+
hash
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
end
|