influxdb-client-apis 1.14.0 → 1.16.0.pre.2686

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/influxdb-client-apis.rb +7 -2
  3. data/lib/influxdb2/apis/generated/api/authorizations_api.rb +11 -15
  4. data/lib/influxdb2/apis/generated/api/buckets_api.rb +14 -12
  5. data/lib/influxdb2/apis/generated/api/labels_api.rb +2 -3
  6. data/lib/influxdb2/apis/generated/api/organizations_api.rb +20 -21
  7. data/lib/influxdb2/apis/generated/api/users_api.rb +116 -2568
  8. data/lib/influxdb2/apis/generated/api_client.rb +2 -3
  9. data/lib/influxdb2/apis/generated/api_error.rb +2 -3
  10. data/lib/influxdb2/apis/generated/configuration.rb +5 -6
  11. data/lib/influxdb2/apis/generated/models/authorization.rb +25 -7
  12. data/lib/influxdb2/apis/generated/models/authorization_all_of.rb +21 -7
  13. data/lib/influxdb2/apis/generated/models/authorization_all_of_links.rb +5 -6
  14. data/lib/influxdb2/apis/generated/models/authorization_post_request.rb +325 -0
  15. data/lib/influxdb2/apis/generated/models/authorization_update_request.rb +5 -6
  16. data/lib/influxdb2/apis/generated/models/authorizations.rb +5 -6
  17. data/lib/influxdb2/apis/generated/models/bucket.rb +14 -6
  18. data/lib/influxdb2/apis/generated/models/bucket_links.rb +5 -6
  19. data/lib/influxdb2/apis/generated/models/buckets.rb +5 -6
  20. data/lib/influxdb2/apis/generated/models/label.rb +5 -6
  21. data/lib/influxdb2/apis/generated/models/label_create_request.rb +5 -6
  22. data/lib/influxdb2/apis/generated/models/label_mapping.rb +5 -6
  23. data/lib/influxdb2/apis/generated/models/label_response.rb +5 -6
  24. data/lib/influxdb2/apis/generated/models/label_update.rb +5 -6
  25. data/lib/influxdb2/apis/generated/models/labels_response.rb +5 -6
  26. data/lib/influxdb2/apis/generated/models/links.rb +5 -6
  27. data/lib/influxdb2/apis/generated/models/organization.rb +5 -6
  28. data/lib/influxdb2/apis/generated/models/organization_links.rb +5 -6
  29. data/lib/influxdb2/apis/generated/models/organizations.rb +5 -6
  30. data/lib/influxdb2/apis/generated/models/password_reset_body.rb +214 -0
  31. data/lib/influxdb2/apis/generated/models/patch_organization_request.rb +220 -0
  32. data/lib/influxdb2/apis/generated/models/permission.rb +5 -6
  33. data/lib/influxdb2/apis/generated/models/post_bucket_request.rb +14 -6
  34. data/lib/influxdb2/apis/generated/models/post_organization_request.rb +223 -0
  35. data/lib/influxdb2/apis/generated/models/resource.rb +8 -9
  36. data/lib/influxdb2/apis/generated/models/resource_member.rb +7 -8
  37. data/lib/influxdb2/apis/generated/models/resource_member_all_of.rb +5 -6
  38. data/lib/influxdb2/apis/generated/models/resource_members.rb +6 -7
  39. data/lib/influxdb2/apis/generated/models/{user_links.rb → resource_members_links.rb} +8 -9
  40. data/lib/influxdb2/apis/generated/models/resource_owner.rb +7 -8
  41. data/lib/influxdb2/apis/generated/models/resource_owner_all_of.rb +5 -6
  42. data/lib/influxdb2/apis/generated/models/resource_owners.rb +6 -7
  43. data/lib/influxdb2/apis/generated/models/retention_rule.rb +5 -6
  44. data/lib/influxdb2/apis/generated/models/user.rb +6 -16
  45. data/lib/influxdb2/apis/generated/models/user_response.rb +287 -0
  46. data/lib/influxdb2/apis/generated/models/{users_links.rb → user_response_links.rb} +8 -9
  47. data/lib/influxdb2/apis/generated/models/users.rb +6 -7
  48. data/test/influxdb2/authorizations_api_test.rb +3 -3
  49. data/test/influxdb2/organizations_api_test.rb +3 -3
  50. metadata +13 -8
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -139,7 +138,7 @@ module InfluxDB2::API
139
138
 
