oci 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/models/create_virtual_circuit_public_prefix_details.rb +1 -1
  4. data/lib/oci/core/models/update_boot_volume_details.rb +18 -4
  5. data/lib/oci/core/models/update_volume_details.rb +18 -4
  6. data/lib/oci/core/models/virtual_circuit.rb +1 -1
  7. data/lib/oci/core/models/vnic.rb +1 -1
  8. data/lib/oci/core/models/volume_group.rb +18 -4
  9. data/lib/oci/database/database.rb +18 -0
  10. data/lib/oci/database/database_client.rb +1779 -427
  11. data/lib/oci/database/database_client_composite_operations.rb +316 -0
  12. data/lib/oci/database/models/autonomous_data_warehouse.rb +391 -0
  13. data/lib/oci/database/models/autonomous_data_warehouse_backup.rb +316 -0
  14. data/lib/oci/database/models/autonomous_data_warehouse_backup_summary.rb +316 -0
  15. data/lib/oci/database/models/autonomous_data_warehouse_connection_strings.rb +167 -0
  16. data/lib/oci/database/models/autonomous_data_warehouse_summary.rb +391 -0
  17. data/lib/oci/database/models/autonomous_database.rb +391 -0
  18. data/lib/oci/database/models/autonomous_database_backup.rb +316 -0
  19. data/lib/oci/database/models/autonomous_database_backup_summary.rb +316 -0
  20. data/lib/oci/database/models/autonomous_database_connection_strings.rb +167 -0
  21. data/lib/oci/database/models/autonomous_database_summary.rb +391 -0
  22. data/lib/oci/database/models/create_autonomous_data_warehouse_backup_details.rb +165 -0
  23. data/lib/oci/database/models/create_autonomous_data_warehouse_details.rb +287 -0
  24. data/lib/oci/database/models/create_autonomous_database_backup_details.rb +165 -0
  25. data/lib/oci/database/models/create_autonomous_database_details.rb +287 -0
  26. data/lib/oci/database/models/db_system.rb +1 -1
  27. data/lib/oci/database/models/db_system_summary.rb +1 -1
  28. data/lib/oci/database/models/launch_db_system_details.rb +1 -1
  29. data/lib/oci/database/models/launch_db_system_from_backup_details.rb +1 -1
  30. data/lib/oci/database/models/restore_autonomous_data_warehouse_details.rb +147 -0
  31. data/lib/oci/database/models/restore_autonomous_database_details.rb +147 -0
  32. data/lib/oci/database/models/update_autonomous_data_warehouse_details.rb +230 -0
  33. data/lib/oci/database/models/update_autonomous_database_details.rb +230 -0
  34. data/lib/oci/identity/identity.rb +1 -0
  35. data/lib/oci/identity/identity_client.rb +64 -1
  36. data/lib/oci/identity/models/availability_domain.rb +11 -1
  37. data/lib/oci/identity/models/fault_domain.rb +187 -0
  38. data/lib/oci/version.rb +1 -1
  39. metadata +21 -2
