forestvpn_cloud_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +139 -0
- data/Rakefile +10 -0
- data/docs/Action.md +32 -0
- data/docs/Activity.md +36 -0
- data/docs/Address.md +28 -0
- data/docs/Billing.md +24 -0
- data/docs/Country.md +26 -0
- data/docs/CreateBillingRequest.md +22 -0
- data/docs/CreateOrUpdateDataUsageLimitRequest.md +20 -0
- data/docs/CreateOrUpdatePaymentProfileRequest.md +34 -0
- data/docs/CreateOrUpdateProfileRequest.md +22 -0
- data/docs/DataUsageLimit.md +24 -0
- data/docs/Error.md +20 -0
- data/docs/GeoApi.md +77 -0
- data/docs/LimitsApi.md +447 -0
- data/docs/Location.md +28 -0
- data/docs/PaymentMethod.md +24 -0
- data/docs/PaymentProfile.md +32 -0
- data/docs/Profile.md +26 -0
- data/docs/ProfileStats.md +26 -0
- data/docs/ProfilesApi.md +996 -0
- data/docs/Project.md +22 -0
- data/docs/ResourceRef.md +20 -0
- data/docs/User.md +32 -0
- data/forestvpn_cloud_api.gemspec +39 -0
- data/git_push.sh +57 -0
- data/lib/forestvpn_cloud_api/api/geo_api.rb +77 -0
- data/lib/forestvpn_cloud_api/api/limits_api.rb +405 -0
- data/lib/forestvpn_cloud_api/api/profiles_api.rb +915 -0
- data/lib/forestvpn_cloud_api/api_client.rb +426 -0
- data/lib/forestvpn_cloud_api/api_error.rb +57 -0
- data/lib/forestvpn_cloud_api/configuration.rb +335 -0
- data/lib/forestvpn_cloud_api/models/action.rb +348 -0
- data/lib/forestvpn_cloud_api/models/activity.rb +360 -0
- data/lib/forestvpn_cloud_api/models/address.rb +269 -0
- data/lib/forestvpn_cloud_api/models/billing.rb +266 -0
- data/lib/forestvpn_cloud_api/models/country.rb +282 -0
- data/lib/forestvpn_cloud_api/models/create_billing_request.rb +252 -0
- data/lib/forestvpn_cloud_api/models/create_or_update_data_usage_limit_request.rb +230 -0
- data/lib/forestvpn_cloud_api/models/create_or_update_payment_profile_request.rb +328 -0
- data/lib/forestvpn_cloud_api/models/create_or_update_profile_request.rb +275 -0
- data/lib/forestvpn_cloud_api/models/data_usage_limit.rb +302 -0
- data/lib/forestvpn_cloud_api/models/error.rb +238 -0
- data/lib/forestvpn_cloud_api/models/location.rb +296 -0
- data/lib/forestvpn_cloud_api/models/payment_method.rb +261 -0
- data/lib/forestvpn_cloud_api/models/payment_profile.rb +313 -0
- data/lib/forestvpn_cloud_api/models/profile.rb +320 -0
- data/lib/forestvpn_cloud_api/models/profile_stats.rb +280 -0
- data/lib/forestvpn_cloud_api/models/project.rb +254 -0
- data/lib/forestvpn_cloud_api/models/resource_ref.rb +238 -0
- data/lib/forestvpn_cloud_api/models/user.rb +307 -0
- data/lib/forestvpn_cloud_api/version.rb +15 -0
- data/lib/forestvpn_cloud_api.rb +61 -0
- data/spec/api/geo_api_spec.rb +45 -0
- data/spec/api/limits_api_spec.rb +102 -0
- data/spec/api/profiles_api_spec.rb +195 -0
- data/spec/api_client_spec.rb +188 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/action_spec.rb +80 -0
- data/spec/models/activity_spec.rb +92 -0
- data/spec/models/address_spec.rb +64 -0
- data/spec/models/billing_spec.rb +52 -0
- data/spec/models/country_spec.rb +58 -0
- data/spec/models/create_billing_request_spec.rb +46 -0
- data/spec/models/create_or_update_data_usage_limit_request_spec.rb +40 -0
- data/spec/models/create_or_update_payment_profile_request_spec.rb +82 -0
- data/spec/models/create_or_update_profile_request_spec.rb +50 -0
- data/spec/models/data_usage_limit_spec.rb +56 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/location_spec.rb +64 -0
- data/spec/models/payment_method_spec.rb +52 -0
- data/spec/models/payment_profile_spec.rb +76 -0
- data/spec/models/profile_spec.rb +62 -0
- data/spec/models/profile_stats_spec.rb +58 -0
- data/spec/models/project_spec.rb +46 -0
- data/spec/models/resource_ref_spec.rb +40 -0
- data/spec/models/user_spec.rb +76 -0
- data/spec/spec_helper.rb +111 -0
- metadata +203 -0
@@ -0,0 +1,313 @@
|
|
1
|
+
=begin
|
2
|
+
#ForestVPN Cloud API
|
3
|
+
|
4
|
+
#ForestVPN Cloud - it's a Google Cloud but for VPN apps. Ready to use VPN Cloud Platform minimizes efforts to build fast, secure, and modern VPN apps.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0
|
7
|
+
Contact: support@forestvpn.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module ForestVPNCloudAPI
|
17
|
+
class PaymentProfile
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# In some situations, your tax status will determine your tax treatment.
|
21
|
+
attr_accessor :tax_number
|
22
|
+
|
23
|
+
attr_accessor :business_name
|
24
|
+
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
attr_accessor :address
|
28
|
+
|
29
|
+
attr_accessor :primary_contact_name
|
30
|
+
|
31
|
+
attr_accessor :primary_contact_phone
|
32
|
+
|
33
|
+
attr_accessor :primary_contact_email
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'id' => :'id',
|
39
|
+
:'tax_number' => :'tax_number',
|
40
|
+
:'business_name' => :'business_name',
|
41
|
+
:'name' => :'name',
|
42
|
+
:'address' => :'address',
|
43
|
+
:'primary_contact_name' => :'primary_contact_name',
|
44
|
+
:'primary_contact_phone' => :'primary_contact_phone',
|
45
|
+
:'primary_contact_email' => :'primary_contact_email'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns all the JSON keys this model knows about
|
50
|
+
def self.acceptable_attributes
|
51
|
+
attribute_map.values
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.openapi_types
|
56
|
+
{
|
57
|
+
:'id' => :'String',
|
58
|
+
:'tax_number' => :'String',
|
59
|
+
:'business_name' => :'String',
|
60
|
+
:'name' => :'String',
|
61
|
+
:'address' => :'Address',
|
62
|
+
:'primary_contact_name' => :'String',
|
63
|
+
:'primary_contact_phone' => :'String',
|
64
|
+
:'primary_contact_email' => :'String'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# List of attributes with nullable: true
|
69
|
+
def self.openapi_nullable
|
70
|
+
Set.new([
|
71
|
+
])
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
if (!attributes.is_a?(Hash))
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ForestVPNCloudAPI::PaymentProfile` initialize method"
|
79
|
+
end
|
80
|
+
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
83
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ForestVPNCloudAPI::PaymentProfile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
85
|
+
end
|
86
|
+
h[k.to_sym] = v
|
87
|
+
}
|
88
|
+
|
89
|
+
if attributes.key?(:'id')
|
90
|
+
self.id = attributes[:'id']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'tax_number')
|
94
|
+
self.tax_number = attributes[:'tax_number']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'business_name')
|
98
|
+
self.business_name = attributes[:'business_name']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'name')
|
102
|
+
self.name = attributes[:'name']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'address')
|
106
|
+
self.address = attributes[:'address']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'primary_contact_name')
|
110
|
+
self.primary_contact_name = attributes[:'primary_contact_name']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'primary_contact_phone')
|
114
|
+
self.primary_contact_phone = attributes[:'primary_contact_phone']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'primary_contact_email')
|
118
|
+
self.primary_contact_email = attributes[:'primary_contact_email']
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
123
|
+
# @return Array for valid properties with the reasons
|
124
|
+
def list_invalid_properties
|
125
|
+
invalid_properties = Array.new
|
126
|
+
if @business_name.nil?
|
127
|
+
invalid_properties.push('invalid value for "business_name", business_name cannot be nil.')
|
128
|
+
end
|
129
|
+
|
130
|
+
if @name.nil?
|
131
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
132
|
+
end
|
133
|
+
|
134
|
+
if @address.nil?
|
135
|
+
invalid_properties.push('invalid value for "address", address cannot be nil.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if @primary_contact_name.nil?
|
139
|
+
invalid_properties.push('invalid value for "primary_contact_name", primary_contact_name cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @primary_contact_phone.nil?
|
143
|
+
invalid_properties.push('invalid value for "primary_contact_phone", primary_contact_phone cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @primary_contact_email.nil?
|
147
|
+
invalid_properties.push('invalid value for "primary_contact_email", primary_contact_email cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
invalid_properties
|
151
|
+
end
|
152
|
+
|
153
|
+
# Check to see if the all the properties in the model are valid
|
154
|
+
# @return true if the model is valid
|
155
|
+
def valid?
|
156
|
+
return false if @business_name.nil?
|
157
|
+
return false if @name.nil?
|
158
|
+
return false if @address.nil?
|
159
|
+
return false if @primary_contact_name.nil?
|
160
|
+
return false if @primary_contact_phone.nil?
|
161
|
+
return false if @primary_contact_email.nil?
|
162
|
+
true
|
163
|
+
end
|
164
|
+
|
165
|
+
# Checks equality by comparing each attribute.
|
166
|
+
# @param [Object] Object to be compared
|
167
|
+
def ==(o)
|
168
|
+
return true if self.equal?(o)
|
169
|
+
self.class == o.class &&
|
170
|
+
id == o.id &&
|
171
|
+
tax_number == o.tax_number &&
|
172
|
+
business_name == o.business_name &&
|
173
|
+
name == o.name &&
|
174
|
+
address == o.address &&
|
175
|
+
primary_contact_name == o.primary_contact_name &&
|
176
|
+
primary_contact_phone == o.primary_contact_phone &&
|
177
|
+
primary_contact_email == o.primary_contact_email
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def eql?(o)
|
183
|
+
self == o
|
184
|
+
end
|
185
|
+
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Integer] Hash code
|
188
|
+
def hash
|
189
|
+
[id, tax_number, business_name, name, address, primary_contact_name, primary_contact_phone, primary_contact_email].hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def self.build_from_hash(attributes)
|
196
|
+
new.build_from_hash(attributes)
|
197
|
+
end
|
198
|
+
|
199
|
+
# Builds the object from hash
|
200
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
201
|
+
# @return [Object] Returns the model itself
|
202
|
+
def build_from_hash(attributes)
|
203
|
+
return nil unless attributes.is_a?(Hash)
|
204
|
+
attributes = attributes.transform_keys(&:to_sym)
|
205
|
+
self.class.openapi_types.each_pair do |key, type|
|
206
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
207
|
+
self.send("#{key}=", nil)
|
208
|
+
elsif type =~ /\AArray<(.*)>/i
|
209
|
+
# check to ensure the input is an array given that the attribute
|
210
|
+
# is documented as an array but the input is not
|
211
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
212
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
213
|
+
end
|
214
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
215
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
222
|
+
# Deserializes the data based on type
|
223
|
+
# @param string type Data type
|
224
|
+
# @param string value Value to be deserialized
|
225
|
+
# @return [Object] Deserialized data
|
226
|
+
def _deserialize(type, value)
|
227
|
+
case type.to_sym
|
228
|
+
when :Time
|
229
|
+
Time.parse(value)
|
230
|
+
when :Date
|
231
|
+
Date.parse(value)
|
232
|
+
when :String
|
233
|
+
value.to_s
|
234
|
+
when :Integer
|
235
|
+
value.to_i
|
236
|
+
when :Float
|
237
|
+
value.to_f
|
238
|
+
when :Boolean
|
239
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
240
|
+
true
|
241
|
+
else
|
242
|
+
false
|
243
|
+
end
|
244
|
+
when :Object
|
245
|
+
# generic object (usually a Hash), return directly
|
246
|
+
value
|
247
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
248
|
+
inner_type = Regexp.last_match[:inner_type]
|
249
|
+
value.map { |v| _deserialize(inner_type, v) }
|
250
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
251
|
+
k_type = Regexp.last_match[:k_type]
|
252
|
+
v_type = Regexp.last_match[:v_type]
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each do |k, v|
|
255
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
else # model
|
259
|
+
# models (e.g. Pet) or oneOf
|
260
|
+
klass = ForestVPNCloudAPI.const_get(type)
|
261
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the string representation of the object
|
266
|
+
# @return [String] String presentation of the object
|
267
|
+
def to_s
|
268
|
+
to_hash.to_s
|
269
|
+
end
|
270
|
+
|
271
|
+
# to_body is an alias to to_hash (backward compatibility)
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
273
|
+
def to_body
|
274
|
+
to_hash
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns the object in the form of hash
|
278
|
+
# @return [Hash] Returns the object in the form of hash
|
279
|
+
def to_hash
|
280
|
+
hash = {}
|
281
|
+
self.class.attribute_map.each_pair do |attr, param|
|
282
|
+
value = self.send(attr)
|
283
|
+
if value.nil?
|
284
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
285
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
286
|
+
end
|
287
|
+
|
288
|
+
hash[param] = _to_hash(value)
|
289
|
+
end
|
290
|
+
hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Outputs non-array value in the form of hash
|
294
|
+
# For object, use to_hash. Otherwise, just return the value
|
295
|
+
# @param [Object] value Any valid value
|
296
|
+
# @return [Hash] Returns the value in the form of hash
|
297
|
+
def _to_hash(value)
|
298
|
+
if value.is_a?(Array)
|
299
|
+
value.compact.map { |v| _to_hash(v) }
|
300
|
+
elsif value.is_a?(Hash)
|
301
|
+
{}.tap do |hash|
|
302
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
303
|
+
end
|
304
|
+
elsif value.respond_to? :to_hash
|
305
|
+
value.to_hash
|
306
|
+
else
|
307
|
+
value
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
@@ -0,0 +1,320 @@
|
|
1
|
+
=begin
|
2
|
+
#ForestVPN Cloud API
|
3
|
+
|
4
|
+
#ForestVPN Cloud - it's a Google Cloud but for VPN apps. Ready to use VPN Cloud Platform minimizes efforts to build fast, secure, and modern VPN apps.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0
|
7
|
+
Contact: support@forestvpn.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module ForestVPNCloudAPI
|
17
|
+
class Profile
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :external_key
|
21
|
+
|
22
|
+
attr_accessor :status
|
23
|
+
|
24
|
+
# A secret key that should be used along with ID in ForestVPN Cloud VPN SDK.
|
25
|
+
attr_accessor :secret_key
|
26
|
+
|
27
|
+
# Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.
|
28
|
+
attr_accessor :metadata
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'id' => :'id',
|
56
|
+
:'external_key' => :'external_key',
|
57
|
+
:'status' => :'status',
|
58
|
+
:'secret_key' => :'secret_key',
|
59
|
+
:'metadata' => :'metadata'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns all the JSON keys this model knows about
|
64
|
+
def self.acceptable_attributes
|
65
|
+
attribute_map.values
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'id' => :'String',
|
72
|
+
:'external_key' => :'String',
|
73
|
+
:'status' => :'String',
|
74
|
+
:'secret_key' => :'String',
|
75
|
+
:'metadata' => :'Hash<String, String>'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# List of attributes with nullable: true
|
80
|
+
def self.openapi_nullable
|
81
|
+
Set.new([
|
82
|
+
])
|
83
|
+
end
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
def initialize(attributes = {})
|
88
|
+
if (!attributes.is_a?(Hash))
|
89
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `ForestVPNCloudAPI::Profile` initialize method"
|
90
|
+
end
|
91
|
+
|
92
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
93
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
94
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
95
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `ForestVPNCloudAPI::Profile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
96
|
+
end
|
97
|
+
h[k.to_sym] = v
|
98
|
+
}
|
99
|
+
|
100
|
+
if attributes.key?(:'id')
|
101
|
+
self.id = attributes[:'id']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'external_key')
|
105
|
+
self.external_key = attributes[:'external_key']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'status')
|
109
|
+
self.status = attributes[:'status']
|
110
|
+
else
|
111
|
+
self.status = 'suspended'
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'secret_key')
|
115
|
+
self.secret_key = attributes[:'secret_key']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'metadata')
|
119
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
120
|
+
self.metadata = value
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
126
|
+
# @return Array for valid properties with the reasons
|
127
|
+
def list_invalid_properties
|
128
|
+
invalid_properties = Array.new
|
129
|
+
if @id.nil?
|
130
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
131
|
+
end
|
132
|
+
|
133
|
+
if @external_key.nil?
|
134
|
+
invalid_properties.push('invalid value for "external_key", external_key cannot be nil.')
|
135
|
+
end
|
136
|
+
|
137
|
+
if @status.nil?
|
138
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
139
|
+
end
|
140
|
+
|
141
|
+
if @secret_key.nil?
|
142
|
+
invalid_properties.push('invalid value for "secret_key", secret_key cannot be nil.')
|
143
|
+
end
|
144
|
+
|
145
|
+
if @metadata.nil?
|
146
|
+
invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
|
147
|
+
end
|
148
|
+
|
149
|
+
invalid_properties
|
150
|
+
end
|
151
|
+
|
152
|
+
# Check to see if the all the properties in the model are valid
|
153
|
+
# @return true if the model is valid
|
154
|
+
def valid?
|
155
|
+
return false if @id.nil?
|
156
|
+
return false if @external_key.nil?
|
157
|
+
return false if @status.nil?
|
158
|
+
status_validator = EnumAttributeValidator.new('String', ["active", "suspended"])
|
159
|
+
return false unless status_validator.valid?(@status)
|
160
|
+
return false if @secret_key.nil?
|
161
|
+
return false if @metadata.nil?
|
162
|
+
true
|
163
|
+
end
|
164
|
+
|
165
|
+
# Custom attribute writer method checking allowed values (enum).
|
166
|
+
# @param [Object] status Object to be assigned
|
167
|
+
def status=(status)
|
168
|
+
validator = EnumAttributeValidator.new('String', ["active", "suspended"])
|
169
|
+
unless validator.valid?(status)
|
170
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
171
|
+
end
|
172
|
+
@status = status
|
173
|
+
end
|
174
|
+
|
175
|
+
# Checks equality by comparing each attribute.
|
176
|
+
# @param [Object] Object to be compared
|
177
|
+
def ==(o)
|
178
|
+
return true if self.equal?(o)
|
179
|
+
self.class == o.class &&
|
180
|
+
id == o.id &&
|
181
|
+
external_key == o.external_key &&
|
182
|
+
status == o.status &&
|
183
|
+
secret_key == o.secret_key &&
|
184
|
+
metadata == o.metadata
|
185
|
+
end
|
186
|
+
|
187
|
+
# @see the `==` method
|
188
|
+
# @param [Object] Object to be compared
|
189
|
+
def eql?(o)
|
190
|
+
self == o
|
191
|
+
end
|
192
|
+
|
193
|
+
# Calculates hash code according to all attributes.
|
194
|
+
# @return [Integer] Hash code
|
195
|
+
def hash
|
196
|
+
[id, external_key, status, secret_key, metadata].hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Builds the object from hash
|
200
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
201
|
+
# @return [Object] Returns the model itself
|
202
|
+
def self.build_from_hash(attributes)
|
203
|
+
new.build_from_hash(attributes)
|
204
|
+
end
|
205
|
+
|
206
|
+
# Builds the object from hash
|
207
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
208
|
+
# @return [Object] Returns the model itself
|
209
|
+
def build_from_hash(attributes)
|
210
|
+
return nil unless attributes.is_a?(Hash)
|
211
|
+
attributes = attributes.transform_keys(&:to_sym)
|
212
|
+
self.class.openapi_types.each_pair do |key, type|
|
213
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
214
|
+
self.send("#{key}=", nil)
|
215
|
+
elsif type =~ /\AArray<(.*)>/i
|
216
|
+
# check to ensure the input is an array given that the attribute
|
217
|
+
# is documented as an array but the input is not
|
218
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
219
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
220
|
+
end
|
221
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
222
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
self
|
227
|
+
end
|
228
|
+
|
229
|
+
# Deserializes the data based on type
|
230
|
+
# @param string type Data type
|
231
|
+
# @param string value Value to be deserialized
|
232
|
+
# @return [Object] Deserialized data
|
233
|
+
def _deserialize(type, value)
|
234
|
+
case type.to_sym
|
235
|
+
when :Time
|
236
|
+
Time.parse(value)
|
237
|
+
when :Date
|
238
|
+
Date.parse(value)
|
239
|
+
when :String
|
240
|
+
value.to_s
|
241
|
+
when :Integer
|
242
|
+
value.to_i
|
243
|
+
when :Float
|
244
|
+
value.to_f
|
245
|
+
when :Boolean
|
246
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
247
|
+
true
|
248
|
+
else
|
249
|
+
false
|
250
|
+
end
|
251
|
+
when :Object
|
252
|
+
# generic object (usually a Hash), return directly
|
253
|
+
value
|
254
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
255
|
+
inner_type = Regexp.last_match[:inner_type]
|
256
|
+
value.map { |v| _deserialize(inner_type, v) }
|
257
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
258
|
+
k_type = Regexp.last_match[:k_type]
|
259
|
+
v_type = Regexp.last_match[:v_type]
|
260
|
+
{}.tap do |hash|
|
261
|
+
value.each do |k, v|
|
262
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
else # model
|
266
|
+
# models (e.g. Pet) or oneOf
|
267
|
+
klass = ForestVPNCloudAPI.const_get(type)
|
268
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns the string representation of the object
|
273
|
+
# @return [String] String presentation of the object
|
274
|
+
def to_s
|
275
|
+
to_hash.to_s
|
276
|
+
end
|
277
|
+
|
278
|
+
# to_body is an alias to to_hash (backward compatibility)
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
280
|
+
def to_body
|
281
|
+
to_hash
|
282
|
+
end
|
283
|
+
|
284
|
+
# Returns the object in the form of hash
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
286
|
+
def to_hash
|
287
|
+
hash = {}
|
288
|
+
self.class.attribute_map.each_pair do |attr, param|
|
289
|
+
value = self.send(attr)
|
290
|
+
if value.nil?
|
291
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
292
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
293
|
+
end
|
294
|
+
|
295
|
+
hash[param] = _to_hash(value)
|
296
|
+
end
|
297
|
+
hash
|
298
|
+
end
|
299
|
+
|
300
|
+
# Outputs non-array value in the form of hash
|
301
|
+
# For object, use to_hash. Otherwise, just return the value
|
302
|
+
# @param [Object] value Any valid value
|
303
|
+
# @return [Hash] Returns the value in the form of hash
|
304
|
+
def _to_hash(value)
|
305
|
+
if value.is_a?(Array)
|
306
|
+
value.compact.map { |v| _to_hash(v) }
|
307
|
+
elsif value.is_a?(Hash)
|
308
|
+
{}.tap do |hash|
|
309
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
310
|
+
end
|
311
|
+
elsif value.respond_to? :to_hash
|
312
|
+
value.to_hash
|
313
|
+
else
|
314
|
+
value
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
319
|
+
|
320
|
+
end
|