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,164 @@
|
|
|
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 ErrorEnvelope < ApiModelBase
|
|
18
|
+
attr_accessor :rc
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'rc' => :'rc'
|
|
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
|
+
:'rc' => :'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::ErrorEnvelope` 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::ErrorEnvelope`. 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?(:'rc')
|
|
67
|
+
self.rc = attributes[:'rc']
|
|
68
|
+
else
|
|
69
|
+
self.rc = 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 @rc.nil?
|
|
79
|
+
invalid_properties.push('invalid value for "rc", rc 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 @rc.nil?
|
|
90
|
+
true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Custom attribute writer method with validation
|
|
94
|
+
# @param [Object] rc Value to be assigned
|
|
95
|
+
def rc=(rc)
|
|
96
|
+
if rc.nil?
|
|
97
|
+
fail ArgumentError, 'rc cannot be nil'
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
@rc = rc
|
|
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
|
+
rc == o.rc
|
|
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
|
+
[rc].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
|
|
@@ -0,0 +1,358 @@
|
|
|
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
|
+
# One dataset FAMILY your organization is licensed for. A license covers the family, while a download names a specific version, so the ids you pass to the download and checksum endpoints come from `versions`.
|
|
18
|
+
class LicensedDataset < ApiModelBase
|
|
19
|
+
# The dataset family, e.g. `vpn_ip`. What the license is held against.
|
|
20
|
+
attr_accessor :base
|
|
21
|
+
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
attr_accessor :summary
|
|
25
|
+
|
|
26
|
+
# What your license permits you to do with the data.
|
|
27
|
+
attr_accessor :redistribution
|
|
28
|
+
|
|
29
|
+
attr_accessor :starts
|
|
30
|
+
|
|
31
|
+
# Null when the license does not expire.
|
|
32
|
+
attr_accessor :expires
|
|
33
|
+
|
|
34
|
+
# False when the license has lapsed; downloads are refused.
|
|
35
|
+
attr_accessor :in_term
|
|
36
|
+
|
|
37
|
+
# `licensed` is a live grant, `expired` one whose term has ended, and `unlicensed` a dataset published but never bought.
|
|
38
|
+
attr_accessor :standing
|
|
39
|
+
|
|
40
|
+
# Every published version of this family. The `id` here is what the download and checksum endpoints take.
|
|
41
|
+
attr_accessor :versions
|
|
42
|
+
|
|
43
|
+
class EnumAttributeValidator
|
|
44
|
+
attr_reader :datatype
|
|
45
|
+
attr_reader :allowable_values
|
|
46
|
+
|
|
47
|
+
def initialize(datatype, allowable_values)
|
|
48
|
+
@allowable_values = allowable_values.map do |value|
|
|
49
|
+
case datatype.to_s
|
|
50
|
+
when /Integer/i
|
|
51
|
+
value.to_i
|
|
52
|
+
when /Float/i
|
|
53
|
+
value.to_f
|
|
54
|
+
else
|
|
55
|
+
value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def valid?(value)
|
|
61
|
+
!value || allowable_values.include?(value)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
66
|
+
def self.attribute_map
|
|
67
|
+
{
|
|
68
|
+
:'base' => :'base',
|
|
69
|
+
:'name' => :'name',
|
|
70
|
+
:'summary' => :'summary',
|
|
71
|
+
:'redistribution' => :'redistribution',
|
|
72
|
+
:'starts' => :'starts',
|
|
73
|
+
:'expires' => :'expires',
|
|
74
|
+
:'in_term' => :'in_term',
|
|
75
|
+
:'standing' => :'standing',
|
|
76
|
+
:'versions' => :'versions'
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Returns attribute mapping this model knows about
|
|
81
|
+
def self.acceptable_attribute_map
|
|
82
|
+
attribute_map
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns all the JSON keys this model knows about
|
|
86
|
+
def self.acceptable_attributes
|
|
87
|
+
acceptable_attribute_map.values
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Attribute type mapping.
|
|
91
|
+
def self.openapi_types
|
|
92
|
+
{
|
|
93
|
+
:'base' => :'String',
|
|
94
|
+
:'name' => :'String',
|
|
95
|
+
:'summary' => :'String',
|
|
96
|
+
:'redistribution' => :'String',
|
|
97
|
+
:'starts' => :'Time',
|
|
98
|
+
:'expires' => :'Time',
|
|
99
|
+
:'in_term' => :'Boolean',
|
|
100
|
+
:'standing' => :'String',
|
|
101
|
+
:'versions' => :'Array<LicensedVersion>'
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# List of attributes with nullable: true
|
|
106
|
+
def self.openapi_nullable
|
|
107
|
+
Set.new([
|
|
108
|
+
:'starts',
|
|
109
|
+
:'expires',
|
|
110
|
+
])
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Initializes the object
|
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
115
|
+
def initialize(attributes = {})
|
|
116
|
+
if (!attributes.is_a?(Hash))
|
|
117
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::LicensedDataset` initialize method"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
121
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
122
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
123
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
124
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::LicensedDataset`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
125
|
+
end
|
|
126
|
+
h[k.to_sym] = v
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'base')
|
|
130
|
+
self.base = attributes[:'base']
|
|
131
|
+
else
|
|
132
|
+
self.base = nil
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'name')
|
|
136
|
+
self.name = attributes[:'name']
|
|
137
|
+
else
|
|
138
|
+
self.name = nil
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'summary')
|
|
142
|
+
self.summary = attributes[:'summary']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'redistribution')
|
|
146
|
+
self.redistribution = attributes[:'redistribution']
|
|
147
|
+
else
|
|
148
|
+
self.redistribution = nil
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'starts')
|
|
152
|
+
self.starts = attributes[:'starts']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'expires')
|
|
156
|
+
self.expires = attributes[:'expires']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'in_term')
|
|
160
|
+
self.in_term = attributes[:'in_term']
|
|
161
|
+
else
|
|
162
|
+
self.in_term = nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'standing')
|
|
166
|
+
self.standing = attributes[:'standing']
|
|
167
|
+
else
|
|
168
|
+
self.standing = nil
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'versions')
|
|
172
|
+
if (value = attributes[:'versions']).is_a?(Array)
|
|
173
|
+
self.versions = value
|
|
174
|
+
end
|
|
175
|
+
else
|
|
176
|
+
self.versions = nil
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
181
|
+
# @return Array for valid properties with the reasons
|
|
182
|
+
def list_invalid_properties
|
|
183
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
184
|
+
invalid_properties = Array.new
|
|
185
|
+
if @base.nil?
|
|
186
|
+
invalid_properties.push('invalid value for "base", base cannot be nil.')
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
if @name.nil?
|
|
190
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if @redistribution.nil?
|
|
194
|
+
invalid_properties.push('invalid value for "redistribution", redistribution cannot be nil.')
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if @in_term.nil?
|
|
198
|
+
invalid_properties.push('invalid value for "in_term", in_term cannot be nil.')
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if @standing.nil?
|
|
202
|
+
invalid_properties.push('invalid value for "standing", standing cannot be nil.')
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if @versions.nil?
|
|
206
|
+
invalid_properties.push('invalid value for "versions", versions cannot be nil.')
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
invalid_properties
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Check to see if the all the properties in the model are valid
|
|
213
|
+
# @return true if the model is valid
|
|
214
|
+
def valid?
|
|
215
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
216
|
+
return false if @base.nil?
|
|
217
|
+
return false if @name.nil?
|
|
218
|
+
return false if @redistribution.nil?
|
|
219
|
+
redistribution_validator = EnumAttributeValidator.new('String', ["evaluation", "internal", "redistribute"])
|
|
220
|
+
return false unless redistribution_validator.valid?(@redistribution)
|
|
221
|
+
return false if @in_term.nil?
|
|
222
|
+
return false if @standing.nil?
|
|
223
|
+
standing_validator = EnumAttributeValidator.new('String', ["expired", "licensed", "unlicensed"])
|
|
224
|
+
return false unless standing_validator.valid?(@standing)
|
|
225
|
+
return false if @versions.nil?
|
|
226
|
+
true
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Custom attribute writer method with validation
|
|
230
|
+
# @param [Object] base Value to be assigned
|
|
231
|
+
def base=(base)
|
|
232
|
+
if base.nil?
|
|
233
|
+
fail ArgumentError, 'base cannot be nil'
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
@base = base
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Custom attribute writer method with validation
|
|
240
|
+
# @param [Object] name Value to be assigned
|
|
241
|
+
def name=(name)
|
|
242
|
+
if name.nil?
|
|
243
|
+
fail ArgumentError, 'name cannot be nil'
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
@name = name
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
250
|
+
# @param [Object] redistribution Object to be assigned
|
|
251
|
+
def redistribution=(redistribution)
|
|
252
|
+
validator = EnumAttributeValidator.new('String', ["evaluation", "internal", "redistribute"])
|
|
253
|
+
unless validator.valid?(redistribution)
|
|
254
|
+
fail ArgumentError, "invalid value for \"redistribution\", must be one of #{validator.allowable_values}."
|
|
255
|
+
end
|
|
256
|
+
@redistribution = redistribution
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Custom attribute writer method with validation
|
|
260
|
+
# @param [Object] in_term Value to be assigned
|
|
261
|
+
def in_term=(in_term)
|
|
262
|
+
if in_term.nil?
|
|
263
|
+
fail ArgumentError, 'in_term cannot be nil'
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
@in_term = in_term
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
270
|
+
# @param [Object] standing Object to be assigned
|
|
271
|
+
def standing=(standing)
|
|
272
|
+
validator = EnumAttributeValidator.new('String', ["expired", "licensed", "unlicensed"])
|
|
273
|
+
unless validator.valid?(standing)
|
|
274
|
+
fail ArgumentError, "invalid value for \"standing\", must be one of #{validator.allowable_values}."
|
|
275
|
+
end
|
|
276
|
+
@standing = standing
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Custom attribute writer method with validation
|
|
280
|
+
# @param [Object] versions Value to be assigned
|
|
281
|
+
def versions=(versions)
|
|
282
|
+
if versions.nil?
|
|
283
|
+
fail ArgumentError, 'versions cannot be nil'
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
@versions = versions
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Checks equality by comparing each attribute.
|
|
290
|
+
# @param [Object] Object to be compared
|
|
291
|
+
def ==(o)
|
|
292
|
+
return true if self.equal?(o)
|
|
293
|
+
self.class == o.class &&
|
|
294
|
+
base == o.base &&
|
|
295
|
+
name == o.name &&
|
|
296
|
+
summary == o.summary &&
|
|
297
|
+
redistribution == o.redistribution &&
|
|
298
|
+
starts == o.starts &&
|
|
299
|
+
expires == o.expires &&
|
|
300
|
+
in_term == o.in_term &&
|
|
301
|
+
standing == o.standing &&
|
|
302
|
+
versions == o.versions
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# @see the `==` method
|
|
306
|
+
# @param [Object] Object to be compared
|
|
307
|
+
def eql?(o)
|
|
308
|
+
self == o
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# Calculates hash code according to all attributes.
|
|
312
|
+
# @return [Integer] Hash code
|
|
313
|
+
def hash
|
|
314
|
+
[base, name, summary, redistribution, starts, expires, in_term, standing, versions].hash
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Builds the object from hash
|
|
318
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
319
|
+
# @return [Object] Returns the model itself
|
|
320
|
+
def self.build_from_hash(attributes)
|
|
321
|
+
return nil unless attributes.is_a?(Hash)
|
|
322
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
323
|
+
transformed_hash = {}
|
|
324
|
+
openapi_types.each_pair do |key, type|
|
|
325
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
326
|
+
transformed_hash["#{key}"] = nil
|
|
327
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
328
|
+
# check to ensure the input is an array given that the attribute
|
|
329
|
+
# is documented as an array but the input is not
|
|
330
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
331
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
332
|
+
end
|
|
333
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
334
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
new(transformed_hash)
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Returns the object in the form of hash
|
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
|
342
|
+
def to_hash
|
|
343
|
+
hash = {}
|
|
344
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
345
|
+
value = self.send(attr)
|
|
346
|
+
if value.nil?
|
|
347
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
348
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
hash[param] = _to_hash(value)
|
|
352
|
+
end
|
|
353
|
+
hash
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
end
|