@@ -0,0 +1,287 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Details to create an Oracle Autonomous Database.
8
+ #
9
+ class Database::Models::CreateAutonomousDatabaseDetails # rubocop:disable Metrics/LineLength
10
+ LICENSE_MODEL_ENUM = [
11
+ LICENSE_MODEL_LICENSE_INCLUDED = 'LICENSE_INCLUDED'.freeze,
12
+ LICENSE_MODEL_BRING_YOUR_OWN_LICENSE = 'BRING_YOUR_OWN_LICENSE'.freeze
13
+ ].freeze
14
+
15
+ # **[Required]** A strong password for Admin. The password must be between 12 and 60 characters long, and must contain at least 1 uppercase, 1 lowercase and 2 numeric characters. It cannot contain the double quote symbol (\"). It must be different than the last 4 passwords.
16
+ # @return [String]
17
+ attr_accessor :admin_password
18
+
19
+ # **[Required]** The Oracle Cloud ID (OCID) of the compartment of the DB system.
20
+ # @return [String]
21
+ attr_accessor :compartment_id
22
+
23
+ # **[Required]** The number of CPU Cores to be made available to the database.
24
+ # @return [Integer]
25
+ attr_accessor :cpu_core_count
26
+
27
+ # **[Required]** Size, in terabytes, of the data volume that will be created and attached to the database. This storage can later be scaled up if needed.
28
+ #
29
+ # @return [Integer]
30
+ attr_accessor :data_storage_size_in_tbs
31
+
32
+ # **[Required]** The database name. The name must begin with an alphabetic character and can contain a maximum of 14 alphanumeric characters. Special characters are not permitted. The database name must be unique in the tenancy.
33
+ # @return [String]
34
+ attr_accessor :db_name
35
+
36
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
37
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
38
+ #
39
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
40
+ #
41
+ # @return [Hash<String, Hash<String, Object>>]
42
+ attr_accessor :defined_tags
43
+
44
+ # The user-friendly name for the Autonomous Database. The name does not have to be unique.
45
+ # @return [String]
46
+ attr_accessor :display_name
47
+
48
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
49
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
50
+ #
51
+ # Example: `{\"Department\": \"Finance\"}`
52
+ #
53
+ # @return [Hash<String, String>]
54
+ attr_accessor :freeform_tags
55
+
56
+ # The Oracle license model that applies to the Oracle Autonomous Database. The default is BRING_YOUR_OWN_LICENSE.
57
+ #
58
+ # @return [String]
59
+ attr_reader :license_model
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ # rubocop:disable Style/SymbolLiteral
65
+ 'admin_password': :'adminPassword',
66
+ 'compartment_id': :'compartmentId',
67
+ 'cpu_core_count': :'cpuCoreCount',
68
+ 'data_storage_size_in_tbs': :'dataStorageSizeInTBs',
69
+ 'db_name': :'dbName',
70
+ 'defined_tags': :'definedTags',
71
+ 'display_name': :'displayName',
72
+ 'freeform_tags': :'freeformTags',
73
+ 'license_model': :'licenseModel'
74
+ # rubocop:enable Style/SymbolLiteral
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.swagger_types
80
+ {
81
+ # rubocop:disable Style/SymbolLiteral
82
+ 'admin_password': :'String',
83
+ 'compartment_id': :'String',
84
+ 'cpu_core_count': :'Integer',
85
+ 'data_storage_size_in_tbs': :'Integer',
86
+ 'db_name': :'String',
87
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
88
+ 'display_name': :'String',
89
+ 'freeform_tags': :'Hash<String, String>',
90
+ 'license_model': :'String'
91
+ # rubocop:enable Style/SymbolLiteral
92
+ }
93
+ end
94
+
95
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
96
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
97
+
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @option attributes [String] :admin_password The value to assign to the {#admin_password} property
102
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
103
+ # @option attributes [Integer] :cpu_core_count The value to assign to the {#cpu_core_count} property
104
+ # @option attributes [Integer] :data_storage_size_in_tbs The value to assign to the {#data_storage_size_in_tbs} property
105
+ # @option attributes [String] :db_name The value to assign to the {#db_name} property
106
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
107
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
108
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
109
+ # @option attributes [String] :license_model The value to assign to the {#license_model} property
110
+ def initialize(attributes = {})
111
+ return unless attributes.is_a?(Hash)
112
+
113
+ # convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
115
+
116
+ self.admin_password = attributes[:'adminPassword'] if attributes[:'adminPassword']
117
+
118
+ raise 'You cannot provide both :adminPassword and :admin_password' if attributes.key?(:'adminPassword') && attributes.key?(:'admin_password')
119
+
120
+ self.admin_password = attributes[:'admin_password'] if attributes[:'admin_password']
121
+
122
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
123
+
124
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
125
+
126
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
127
+
128
+ self.cpu_core_count = attributes[:'cpuCoreCount'] if attributes[:'cpuCoreCount']
129
+
130
+ raise 'You cannot provide both :cpuCoreCount and :cpu_core_count' if attributes.key?(:'cpuCoreCount') && attributes.key?(:'cpu_core_count')
131
+
132
+ self.cpu_core_count = attributes[:'cpu_core_count'] if attributes[:'cpu_core_count']
133
+
134
+ self.data_storage_size_in_tbs = attributes[:'dataStorageSizeInTBs'] if attributes[:'dataStorageSizeInTBs']
135
+
136
+ raise 'You cannot provide both :dataStorageSizeInTBs and :data_storage_size_in_tbs' if attributes.key?(:'dataStorageSizeInTBs') && attributes.key?(:'data_storage_size_in_tbs')
137
+
138
+ self.data_storage_size_in_tbs = attributes[:'data_storage_size_in_tbs'] if attributes[:'data_storage_size_in_tbs']
139
+
140
+ self.db_name = attributes[:'dbName'] if attributes[:'dbName']
141
+
142
+ raise 'You cannot provide both :dbName and :db_name' if attributes.key?(:'dbName') && attributes.key?(:'db_name')
143
+
144
+ self.db_name = attributes[:'db_name'] if attributes[:'db_name']
145
+
146
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
147
+
148
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
149
+
150
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
151
+
152
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
153
+
154
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
155
+
156
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
157
+
158
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
159
+
160
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
161
+
162
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
163
+
164
+ self.license_model = attributes[:'licenseModel'] if attributes[:'licenseModel']
165
+
166
+ raise 'You cannot provide both :licenseModel and :license_model' if attributes.key?(:'licenseModel') && attributes.key?(:'license_model')
167
+
168
+ self.license_model = attributes[:'license_model'] if attributes[:'license_model']
169
+ end
170
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
171
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
172
+
173
+ # Custom attribute writer method checking allowed values (enum).
174
+ # @param [Object] license_model Object to be assigned
175
+ def license_model=(license_model)
176
+ # rubocop: disable Metrics/LineLength
177
+ raise "Invalid value for 'license_model': this must be one of the values in LICENSE_MODEL_ENUM." if license_model && !LICENSE_MODEL_ENUM.include?(license_model)
178
+ # rubocop: enable Metrics/LineLength
179
+ @license_model = license_model
180
+ end
181
+
182
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
183
+
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] other the other object to be compared
187
+ def ==(other)
188
+ return true if equal?(other)
189
+ self.class == other.class &&
190
+ admin_password == other.admin_password &&
191
+ compartment_id == other.compartment_id &&
192
+ cpu_core_count == other.cpu_core_count &&
193
+ data_storage_size_in_tbs == other.data_storage_size_in_tbs &&
194
+ db_name == other.db_name &&
195
+ defined_tags == other.defined_tags &&
196
+ display_name == other.display_name &&
197
+ freeform_tags == other.freeform_tags &&
198
+ license_model == other.license_model
199
+ end
200
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
201
+
202
+ # @see the `==` method
203
+ # @param [Object] other the other object to be compared
204
+ def eql?(other)
205
+ self == other
206
+ end
207
+
208
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
209
+
210
+
211
+ # Calculates hash code according to all attributes.
212
+ # @return [Fixnum] Hash code
213
+ def hash
214
+ [admin_password, compartment_id, cpu_core_count, data_storage_size_in_tbs, db_name, defined_tags, display_name, freeform_tags, license_model].hash
215
+ end
216
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
217
+
218
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
219
+
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.swagger_types.each_pair do |key, type|
227
+ if type =~ /^Array<(.*)>/i
228
+ # check to ensure the input is an array given that the the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ public_method("#{key}=").call(
232
+ attributes[self.class.attribute_map[key]]
233
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
234
+ )
235
+ end
236
+ elsif !attributes[self.class.attribute_map[key]].nil?
237
+ public_method("#{key}=").call(
238
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
239
+ )
240
+ end
241
+ # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
247
+
248
+ # Returns the string representation of the object
249
+ # @return [String] String presentation of the object
250
+ def to_s
251
+ to_hash.to_s
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = public_method(attr).call
260
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ private
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
+ end
286
+ end
287
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -136,7 +136,7 @@ module OCI
136
136
  # @return [String]
