influxdb-client-apis 1.15.0.pre.2461 → 1.16.0.pre.2890
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/influxdb-client-apis.rb +7 -2
- data/lib/influxdb2/apis/generated/api/authorizations_api.rb +11 -14
- data/lib/influxdb2/apis/generated/api/buckets_api.rb +14 -11
- data/lib/influxdb2/apis/generated/api/labels_api.rb +2 -2
- data/lib/influxdb2/apis/generated/api/organizations_api.rb +20 -20
- data/lib/influxdb2/apis/generated/api/users_api.rb +116 -2567
- data/lib/influxdb2/apis/generated/api_client.rb +2 -2
- data/lib/influxdb2/apis/generated/api_error.rb +2 -2
- data/lib/influxdb2/apis/generated/configuration.rb +4 -4
- data/lib/influxdb2/apis/generated/models/authorization.rb +3 -2
- data/lib/influxdb2/apis/generated/models/authorization_all_of.rb +3 -2
- data/lib/influxdb2/apis/generated/models/authorization_all_of_links.rb +3 -2
- data/lib/influxdb2/apis/generated/models/authorization_post_request.rb +326 -0
- data/lib/influxdb2/apis/generated/models/authorization_update_request.rb +3 -2
- data/lib/influxdb2/apis/generated/models/authorizations.rb +3 -2
- data/lib/influxdb2/apis/generated/models/bucket.rb +13 -3
- data/lib/influxdb2/apis/generated/models/bucket_links.rb +3 -2
- data/lib/influxdb2/apis/generated/models/buckets.rb +3 -2
- data/lib/influxdb2/apis/generated/models/label.rb +3 -2
- data/lib/influxdb2/apis/generated/models/label_create_request.rb +3 -2
- data/lib/influxdb2/apis/generated/models/label_mapping.rb +3 -2
- data/lib/influxdb2/apis/generated/models/label_response.rb +3 -2
- data/lib/influxdb2/apis/generated/models/label_update.rb +3 -2
- data/lib/influxdb2/apis/generated/models/labels_response.rb +3 -2
- data/lib/influxdb2/apis/generated/models/links.rb +3 -2
- data/lib/influxdb2/apis/generated/models/organization.rb +3 -2
- data/lib/influxdb2/apis/generated/models/organization_links.rb +3 -2
- data/lib/influxdb2/apis/generated/models/organizations.rb +3 -2
- data/lib/influxdb2/apis/generated/models/password_reset_body.rb +215 -0
- data/lib/influxdb2/apis/generated/models/patch_organization_request.rb +221 -0
- data/lib/influxdb2/apis/generated/models/permission.rb +3 -2
- data/lib/influxdb2/apis/generated/models/post_bucket_request.rb +15 -5
- data/lib/influxdb2/apis/generated/models/post_organization_request.rb +224 -0
- data/lib/influxdb2/apis/generated/models/resource.rb +5 -4
- data/lib/influxdb2/apis/generated/models/resource_member.rb +5 -4
- data/lib/influxdb2/apis/generated/models/resource_member_all_of.rb +3 -2
- data/lib/influxdb2/apis/generated/models/resource_members.rb +4 -3
- data/lib/influxdb2/apis/generated/models/{users_links.rb → resource_members_links.rb} +6 -5
- data/lib/influxdb2/apis/generated/models/resource_owner.rb +5 -4
- data/lib/influxdb2/apis/generated/models/resource_owner_all_of.rb +3 -2
- data/lib/influxdb2/apis/generated/models/resource_owners.rb +4 -3
- data/lib/influxdb2/apis/generated/models/retention_rule.rb +3 -2
- data/lib/influxdb2/apis/generated/models/user.rb +6 -14
- data/lib/influxdb2/apis/generated/models/user_response.rb +288 -0
- data/lib/influxdb2/apis/generated/models/{user_links.rb → user_response_links.rb} +6 -5
- data/lib/influxdb2/apis/generated/models/users.rb +5 -4
- data/test/influxdb2/authorizations_api_test.rb +3 -3
- data/test/influxdb2/organizations_api_test.rb +3 -3
- metadata +11 -6
@@ -0,0 +1,221 @@
|
|
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 'set'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module InfluxDB2::API
|
17
|
+
class PatchOrganizationRequest
|
18
|
+
# New name to set on the organization
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# New description to set on the organization
|
22
|
+
attr_accessor :description
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'name' => :'name',
|
28
|
+
:'description' => :'description',
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'name' => :'String',
|
36
|
+
:'description' => :'String'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::PatchOrganizationRequest` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::PatchOrganizationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'name')
|
62
|
+
self.name = attributes[:'name']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'description')
|
66
|
+
self.description = attributes[:'description']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
name == o.name &&
|
89
|
+
description == o.description
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Integer] Hash code
|
100
|
+
def hash
|
101
|
+
[name, description].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def self.build_from_hash(attributes)
|
108
|
+
new.build_from_hash(attributes)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def build_from_hash(attributes)
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
116
|
+
self.class.openapi_types.each_pair do |key, type|
|
117
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
118
|
+
self.send("#{key}=", nil)
|
119
|
+
elsif type =~ /\AArray<(.*)>/i
|
120
|
+
# check to ensure the input is an array given that the attribute
|
121
|
+
# is documented as an array but the input is not
|
122
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
123
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
124
|
+
end
|
125
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# Deserializes the data based on type
|
134
|
+
# @param string type Data type
|
135
|
+
# @param string value Value to be deserialized
|
136
|
+
# @return [Object] Deserialized data
|
137
|
+
def _deserialize(type, value)
|
138
|
+
case type.to_sym
|
139
|
+
when :Time
|
140
|
+
Time.parse(value)
|
141
|
+
when :Date
|
142
|
+
Date.parse(value)
|
143
|
+
when :String
|
144
|
+
value.to_s
|
145
|
+
when :Integer
|
146
|
+
value.to_i
|
147
|
+
when :Float
|
148
|
+
value.to_f
|
149
|
+
when :Boolean
|
150
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
151
|
+
true
|
152
|
+
else
|
153
|
+
false
|
154
|
+
end
|
155
|
+
when :Object
|
156
|
+
# generic object (usually a Hash), return directly
|
157
|
+
value
|
158
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
+
inner_type = Regexp.last_match[:inner_type]
|
160
|
+
value.map { |v| _deserialize(inner_type, v) }
|
161
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
+
k_type = Regexp.last_match[:k_type]
|
163
|
+
v_type = Regexp.last_match[:v_type]
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each do |k, v|
|
166
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
else # model
|
170
|
+
InfluxDB2::API.const_get(type).build_from_hash(value)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the string representation of the object
|
175
|
+
# @return [String] String presentation of the object
|
176
|
+
def to_s
|
177
|
+
to_hash.to_s
|
178
|
+
end
|
179
|
+
|
180
|
+
# to_body is an alias to to_hash (backward compatibility)
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_body
|
183
|
+
to_hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the object in the form of hash
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_hash
|
189
|
+
hash = {}
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
191
|
+
value = self.send(attr)
|
192
|
+
if value.nil?
|
193
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
194
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
195
|
+
end
|
196
|
+
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|
@@ -1,15 +1,16 @@
|
|
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.
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'date'
|
13
|
+
require 'set'
|
13
14
|
require 'time'
|
14
15
|
|
15
16
|
module InfluxDB2::API
|
@@ -1,15 +1,16 @@
|
|
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.
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'date'
|
13
|
+
require 'set'
|
13
14
|
require 'time'
|
14
15
|
|
15
16
|
module InfluxDB2::API
|
@@ -25,6 +26,8 @@ module InfluxDB2::API
|
|
25
26
|
# Rules to expire or retain data. No rules means data never expires.
|
26
27
|
attr_accessor :retention_rules
|
27
28
|
|
29
|
+
attr_accessor :schema_type
|
30
|
+
|
28
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
29
32
|
def self.attribute_map
|
30
33
|
{
|
@@ -33,6 +36,7 @@ module InfluxDB2::API
|
|
33
36
|
:'description' => :'description',
|
34
37
|
:'rp' => :'rp',
|
35
38
|
:'retention_rules' => :'retentionRules',
|
39
|
+
:'schema_type' => :'schemaType',
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
@@ -43,7 +47,8 @@ module InfluxDB2::API
|
|
43
47
|
:'name' => :'String',
|
44
48
|
:'description' => :'String',
|
45
49
|
:'rp' => :'String',
|
46
|
-
:'retention_rules' => :'Array<RetentionRule>'
|
50
|
+
:'retention_rules' => :'Array<RetentionRule>',
|
51
|
+
:'schema_type' => :'SchemaType'
|
47
52
|
}
|
48
53
|
end
|
49
54
|
|
@@ -89,6 +94,10 @@ module InfluxDB2::API
|
|
89
94
|
self.retention_rules = value
|
90
95
|
end
|
91
96
|
end
|
97
|
+
|
98
|
+
if attributes.key?(:'schema_type')
|
99
|
+
self.schema_type = attributes[:'schema_type']
|
100
|
+
end
|
92
101
|
end
|
93
102
|
|
94
103
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -128,7 +137,8 @@ module InfluxDB2::API
|
|
128
137
|
name == o.name &&
|
129
138
|
description == o.description &&
|
130
139
|
rp == o.rp &&
|
131
|
-
retention_rules == o.retention_rules
|
140
|
+
retention_rules == o.retention_rules &&
|
141
|
+
schema_type == o.schema_type
|
132
142
|
end
|
133
143
|
|
134
144
|
# @see the `==` method
|
@@ -140,7 +150,7 @@ module InfluxDB2::API
|
|
140
150
|
# Calculates hash code according to all attributes.
|
141
151
|
# @return [Integer] Hash code
|
142
152
|
def hash
|
143
|
-
[org_id, name, description, rp, retention_rules].hash
|
153
|
+
[org_id, name, description, rp, retention_rules, schema_type].hash
|
144
154
|
end
|
145
155
|
|
146
156
|
# Builds the object from hash
|
@@ -0,0 +1,224 @@
|
|
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 'set'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module InfluxDB2::API
|
17
|
+
class PostOrganizationRequest
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :description
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'name' => :'name',
|
26
|
+
:'description' => :'description',
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'name' => :'String',
|
34
|
+
:'description' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
])
|
42
|
+
end
|
43
|
+
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
+
def initialize(attributes = {})
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::PostOrganizationRequest` initialize method"
|
49
|
+
end
|
50
|
+
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::PostOrganizationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
58
|
+
|
59
|
+
if attributes.key?(:'name')
|
60
|
+
self.name = attributes[:'name']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.key?(:'description')
|
64
|
+
self.description = attributes[:'description']
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
if @name.nil?
|
73
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
74
|
+
end
|
75
|
+
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
return false if @name.nil?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
name == o.name &&
|
92
|
+
description == o.description
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[name, description].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
+
self.send("#{key}=", nil)
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
InfluxDB2::API.const_get(type).build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
if value.nil?
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
198
|
+
end
|
199
|
+
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|