forestvpn_cloud_api 0.1.0

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