137
137
  attr_accessor :last_patch_history_entry_id
138
138
 
139
- # The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED.
139
+ # The Oracle license model that applies to all the databases on the DB System. The default is BRING_YOUR_OWN_LICENSE.
140
140
  #
141
141
  # @return [String]
142
142
  attr_reader :license_model
@@ -136,7 +136,7 @@ module OCI
136
136
  # @return [String]
137
137
  attr_accessor :last_patch_history_entry_id
138
138
 
139
- # The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED.
139
+ # The Oracle license model that applies to all the databases on the DB System. The default is BRING_YOUR_OWN_LICENSE.
140
140
  #
141
141
  # @return [String]
142
142
  attr_reader :license_model
@@ -41,7 +41,7 @@ module OCI
41
41
  # @return [String]
42
42
  attr_reader :disk_redundancy
43
43
 
44
- # The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED.
44
+ # The Oracle license model that applies to all the databases on the DB System. The default is BRING_YOUR_OWN_LICENSE.
45
45
  #
46
46
  # @return [String]
47
47
  attr_reader :license_model
@@ -41,7 +41,7 @@ module OCI
41
41
  # @return [String]
42
42
  attr_reader :disk_redundancy
43
43
 
44
- # The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED.
44
+ # The Oracle license model that applies to all the databases on the DB System. The default is BRING_YOUR_OWN_LICENSE.
45
45
  #
