influxdb-client-apis 1.15.0.pre.2407 → 1.16.0.pre.2765

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 +11 -6
@@ -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
 
@@ -39,7 +38,7 @@ module InfluxDB2::API
39
38
  end
40
39
  end
41
40
 
42
- # Attribute mapping from ruby-style variable name to JSON key
41
+ # Attribute mapping from ruby-style variable name to JSON key.
43
42
  def self.attribute_map
44
43
  {
45
44
  :'role' => :'role',
@@ -49,7 +48,7 @@ module InfluxDB2::API
49
48
  # Attribute type mapping.
50
49
  def self.openapi_types
51
50
  {
52
- :'role' => :'String',
51
+ :'role' => :'String'
53
52
  }
54
53
  end
55
54
 
@@ -123,7 +122,7 @@ module InfluxDB2::API
123
122
  # Calculates hash code according to all attributes.
124
123
  # @return [Integer] Hash code
125
124
  def hash
126
- [role, ].hash
125
+ [role].hash
127
126
  end
128
127
 
129
128
  # 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
 
@@ -19,7 +18,7 @@ module InfluxDB2::API
19
18
 
20
19
  attr_accessor :users
21
20
 
22
- # Attribute mapping from ruby-style variable name to JSON key
21
+ # Attribute mapping from ruby-style variable name to JSON key.
23
22
  def self.attribute_map
24
23
  {
25
24
  :'links' => :'links',
@@ -30,8 +29,8 @@ module InfluxDB2::API
30
29
  # Attribute type mapping.
31
30
  def self.openapi_types
32
31
  {
33
- :'links' => :'UsersLinks',
34
- :'users' => :'Array<ResourceMember>',
32
+ :'links' => :'ResourceMembersLinks',
33
+ :'users' => :'Array<ResourceMember>'
35
34
  }
36
35
  end
37
36
 
@@ -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
- [links, users, ].hash
100
+ [links, users].hash
102
101
  end
103
102
 
104
103
  # 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
 
@@ -14,10 +13,10 @@ require 'date'
14
13
  require 'time'
15
14
 
16
15
  module InfluxDB2::API
17
- class UserLinks
16
+ class ResourceMembersLinks
18
17
  attr_accessor :_self
19
18
 
20
- # Attribute mapping from ruby-style variable name to JSON key
19
+ # Attribute mapping from ruby-style variable name to JSON key.
21
20
  def self.attribute_map
22
21
  {
23
22
  :'_self' => :'self',
@@ -27,7 +26,7 @@ module InfluxDB2::API
27
26
  # Attribute type mapping.
28
27
  def self.openapi_types
29
28
  {
30
- :'_self' => :'String',
29
+ :'_self' => :'String'
31
30
  }
32
31
  end
33
32
 
@@ -41,13 +40,13 @@ module InfluxDB2::API
41
40
  # @param [Hash] attributes Model attributes in the form of hash
42
41
  def initialize(attributes = {})
43
42
  if (!attributes.is_a?(Hash))
44
- fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::UserLinks` initialize method"
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::ResourceMembersLinks` initialize method"
45
44
  end
46
45
 
47
46
  # check to see if the attribute exists and convert string to symbol for hash key
48
47
  attributes = attributes.each_with_object({}) { |(k, v), h|
49
48
  if (!self.class.attribute_map.key?(k.to_sym))
50
- fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::UserLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::ResourceMembersLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
50
  end
52
51
  h[k.to_sym] = v
53
52
  }
@@ -87,7 +86,7 @@ module InfluxDB2::API
87
86
  # Calculates hash code according to all attributes.
88
87
  # @return [Integer] Hash code
89
88
  def hash
90
- [_self, ].hash
89
+ [_self].hash
91
90
  end
92
91
 
93
92
  # 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
 
@@ -50,7 +49,7 @@ module InfluxDB2::API
50
49
  end
51
50
  end
52
51
 
53
- # Attribute mapping from ruby-style variable name to JSON key
52
+ # Attribute mapping from ruby-style variable name to JSON key.
54
53
  def self.attribute_map
55
54
  {
56
55
  :'id' => :'id',
@@ -69,8 +68,8 @@ module InfluxDB2::API
69
68
  :'oauth_id' => :'String',
70
69
  :'name' => :'String',
71
70
  :'status' => :'String',
72
- :'links' => :'UserLinks',
73
- :'role' => :'String',
71
+ :'links' => :'UserResponseLinks',
72
+ :'role' => :'String'
74
73
  }
75
74
  end
76
75
 
@@ -84,7 +83,7 @@ module InfluxDB2::API
84
83
  def self.openapi_all_of
85
84
  [
86
85
  :'ResourceOwnerAllOf',
87
- :'User'
86
+ :'UserResponse'
88
87
  ]
89
88
  end
90
89
 
@@ -196,7 +195,7 @@ module InfluxDB2::API
196
195
  # Calculates hash code according to all attributes.
197
196
  # @return [Integer] Hash code
198
197
  def hash
199
- [id, oauth_id, name, status, links, role, ].hash
198
+ [id, oauth_id, name, status, links, role].hash
200
199
  end
201
200
 
202
201
  # 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
 
@@ -39,7 +38,7 @@ module InfluxDB2::API
39
38
  end
40
39
  end
41
40
 
42
- # Attribute mapping from ruby-style variable name to JSON key
41
+ # Attribute mapping from ruby-style variable name to JSON key.
43
42
  def self.attribute_map
44
43
  {
45
44
  :'role' => :'role',
@@ -49,7 +48,7 @@ module InfluxDB2::API
49
48
  # Attribute type mapping.
50
49
  def self.openapi_types
51
50
  {
52
- :'role' => :'String',
51
+ :'role' => :'String'
53
52
  }
54
53
  end
55
54
 
@@ -123,7 +122,7 @@ module InfluxDB2::API
123
122
  # Calculates hash code according to all attributes.
124
123
  # @return [Integer] Hash code
125
124
  def hash
126
- [role, ].hash
125
+ [role].hash
127
126
  end
128
127
 
129
128
  # 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
 
@@ -19,7 +18,7 @@ module InfluxDB2::API
19
18
 
20
19
  attr_accessor :users
21
20
 
22
- # Attribute mapping from ruby-style variable name to JSON key
21
+ # Attribute mapping from ruby-style variable name to JSON key.
23
22
  def self.attribute_map
24
23
  {
25
24
  :'links' => :'links',
@@ -30,8 +29,8 @@ module InfluxDB2::API
30
29
  # Attribute type mapping.
31
30
  def self.openapi_types
32
31
  {
33
- :'links' => :'UsersLinks',
34
- :'users' => :'Array<ResourceOwner>',
32
+ :'links' => :'ResourceMembersLinks',
33
+ :'users' => :'Array<ResourceOwner>'
35
34
  }
36
35
  end
37
36
 
@@ -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
- [links, users, ].hash
100
+ [links, users].hash
102
101
  end
103
102
 
104
103
  # 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
 
@@ -45,7 +44,7 @@ module InfluxDB2::API
45
44
  end
46
45
  end
47
46
 
48
- # Attribute mapping from ruby-style variable name to JSON key
47
+ # Attribute mapping from ruby-style variable name to JSON key.
49
48
  def self.attribute_map
50
49
  {
51
50
  :'type' => :'type',
@@ -59,7 +58,7 @@ module InfluxDB2::API
59
58
  {
60
59
  :'type' => :'String',
61
60
  :'every_seconds' => :'Integer',
62
- :'shard_group_duration_seconds' => :'Integer',
61
+ :'shard_group_duration_seconds' => :'Integer'
63
62
  }
64
63
  end
65
64
 
@@ -172,7 +171,7 @@ module InfluxDB2::API
172
171
  # Calculates hash code according to all attributes.
173
172
  # @return [Integer] Hash code
174
173
  def hash
175
- [type, every_seconds, shard_group_duration_seconds, ].hash
174
+ [type, every_seconds, shard_group_duration_seconds].hash
176
175
  end
177
176
 
178
177
  # 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
 
@@ -24,8 +23,6 @@ module InfluxDB2::API
24
23
  # If inactive the user is inactive.
25
24
  attr_reader :status
26
25
 
27
- attr_accessor :links
28
-
29
26
  class EnumAttributeValidator
30
27
  attr_reader :datatype
31
28
  attr_reader :allowable_values
@@ -48,14 +45,13 @@ module InfluxDB2::API
48
45
  end
49
46
  end
50
47
 
51
- # Attribute mapping from ruby-style variable name to JSON key
48
+ # Attribute mapping from ruby-style variable name to JSON key.
52
49
  def self.attribute_map
53
50
  {
54
51
  :'id' => :'id',
55
52
  :'oauth_id' => :'oauthID',
56
53
  :'name' => :'name',
57
54
  :'status' => :'status',
58
- :'links' => :'links',
59
55
  }
60
56
  end
61
57
 
@@ -65,8 +61,7 @@ module InfluxDB2::API
65
61
  :'id' => :'String',
66
62
  :'oauth_id' => :'String',
67
63
  :'name' => :'String',
68
- :'status' => :'String',
69
- :'links' => :'UserLinks',
64
+ :'status' => :'String'
70
65
  }
71
66
  end
72
67
 
@@ -108,10 +103,6 @@ module InfluxDB2::API
108
103
  else
109
104
  self.status = 'active'
110
105
  end
111
-
112
- if attributes.key?(:'links')
113
- self.links = attributes[:'links']
114
- end
115
106
  end
116
107
 
117
108
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -152,8 +143,7 @@ module InfluxDB2::API
152
143
  id == o.id &&
153
144
  oauth_id == o.oauth_id &&
154
145
  name == o.name &&
155
- status == o.status &&
156
- links == o.links
146
+ status == o.status
157
147
  end
158
148
 
159
149
  # @see the `==` method
@@ -165,7 +155,7 @@ module InfluxDB2::API
165
155
  # Calculates hash code according to all attributes.
166
156
  # @return [Integer] Hash code
167
157
  def hash
168
- [id, oauth_id, name, status, links, ].hash
158
+ [id, oauth_id, name, status].hash
169
159
  end
170
160
 
171
161
  # Builds the object from hash
@@ -0,0 +1,287 @@
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 UserResponse
17
+ attr_accessor :id
18
+
19
+ attr_accessor :oauth_id
20
+
21
+ attr_accessor :name
22
+
23
+ # If inactive the user is inactive.
24
+ attr_reader :status
25
+
26
+ attr_accessor :links
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
+ :'oauth_id' => :'oauthID',
55
+ :'name' => :'name',
56
+ :'status' => :'status',
57
+ :'links' => :'links',
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'id' => :'String',
65
+ :'oauth_id' => :'String',
66
+ :'name' => :'String',
67
+ :'status' => :'String',
68
+ :'links' => :'UserResponseLinks'
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 `InfluxDB2::UserResponse` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::UserResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'id')
94
+ self.id = attributes[:'id']
95
+ end
96
+
97
+ if attributes.key?(:'oauth_id')
98
+ self.oauth_id = attributes[:'oauth_id']
99
+ end
100
+
101
+ if attributes.key?(:'name')
102
+ self.name = attributes[:'name']
103
+ end
104
+
105
+ if attributes.key?(:'status')
106
+ self.status = attributes[:'status']
107
+ else
108
+ self.status = 'active'
109
+ end
110
+
111
+ if attributes.key?(:'links')
112
+ self.links = attributes[:'links']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ if @name.nil?
121
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ return false if @name.nil?
131
+ status_validator = EnumAttributeValidator.new('String', ["active", "inactive"])
132
+ return false unless status_validator.valid?(@status)
133
+ true
134
+ end
135
+
136
+ # Custom attribute writer method checking allowed values (enum).
137
+ # @param [Object] status Object to be assigned
138
+ def status=(status)
139
+ validator = EnumAttributeValidator.new('String', ["active", "inactive"])
140
+ unless validator.valid?(status)
141
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
142
+ end
143
+ @status = status
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ id == o.id &&
152
+ oauth_id == o.oauth_id &&
153
+ name == o.name &&
154
+ status == o.status &&
155
+ links == o.links
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [id, oauth_id, name, status, links].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ new.build_from_hash(attributes)
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ self.class.openapi_types.each_pair do |key, type|
183
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
184
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ InfluxDB2::API.const_get(type).build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+
286
+ end
287
+ end