140
139
  def initialize
141
140
  @scheme = 'https'
142
- @host = 'raw.githubusercontent.com:-1'
141
+ @host = 'raw.githubusercontent.com'
143
142
  @base_path = '/api/v2'
144
143
  @server_index = 0
145
144
  @server_operation_index = {}
@@ -237,13 +236,13 @@ module InfluxDB2::API
237
236
  {
238
237
  "HealthApi.get_health": [
239
238
  {
240
- url: "/",
239
+ url: "",
241
240
  description: "No description provided",
242
241
  }
243
242
  ],
244
243
  "ReadyApi.get_ready": [
245
244
  {
246
- url: "/",
245
+ url: "",
247
246
  description: "No description provided",
248
247
  }
249
248
  ],
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -29,7 +28,7 @@ module InfluxDB2::API
29
28
  attr_accessor :org_id
30
29
 
31
30
  # List of permissions for an auth. An auth must have at least one Permission.
32
- attr_accessor :permissions
31
+ attr_reader :permissions
33
32
 
34
33
  attr_accessor :id
35
34
 
@@ -69,7 +68,7 @@ module InfluxDB2::API
69
68
  end
70
69
  end
71
70
 
72
- # Attribute mapping from ruby-style variable name to JSON key
71
+ # Attribute mapping from ruby-style variable name to JSON key.
73
72
  def self.attribute_map
74
73
  {
75
74
  :'status' => :'status',
@@ -101,7 +100,7 @@ module InfluxDB2::API
101
100
  :'user_id' => :'String',
102
101
  :'user' => :'String',
103
102
  :'org' => :'String',
104
- :'links' => :'AuthorizationAllOfLinks',
103
+ :'links' => :'AuthorizationAllOfLinks'
105
104
  }
106
105
  end
107
106
 
@@ -199,6 +198,10 @@ module InfluxDB2::API
199
198
  invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
200
199
  end
201
200
 
201
+ if @permissions.length < 1
202
+ invalid_properties.push('invalid value for "permissions", number of items must be greater than or equal to 1.')
203
+ end
204
+
202
205
  invalid_properties
203
206
  end
204
207
 
@@ -209,6 +212,7 @@ module InfluxDB2::API
209
212
  return false unless status_validator.valid?(@status)
210
213
  return false if @org_id.nil?
211
214
  return false if @permissions.nil?
215
+ return false if @permissions.length < 1
212
216
  true
213
217
  end
214
218
 
@@ -222,6 +226,20 @@ module InfluxDB2::API
222
226
  @status = status
223
227
  end
224
228
 
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] permissions Value to be assigned
231
+ def permissions=(permissions)
232
+ if permissions.nil?
233
+ fail ArgumentError, 'permissions cannot be nil'
234
+ end
235
+
236
+ if permissions.length < 1
237
+ fail ArgumentError, 'invalid value for "permissions", number of items must be greater than or equal to 1.'
238
+ end
239
+
240
+ @permissions = permissions
241
+ end
242
+
225
243
  # Checks equality by comparing each attribute.
226
244
  # @param [Object] Object to be compared
227
245
  def ==(o)
@@ -250,7 +268,7 @@ module InfluxDB2::API
250
268
  # Calculates hash code according to all attributes.
251
269
  # @return [Integer] Hash code
252
270
  def hash
253
- [status, description, created_at, updated_at, org_id, permissions, id, token, user_id, user, org, links, ].hash
271
+ [status, description, created_at, updated_at, org_id, permissions, id, token, user_id, user, org, links].hash
254
272
  end
255
273
 
256
274
  # Builds the object from hash
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -23,7 +22,7 @@ module InfluxDB2::API
23
22
  attr_accessor :org_id
24
23
 
25
24
  # List of permissions for an auth. An auth must have at least one Permission.
26
- attr_accessor :permissions
25
+ attr_reader :permissions
27
26
 
28
27
  attr_accessor :id
29
28
 