46
46
  # @return [String]
47
47
  attr_reader :license_model
@@ -0,0 +1,147 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Details to restore an Oracle Autonomous Data Warehouse.
8
+ #
9
+ class Database::Models::RestoreAutonomousDataWarehouseDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The time to restore the database to.
11
+ # @return [DateTime]
12
+ attr_accessor :timestamp
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'timestamp': :'timestamp'
19
+ # rubocop:enable Style/SymbolLiteral
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'timestamp': :'DateTime'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
33
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
34
+
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
46
+ end
47
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
48
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
49
+
50
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
51
+
52
+
53
+ # Checks equality by comparing each attribute.
54
+ # @param [Object] other the other object to be compared
55
+ def ==(other)
56
+ return true if equal?(other)
57
+ self.class == other.class &&
58
+ timestamp == other.timestamp
59
+ end
60
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
61
+
62
+ # @see the `==` method
63
+ # @param [Object] other the other object to be compared
64
+ def eql?(other)
65
+ self == other
66
+ end
67
+
68
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
69
+
70
+
71
+ # Calculates hash code according to all attributes.
72
+ # @return [Fixnum] Hash code
73
+ def hash
74
+ [timestamp].hash
75
+ end
76
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
77
+
78
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
79
+
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /^Array<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ public_method("#{key}=").call(
92
+ attributes[self.class.attribute_map[key]]
93
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
94
+ )
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ public_method("#{key}=").call(
98
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
99
+ )
100
+ end
101
+ # or else data not found in attributes(hash), not an issue as the data can be optional
102
+ end
103
+
104
+ self
105
+ end
106
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
107
+
108
+ # Returns the string representation of the object
109
+ # @return [String] String presentation of the object
110
+ def to_s
111
+ to_hash.to_s
112
+ end
113
+
114
+ # Returns the object in the form of hash
115
+ # @return [Hash] Returns the object in the form of hash
116
+ def to_hash
117
+ hash = {}
118
+ self.class.attribute_map.each_pair do |attr, param|
119
+ value = public_method(attr).call
120
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
121
+ hash[param] = _to_hash(value)
122
+ end
123
+ hash
124
+ end
125
+
126
+ private
127
+
128
+ # Outputs non-array value in the form of hash
129
+ # For object, use to_hash. Otherwise, just return the value
130
+ # @param [Object] value Any valid value
131
+ # @return [Hash] Returns the value in the form of hash
132
+ def _to_hash(value)
133
+ if value.is_a?(Array)
134
+ value.compact.map { |v| _to_hash(v) }
135
+ elsif value.is_a?(Hash)
136
+ {}.tap do |hash|
137
+ value.each { |k, v| hash[k] = _to_hash(v) }
138
+ end
139
+ elsif value.respond_to? :to_hash
140
+ value.to_hash
141
+ else
142
+ value
143
+ end
144
+ end
145
+ end
146
+ end
147
+ # rubocop:enable Lint/UnneededCopDisableDirective