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 +4 -4
- data/lib/vpndetection/api/account_wire_api.rb +79 -0
- data/lib/vpndetection/api/database_wire_api.rb +2 -2
- data/lib/vpndetection/client.rb +41 -0
- data/lib/vpndetection/configuration.rb +0 -8
- data/lib/vpndetection/models/account_apikey.rb +207 -0
- data/lib/vpndetection/models/account_error.rb +164 -0
- data/lib/vpndetection/models/account_me.rb +243 -0
- data/lib/vpndetection/models/account_plan.rb +216 -0
- data/lib/vpndetection/models/account_usage.rb +259 -0
- data/lib/vpndetection/models/database.rb +10 -11
- data/lib/vpndetection/transport.rb +25 -0
- data/lib/vpndetection/version.rb +1 -1
- metadata +7 -2
- data/lib/vpndetection/models/license_type.rb +0 -41
|
@@ -0,0 +1,243 @@
|
|
|
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 AccountMe < ApiModelBase
|
|
18
|
+
# The organization the key belongs to.
|
|
19
|
+
attr_accessor :org_id
|
|
20
|
+
|
|
21
|
+
attr_accessor :apikey
|
|
22
|
+
|
|
23
|
+
attr_accessor :plan
|
|
24
|
+
|
|
25
|
+
attr_accessor :usage
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'org_id' => :'org_id',
|
|
31
|
+
:'apikey' => :'apikey',
|
|
32
|
+
:'plan' => :'plan',
|
|
33
|
+
:'usage' => :'usage'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns attribute mapping this model knows about
|
|
38
|
+
def self.acceptable_attribute_map
|
|
39
|
+
attribute_map
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Returns all the JSON keys this model knows about
|
|
43
|
+
def self.acceptable_attributes
|
|
44
|
+
acceptable_attribute_map.values
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute type mapping.
|
|
48
|
+
def self.openapi_types
|
|
49
|
+
{
|
|
50
|
+
:'org_id' => :'String',
|
|
51
|
+
:'apikey' => :'AccountApikey',
|
|
52
|
+
:'plan' => :'AccountPlan',
|
|
53
|
+
:'usage' => :'AccountUsage'
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# List of attributes with nullable: true
|
|
58
|
+
def self.openapi_nullable
|
|
59
|
+
Set.new([
|
|
60
|
+
])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Initializes the object
|
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
65
|
+
def initialize(attributes = {})
|
|
66
|
+
if (!attributes.is_a?(Hash))
|
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountMe` initialize method"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
71
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
73
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
74
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountMe`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
75
|
+
end
|
|
76
|
+
h[k.to_sym] = v
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:'org_id')
|
|
80
|
+
self.org_id = attributes[:'org_id']
|
|
81
|
+
else
|
|
82
|
+
self.org_id = nil
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'apikey')
|
|
86
|
+
self.apikey = attributes[:'apikey']
|
|
87
|
+
else
|
|
88
|
+
self.apikey = nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'plan')
|
|
92
|
+
self.plan = attributes[:'plan']
|
|
93
|
+
else
|
|
94
|
+
self.plan = nil
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'usage')
|
|
98
|
+
self.usage = attributes[:'usage']
|
|
99
|
+
else
|
|
100
|
+
self.usage = nil
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
105
|
+
# @return Array for valid properties with the reasons
|
|
106
|
+
def list_invalid_properties
|
|
107
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
108
|
+
invalid_properties = Array.new
|
|
109
|
+
if @org_id.nil?
|
|
110
|
+
invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if @apikey.nil?
|
|
114
|
+
invalid_properties.push('invalid value for "apikey", apikey cannot be nil.')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if @plan.nil?
|
|
118
|
+
invalid_properties.push('invalid value for "plan", plan cannot be nil.')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if @usage.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "usage", usage cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
invalid_properties
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Check to see if the all the properties in the model are valid
|
|
129
|
+
# @return true if the model is valid
|
|
130
|
+
def valid?
|
|
131
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
132
|
+
return false if @org_id.nil?
|
|
133
|
+
return false if @apikey.nil?
|
|
134
|
+
return false if @plan.nil?
|
|
135
|
+
return false if @usage.nil?
|
|
136
|
+
true
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Custom attribute writer method with validation
|
|
140
|
+
# @param [Object] org_id Value to be assigned
|
|
141
|
+
def org_id=(org_id)
|
|
142
|
+
if org_id.nil?
|
|
143
|
+
fail ArgumentError, 'org_id cannot be nil'
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
@org_id = org_id
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Custom attribute writer method with validation
|
|
150
|
+
# @param [Object] apikey Value to be assigned
|
|
151
|
+
def apikey=(apikey)
|
|
152
|
+
if apikey.nil?
|
|
153
|
+
fail ArgumentError, 'apikey cannot be nil'
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
@apikey = apikey
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method with validation
|
|
160
|
+
# @param [Object] plan Value to be assigned
|
|
161
|
+
def plan=(plan)
|
|
162
|
+
if plan.nil?
|
|
163
|
+
fail ArgumentError, 'plan cannot be nil'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@plan = plan
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Custom attribute writer method with validation
|
|
170
|
+
# @param [Object] usage Value to be assigned
|
|
171
|
+
def usage=(usage)
|
|
172
|
+
if usage.nil?
|
|
173
|
+
fail ArgumentError, 'usage cannot be nil'
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@usage = usage
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Checks equality by comparing each attribute.
|
|
180
|
+
# @param [Object] Object to be compared
|
|
181
|
+
def ==(o)
|
|
182
|
+
return true if self.equal?(o)
|
|
183
|
+
self.class == o.class &&
|
|
184
|
+
org_id == o.org_id &&
|
|
185
|
+
apikey == o.apikey &&
|
|
186
|
+
plan == o.plan &&
|
|
187
|
+
usage == o.usage
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# @see the `==` method
|
|
191
|
+
# @param [Object] Object to be compared
|
|
192
|
+
def eql?(o)
|
|
193
|
+
self == o
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Calculates hash code according to all attributes.
|
|
197
|
+
# @return [Integer] Hash code
|
|
198
|
+
def hash
|
|
199
|
+
[org_id, apikey, plan, usage].hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Builds the object from hash
|
|
203
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
204
|
+
# @return [Object] Returns the model itself
|
|
205
|
+
def self.build_from_hash(attributes)
|
|
206
|
+
return nil unless attributes.is_a?(Hash)
|
|
207
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
208
|
+
transformed_hash = {}
|
|
209
|
+
openapi_types.each_pair do |key, type|
|
|
210
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
211
|
+
transformed_hash["#{key}"] = nil
|
|
212
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
213
|
+
# check to ensure the input is an array given that the attribute
|
|
214
|
+
# is documented as an array but the input is not
|
|
215
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
216
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
217
|
+
end
|
|
218
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
219
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
new(transformed_hash)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Returns the object in the form of hash
|
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
|
227
|
+
def to_hash
|
|
228
|
+
hash = {}
|
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
230
|
+
value = self.send(attr)
|
|
231
|
+
if value.nil?
|
|
232
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
233
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
hash[param] = _to_hash(value)
|
|
237
|
+
end
|
|
238
|
+
hash
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
end
|
|
@@ -0,0 +1,216 @@
|
|
|
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 AccountPlan < ApiModelBase
|
|
18
|
+
# The plan the organization is on.
|
|
19
|
+
attr_accessor :key
|
|
20
|
+
|
|
21
|
+
# The field tier, which decides how much of a lookup answer comes back. What each tier includes is documented on the lookup endpoint rather than repeated here, so there is one place it can be wrong.
|
|
22
|
+
attr_accessor :tier
|
|
23
|
+
|
|
24
|
+
class EnumAttributeValidator
|
|
25
|
+
attr_reader :datatype
|
|
26
|
+
attr_reader :allowable_values
|
|
27
|
+
|
|
28
|
+
def initialize(datatype, allowable_values)
|
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
|
30
|
+
case datatype.to_s
|
|
31
|
+
when /Integer/i
|
|
32
|
+
value.to_i
|
|
33
|
+
when /Float/i
|
|
34
|
+
value.to_f
|
|
35
|
+
else
|
|
36
|
+
value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid?(value)
|
|
42
|
+
!value || allowable_values.include?(value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'key' => :'key',
|
|
50
|
+
:'tier' => :'tier'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns attribute mapping this model knows about
|
|
55
|
+
def self.acceptable_attribute_map
|
|
56
|
+
attribute_map
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Returns all the JSON keys this model knows about
|
|
60
|
+
def self.acceptable_attributes
|
|
61
|
+
acceptable_attribute_map.values
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Attribute type mapping.
|
|
65
|
+
def self.openapi_types
|
|
66
|
+
{
|
|
67
|
+
:'key' => :'String',
|
|
68
|
+
:'tier' => :'String'
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# List of attributes with nullable: true
|
|
73
|
+
def self.openapi_nullable
|
|
74
|
+
Set.new([
|
|
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::AccountPlan` 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::AccountPlan`. 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?(:'key')
|
|
95
|
+
self.key = attributes[:'key']
|
|
96
|
+
else
|
|
97
|
+
self.key = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'tier')
|
|
101
|
+
self.tier = attributes[:'tier']
|
|
102
|
+
else
|
|
103
|
+
self.tier = 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 @key.nil?
|
|
113
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if @tier.nil?
|
|
117
|
+
invalid_properties.push('invalid value for "tier", tier cannot be nil.')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
invalid_properties
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Check to see if the all the properties in the model are valid
|
|
124
|
+
# @return true if the model is valid
|
|
125
|
+
def valid?
|
|
126
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
127
|
+
return false if @key.nil?
|
|
128
|
+
return false if @tier.nil?
|
|
129
|
+
tier_validator = EnumAttributeValidator.new('String', ["free", "starter", "scale", "max"])
|
|
130
|
+
return false unless tier_validator.valid?(@tier)
|
|
131
|
+
true
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Custom attribute writer method with validation
|
|
135
|
+
# @param [Object] key Value to be assigned
|
|
136
|
+
def key=(key)
|
|
137
|
+
if key.nil?
|
|
138
|
+
fail ArgumentError, 'key cannot be nil'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
@key = key
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
145
|
+
# @param [Object] tier Object to be assigned
|
|
146
|
+
def tier=(tier)
|
|
147
|
+
validator = EnumAttributeValidator.new('String', ["free", "starter", "scale", "max"])
|
|
148
|
+
unless validator.valid?(tier)
|
|
149
|
+
fail ArgumentError, "invalid value for \"tier\", must be one of #{validator.allowable_values}."
|
|
150
|
+
end
|
|
151
|
+
@tier = tier
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Checks equality by comparing each attribute.
|
|
155
|
+
# @param [Object] Object to be compared
|
|
156
|
+
def ==(o)
|
|
157
|
+
return true if self.equal?(o)
|
|
158
|
+
self.class == o.class &&
|
|
159
|
+
key == o.key &&
|
|
160
|
+
tier == o.tier
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# @see the `==` method
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def eql?(o)
|
|
166
|
+
self == o
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Calculates hash code according to all attributes.
|
|
170
|
+
# @return [Integer] Hash code
|
|
171
|
+
def hash
|
|
172
|
+
[key, tier].hash
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Builds the object from hash
|
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
177
|
+
# @return [Object] Returns the model itself
|
|
178
|
+
def self.build_from_hash(attributes)
|
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
|
180
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
181
|
+
transformed_hash = {}
|
|
182
|
+
openapi_types.each_pair do |key, type|
|
|
183
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
184
|
+
transformed_hash["#{key}"] = nil
|
|
185
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
186
|
+
# check to ensure the input is an array given that the attribute
|
|
187
|
+
# is documented as an array but the input is not
|
|
188
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
189
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
190
|
+
end
|
|
191
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
192
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
new(transformed_hash)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Returns the object in the form of hash
|
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
|
200
|
+
def to_hash
|
|
201
|
+
hash = {}
|
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
203
|
+
value = self.send(attr)
|
|
204
|
+
if value.nil?
|
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
hash[param] = _to_hash(value)
|
|
210
|
+
end
|
|
211
|
+
hash
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
end
|
|
@@ -0,0 +1,259 @@
|
|
|
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 AccountUsage < ApiModelBase
|
|
18
|
+
# Requests counted in the current window. The same number the lookup API gates on, and it can lag by a few seconds.
|
|
19
|
+
attr_accessor :requests
|
|
20
|
+
|
|
21
|
+
# What the plan includes. Zero on a plan that includes none.
|
|
22
|
+
attr_accessor :quota
|
|
23
|
+
|
|
24
|
+
# Where we stop serving. NULL means never, which is the normal state of an uncapped paid plan and is not the same as zero. Above the quota and below this, requests are served and billed as overage.
|
|
25
|
+
attr_accessor :hard_limit
|
|
26
|
+
|
|
27
|
+
# When the current allowance period began.
|
|
28
|
+
attr_accessor :window_start
|
|
29
|
+
|
|
30
|
+
# When the allowance next resets.
|
|
31
|
+
attr_accessor :window_end
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'requests' => :'requests',
|
|
37
|
+
:'quota' => :'quota',
|
|
38
|
+
:'hard_limit' => :'hard_limit',
|
|
39
|
+
:'window_start' => :'window_start',
|
|
40
|
+
:'window_end' => :'window_end'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns attribute mapping this model knows about
|
|
45
|
+
def self.acceptable_attribute_map
|
|
46
|
+
attribute_map
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns all the JSON keys this model knows about
|
|
50
|
+
def self.acceptable_attributes
|
|
51
|
+
acceptable_attribute_map.values
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute type mapping.
|
|
55
|
+
def self.openapi_types
|
|
56
|
+
{
|
|
57
|
+
:'requests' => :'Integer',
|
|
58
|
+
:'quota' => :'Integer',
|
|
59
|
+
:'hard_limit' => :'Integer',
|
|
60
|
+
:'window_start' => :'Time',
|
|
61
|
+
:'window_end' => :'Time'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# List of attributes with nullable: true
|
|
66
|
+
def self.openapi_nullable
|
|
67
|
+
Set.new([
|
|
68
|
+
:'hard_limit',
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountUsage` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountUsage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'requests')
|
|
89
|
+
self.requests = attributes[:'requests']
|
|
90
|
+
else
|
|
91
|
+
self.requests = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'quota')
|
|
95
|
+
self.quota = attributes[:'quota']
|
|
96
|
+
else
|
|
97
|
+
self.quota = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'hard_limit')
|
|
101
|
+
self.hard_limit = attributes[:'hard_limit']
|
|
102
|
+
else
|
|
103
|
+
self.hard_limit = nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'window_start')
|
|
107
|
+
self.window_start = attributes[:'window_start']
|
|
108
|
+
else
|
|
109
|
+
self.window_start = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'window_end')
|
|
113
|
+
self.window_end = attributes[:'window_end']
|
|
114
|
+
else
|
|
115
|
+
self.window_end = nil
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
120
|
+
# @return Array for valid properties with the reasons
|
|
121
|
+
def list_invalid_properties
|
|
122
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
123
|
+
invalid_properties = Array.new
|
|
124
|
+
if @requests.nil?
|
|
125
|
+
invalid_properties.push('invalid value for "requests", requests cannot be nil.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if @quota.nil?
|
|
129
|
+
invalid_properties.push('invalid value for "quota", quota cannot be nil.')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if @window_start.nil?
|
|
133
|
+
invalid_properties.push('invalid value for "window_start", window_start cannot be nil.')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if @window_end.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "window_end", window_end cannot be nil.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
invalid_properties
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Check to see if the all the properties in the model are valid
|
|
144
|
+
# @return true if the model is valid
|
|
145
|
+
def valid?
|
|
146
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
147
|
+
return false if @requests.nil?
|
|
148
|
+
return false if @quota.nil?
|
|
149
|
+
return false if @window_start.nil?
|
|
150
|
+
return false if @window_end.nil?
|
|
151
|
+
true
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Custom attribute writer method with validation
|
|
155
|
+
# @param [Object] requests Value to be assigned
|
|
156
|
+
def requests=(requests)
|
|
157
|
+
if requests.nil?
|
|
158
|
+
fail ArgumentError, 'requests cannot be nil'
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
@requests = requests
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Custom attribute writer method with validation
|
|
165
|
+
# @param [Object] quota Value to be assigned
|
|
166
|
+
def quota=(quota)
|
|
167
|
+
if quota.nil?
|
|
168
|
+
fail ArgumentError, 'quota cannot be nil'
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
@quota = quota
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom attribute writer method with validation
|
|
175
|
+
# @param [Object] window_start Value to be assigned
|
|
176
|
+
def window_start=(window_start)
|
|
177
|
+
if window_start.nil?
|
|
178
|
+
fail ArgumentError, 'window_start cannot be nil'
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@window_start = window_start
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Custom attribute writer method with validation
|
|
185
|
+
# @param [Object] window_end Value to be assigned
|
|
186
|
+
def window_end=(window_end)
|
|
187
|
+
if window_end.nil?
|
|
188
|
+
fail ArgumentError, 'window_end cannot be nil'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
@window_end = window_end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Checks equality by comparing each attribute.
|
|
195
|
+
# @param [Object] Object to be compared
|
|
196
|
+
def ==(o)
|
|
197
|
+
return true if self.equal?(o)
|
|
198
|
+
self.class == o.class &&
|
|
199
|
+
requests == o.requests &&
|
|
200
|
+
quota == o.quota &&
|
|
201
|
+
hard_limit == o.hard_limit &&
|
|
202
|
+
window_start == o.window_start &&
|
|
203
|
+
window_end == o.window_end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# @see the `==` method
|
|
207
|
+
# @param [Object] Object to be compared
|
|
208
|
+
def eql?(o)
|
|
209
|
+
self == o
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Calculates hash code according to all attributes.
|
|
213
|
+
# @return [Integer] Hash code
|
|
214
|
+
def hash
|
|
215
|
+
[requests, quota, hard_limit, window_start, window_end].hash
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Builds the object from hash
|
|
219
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
220
|
+
# @return [Object] Returns the model itself
|
|
221
|
+
def self.build_from_hash(attributes)
|
|
222
|
+
return nil unless attributes.is_a?(Hash)
|
|
223
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
224
|
+
transformed_hash = {}
|
|
225
|
+
openapi_types.each_pair do |key, type|
|
|
226
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
227
|
+
transformed_hash["#{key}"] = nil
|
|
228
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
229
|
+
# check to ensure the input is an array given that the attribute
|
|
230
|
+
# is documented as an array but the input is not
|
|
231
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
232
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
233
|
+
end
|
|
234
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
235
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
new(transformed_hash)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Returns the object in the form of hash
|
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
|
243
|
+
def to_hash
|
|
244
|
+
hash = {}
|
|
245
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
246
|
+
value = self.send(attr)
|
|
247
|
+
if value.nil?
|
|
248
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
249
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
hash[param] = _to_hash(value)
|
|
253
|
+
end
|
|
254
|
+
hash
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|