@@ -41,7 +40,7 @@ module InfluxDB2::API
41
40
 
42
41
  attr_accessor :links
43
42
 
44
- # Attribute mapping from ruby-style variable name to JSON key
43
+ # Attribute mapping from ruby-style variable name to JSON key.
45
44
  def self.attribute_map
46
45
  {
47
46
  :'created_at' => :'createdAt',
@@ -69,7 +68,7 @@ module InfluxDB2::API
69
68
  :'user_id' => :'String',
70
69
  :'user' => :'String',
71
70
  :'org' => :'String',
72
- :'links' => :'AuthorizationAllOfLinks',
71
+ :'links' => :'AuthorizationAllOfLinks'
73
72
  }
74
73
  end
75
74
 
@@ -141,15 +140,30 @@ module InfluxDB2::API
141
140
  # @return Array for valid properties with the reasons
142
141
  def list_invalid_properties
143
142
  invalid_properties = Array.new
143
+ if !@permissions.nil? && @permissions.length < 1
144
+ invalid_properties.push('invalid value for "permissions", number of items must be greater than or equal to 1.')
145
+ end
146
+
144
147
  invalid_properties
145
148
  end
146
149
 
147
150
  # Check to see if the all the properties in the model are valid
148
151
  # @return true if the model is valid
149
152
  def valid?
153
+ return false if !@permissions.nil? && @permissions.length < 1
150
154
  true
151
155
  end
152
156
 
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] permissions Value to be assigned
159
+ def permissions=(permissions)
160
+ if !permissions.nil? && permissions.length < 1
161
+ fail ArgumentError, 'invalid value for "permissions", number of items must be greater than or equal to 1.'
162
+ end
163
+
164
+ @permissions = permissions
165
+ end
166
+
153
167
  # Checks equality by comparing each attribute.
154
168
  # @param [Object] Object to be compared
155
169
  def ==(o)
@@ -176,7 +190,7 @@ module InfluxDB2::API
176
190
  # Calculates hash code according to all attributes.
177
191
  # @return [Integer] Hash code
178
192
  def hash
179
- [created_at, updated_at, org_id, permissions, id, token, user_id, user, org, links, ].hash
193
+ [created_at, updated_at, org_id, permissions, id, token, user_id, user, org, links].hash
180
194
  end
181
195
 
182
196
  # Builds the object from hash
@@ -1,12 +1,11 @@
1
1
  =begin
2
- #Influx API Service
2
+ #Influx OSS API Service
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-beta3
10
9
 
11
10
  =end
12
11
 
@@ -21,7 +20,7 @@ module InfluxDB2::API
21
20
  # URI of resource.
22
21
  attr_accessor :user
23
22
 
24
- # Attribute mapping from ruby-style variable name to JSON key
23
+ # Attribute mapping from ruby-style variable name to JSON key.
25
24
  def self.attribute_map
26
25
  {
27
26
  :'_self' => :'self',
@@ -33,7 +32,7 @@ module InfluxDB2::API
33
32
  def self.openapi_types
34
33
  {
35
34
  :'_self' => :'String',
36
- :'user' => :'String',
35
+ :'user' => :'String'
37
36
  }
38
37
  end
39
38
 
@@ -98,7 +97,7 @@ module InfluxDB2::API
98
97
  # Calculates hash code according to all attributes.
99
98
  # @return [Integer] Hash code
100
99
  def hash
101
- [_self, user, ].hash
100
+ [_self, user].hash
102
101
  end
103
102
 
104
103
  # Builds the object from hash
@@ -0,0 +1,325 @@
1
+ =begin
2
+ #Influx OSS API Service
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module InfluxDB2::API
16
+ class AuthorizationPostRequest
17
+ # If inactive the token is inactive and requests using the token will be rejected.
18
+ attr_reader :status
19
+
20
+ # A description of the token.
21
+ attr_accessor :description
22
+
23
+ # ID of org that authorization is scoped to.
24
+ attr_accessor :org_id
25
+
26
+ # ID of user that authorization is scoped to.
27
+ attr_accessor :user_id
28
+
29
+ # List of permissions for an auth. An auth must have at least one Permission.
30
+ attr_reader :permissions
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'status' => :'status',
58
+ :'description' => :'description',
59
+ :'org_id' => :'orgID',
60
+ :'user_id' => :'userID',
61
+ :'permissions' => :'permissions',
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'status' => :'String',
69
+ :'description' => :'String',
70
+ :'org_id' => :'String',
71
+ :'user_id' => :'String',
72
+ :'permissions' => :'Array<Permission>'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # List of class defined in allOf (OpenAPI v3)
83
+ def self.openapi_all_of
84
+ [
85
+ :'AuthorizationPostRequestAllOf',
86
+ :'AuthorizationUpdateRequest'
87
+ ]
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::AuthorizationPostRequest` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::AuthorizationPostRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'status')
106
+ self.status = attributes[:'status']
107
+ else
108
+ self.status = 'active'
109
+ end
110
+
111
+ if attributes.key?(:'description')
112
+ self.description = attributes[:'description']
113
+ end
114
+
115
+ if attributes.key?(:'org_id')
116
+ self.org_id = attributes[:'org_id']
117
+ end
118
+
119
+ if attributes.key?(:'user_id')
120
+ self.user_id = attributes[:'user_id']
121
+ end
122
+
123
+ if attributes.key?(:'permissions')
124
+ if (value = attributes[:'permissions']).is_a?(Array)
125
+ self.permissions = value
126
+ end
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ if @org_id.nil?
135
+ invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
136
+ end
137
+
138
+ if @permissions.nil?
139
+ invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
140
+ end
141
+
142
+ if @permissions.length < 1
143
+ invalid_properties.push('invalid value for "permissions", number of items must be greater than or equal to 1.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ status_validator = EnumAttributeValidator.new('String', ["active", "inactive"])
153
+ return false unless status_validator.valid?(@status)
154
+ return false if @org_id.nil?
155
+ return false if @permissions.nil?
156
+ return false if @permissions.length < 1
157
+ true
158
+ end
159
+
160
+ # Custom attribute writer method checking allowed values (enum).
161
+ # @param [Object] status Object to be assigned
162
+ def status=(status)
163
+ validator = EnumAttributeValidator.new('String', ["active", "inactive"])
164
+ unless validator.valid?(status)
165
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
166
+ end
167
+ @status = status
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] permissions Value to be assigned
172
+ def permissions=(permissions)
173
+ if permissions.nil?
174
+ fail ArgumentError, 'permissions cannot be nil'
175
+ end
176
+
177
+ if permissions.length < 1
178
+ fail ArgumentError, 'invalid value for "permissions", number of items must be greater than or equal to 1.'
179
+ end
180
+
181
+ @permissions = permissions
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ status == o.status &&
190
+ description == o.description &&
191
+ org_id == o.org_id &&
192
+ user_id == o.user_id &&
193
+ permissions == o.permissions
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [status, description, org_id, user_id, permissions].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ self.class.openapi_types.each_pair do |key, type|
221
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
222
+ self.send("#{key}=", nil)
223
+ elsif type =~ /\AArray<(.*)>/i
224
+ # check to ensure the input is an array given that the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
227
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
228
+ end
229
+ elsif !attributes[self.class.attribute_map[key]].nil?
230
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
231
+ end
232
+ end
233
+
234
+ self
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def _deserialize(type, value)
242
+ case type.to_sym
243
+ when :Time
244
+ Time.parse(value)
245
+ when :Date
246
+ Date.parse(value)
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :Boolean
254
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else # model
274
+ InfluxDB2::API.const_get(type).build_from_hash(value)
275
+ end
276
+ end
277
+
278
+ # Returns the string representation of the object
279
+ # @return [String] String presentation of the object
280
+ def to_s
281
+ to_hash.to_s
282
+ end
283
+
284
+ # to_body is an alias to to_hash (backward compatibility)
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_body
287
+ to_hash
288
+ end
289
+
290
+ # Returns the object in the form of hash
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_hash
293
+ hash = {}
294
+ self.class.attribute_map.each_pair do |attr, param|
295
+ value = self.send(attr)
296
+ if value.nil?
297
+ is_nullable = self.class.openapi_nullable.include?(attr)
298
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
299
+ end
300
+
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+
324
+ end
325
+ end