oci 2.3.7 → 2.3.8

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/blockstorage_client.rb +56 -24
  4. data/lib/oci/core/compute_client.rb +578 -24
  5. data/lib/oci/core/core.rb +11 -0
  6. data/lib/oci/core/models/app_catalog_listing.rb +242 -0
  7. data/lib/oci/core/models/app_catalog_listing_resource_version.rb +295 -0
  8. data/lib/oci/core/models/app_catalog_listing_resource_version_agreements.rb +219 -0
  9. data/lib/oci/core/models/app_catalog_listing_resource_version_summary.rb +194 -0
  10. data/lib/oci/core/models/app_catalog_listing_summary.rb +188 -0
  11. data/lib/oci/core/models/app_catalog_subscription.rb +246 -0
  12. data/lib/oci/core/models/app_catalog_subscription_summary.rb +246 -0
  13. data/lib/oci/core/models/create_app_catalog_subscription_details.rb +232 -0
  14. data/lib/oci/core/models/create_nat_gateway_details.rb +239 -0
  15. data/lib/oci/core/models/launch_instance_details.rb +4 -0
  16. data/lib/oci/core/models/nat_gateway.rb +333 -0
  17. data/lib/oci/core/models/public_ip.rb +76 -13
  18. data/lib/oci/core/models/service_gateway.rb +9 -4
  19. data/lib/oci/core/models/update_nat_gateway_details.rb +208 -0
  20. data/lib/oci/core/models/update_service_gateway_details.rb +9 -4
  21. data/lib/oci/core/virtual_network_client.rb +546 -91
  22. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  23. data/lib/oci/object_storage/models/bucket.rb +18 -4
  24. data/lib/oci/object_storage/models/copy_object_details.rb +269 -0
  25. data/lib/oci/object_storage/models/multipart_upload.rb +1 -1
  26. data/lib/oci/object_storage/models/namespace_metadata.rb +1 -1
  27. data/lib/oci/object_storage/models/object_lifecycle_policy.rb +167 -0
  28. data/lib/oci/object_storage/models/object_lifecycle_rule.rb +245 -0
  29. data/lib/oci/object_storage/models/object_name_filter.rb +153 -0
  30. data/lib/oci/object_storage/models/preauthenticated_request.rb +1 -1
  31. data/lib/oci/object_storage/models/put_object_lifecycle_policy_details.rb +147 -0
  32. data/lib/oci/object_storage/models/restore_objects_details.rb +2 -2
  33. data/lib/oci/object_storage/models/work_request.rb +304 -0
  34. data/lib/oci/object_storage/models/work_request_error.rb +168 -0
  35. data/lib/oci/object_storage/models/work_request_log_entry.rb +156 -0
  36. data/lib/oci/object_storage/models/work_request_resource.rb +225 -0
  37. data/lib/oci/object_storage/models/work_request_resource_metadata_key.rb +12 -0
  38. data/lib/oci/object_storage/models/work_request_summary.rb +304 -0
  39. data/lib/oci/object_storage/object_storage.rb +12 -0
  40. data/lib/oci/object_storage/object_storage_client.rb +542 -17
  41. data/lib/oci/object_storage/object_storage_client_composite_operations.rb +53 -0
  42. data/lib/oci/version.rb +1 -1
  43. metadata +24 -2
@@ -0,0 +1,246 @@
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
+ # a subscription for a listing resource version.
8
+ class Core::Models::AppCatalogSubscription # rubocop:disable Metrics/LineLength
9
+ # Name of the publisher who published this listing.
10
+ # @return [String]
11
+ attr_accessor :publisher_name
12
+
13
+ # The ocid of the listing resource.
14
+ # @return [String]
15
+ attr_accessor :listing_id
16
+
17
+ # Listing resource version.
18
+ # @return [String]
19
+ attr_accessor :listing_resource_version
20
+
21
+ # Listing resource id.
22
+ # @return [String]
23
+ attr_accessor :listing_resource_id
24
+
25
+ # The display name of the listing.
26
+ # @return [String]
27
+ attr_accessor :display_name
28
+
29
+ # The short summary to the listing.
30
+ # @return [String]
31
+ attr_accessor :summary
32
+
33
+ # The compartmentID of the subscription.
34
+ # @return [String]
35
+ attr_accessor :compartment_id
36
+
37
+ # Date and time at which the subscription was created, in RFC3339 format.
38
+ # Example: `2018-03-20T12:32:53.532Z`
39
+ #
40
+ # @return [DateTime]
41
+ attr_accessor :time_created
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ # rubocop:disable Style/SymbolLiteral
47
+ 'publisher_name': :'publisherName',
48
+ 'listing_id': :'listingId',
49
+ 'listing_resource_version': :'listingResourceVersion',
50
+ 'listing_resource_id': :'listingResourceId',
51
+ 'display_name': :'displayName',
52
+ 'summary': :'summary',
53
+ 'compartment_id': :'compartmentId',
54
+ 'time_created': :'timeCreated'
55
+ # rubocop:enable Style/SymbolLiteral
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ # rubocop:disable Style/SymbolLiteral
63
+ 'publisher_name': :'String',
64
+ 'listing_id': :'String',
65
+ 'listing_resource_version': :'String',
66
+ 'listing_resource_id': :'String',
67
+ 'display_name': :'String',
68
+ 'summary': :'String',
69
+ 'compartment_id': :'String',
70
+ 'time_created': :'DateTime'
71
+ # rubocop:enable Style/SymbolLiteral
72
+ }
73
+ end
74
+
75
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
76
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
77
+
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @option attributes [String] :publisher_name The value to assign to the {#publisher_name} property
82
+ # @option attributes [String] :listing_id The value to assign to the {#listing_id} property
83
+ # @option attributes [String] :listing_resource_version The value to assign to the {#listing_resource_version} property
84
+ # @option attributes [String] :listing_resource_id The value to assign to the {#listing_resource_id} property
85
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
86
+ # @option attributes [String] :summary The value to assign to the {#summary} property
87
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
88
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
89
+ def initialize(attributes = {})
90
+ return unless attributes.is_a?(Hash)
91
+
92
+ # convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
94
+
95
+ self.publisher_name = attributes[:'publisherName'] if attributes[:'publisherName']
96
+
97
+ raise 'You cannot provide both :publisherName and :publisher_name' if attributes.key?(:'publisherName') && attributes.key?(:'publisher_name')
98
+
99
+ self.publisher_name = attributes[:'publisher_name'] if attributes[:'publisher_name']
100
+
101
+ self.listing_id = attributes[:'listingId'] if attributes[:'listingId']
102
+
103
+ raise 'You cannot provide both :listingId and :listing_id' if attributes.key?(:'listingId') && attributes.key?(:'listing_id')
104
+
105
+ self.listing_id = attributes[:'listing_id'] if attributes[:'listing_id']
106
+
107
+ self.listing_resource_version = attributes[:'listingResourceVersion'] if attributes[:'listingResourceVersion']
108
+
109
+ raise 'You cannot provide both :listingResourceVersion and :listing_resource_version' if attributes.key?(:'listingResourceVersion') && attributes.key?(:'listing_resource_version')
110
+
111
+ self.listing_resource_version = attributes[:'listing_resource_version'] if attributes[:'listing_resource_version']
112
+
113
+ self.listing_resource_id = attributes[:'listingResourceId'] if attributes[:'listingResourceId']
114
+
115
+ raise 'You cannot provide both :listingResourceId and :listing_resource_id' if attributes.key?(:'listingResourceId') && attributes.key?(:'listing_resource_id')
116
+
117
+ self.listing_resource_id = attributes[:'listing_resource_id'] if attributes[:'listing_resource_id']
118
+
119
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
120
+
121
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
122
+
123
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
124
+
125
+ self.summary = attributes[:'summary'] if attributes[:'summary']
126
+
127
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
128
+
129
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
130
+
131
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
132
+
133
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
134
+
135
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
136
+
137
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
138
+ end
139
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
140
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
141
+
142
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
143
+
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] other the other object to be compared
147
+ def ==(other)
148
+ return true if equal?(other)
149
+ self.class == other.class &&
150
+ publisher_name == other.publisher_name &&
151
+ listing_id == other.listing_id &&
152
+ listing_resource_version == other.listing_resource_version &&
153
+ listing_resource_id == other.listing_resource_id &&
154
+ display_name == other.display_name &&
155
+ summary == other.summary &&
156
+ compartment_id == other.compartment_id &&
157
+ time_created == other.time_created
158
+ end
159
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
160
+
161
+ # @see the `==` method
162
+ # @param [Object] other the other object to be compared
163
+ def eql?(other)
164
+ self == other
165
+ end
166
+
167
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
168
+
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Fixnum] Hash code
172
+ def hash
173
+ [publisher_name, listing_id, listing_resource_version, listing_resource_id, display_name, summary, compartment_id, time_created].hash
174
+ end
175
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
176
+
177
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
178
+
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.swagger_types.each_pair do |key, type|
186
+ if type =~ /^Array<(.*)>/i
187
+ # check to ensure the input is an array given that the the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ public_method("#{key}=").call(
191
+ attributes[self.class.attribute_map[key]]
192
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
193
+ )
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ public_method("#{key}=").call(
197
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
198
+ )
199
+ end
200
+ # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = public_method(attr).call
219
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ private
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+ end
245
+ end
246
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,246 @@
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
+ # a subscription summary for a listing resource version.
8
+ class Core::Models::AppCatalogSubscriptionSummary # rubocop:disable Metrics/LineLength
9
+ # Name of the publisher who published this listing.
10
+ # @return [String]
11
+ attr_accessor :publisher_name
12
+
13
+ # The ocid of the listing resource.
14
+ # @return [String]
15
+ attr_accessor :listing_id
16
+
17
+ # Listing resource version.
18
+ # @return [String]
19
+ attr_accessor :listing_resource_version
20
+
21
+ # Listing resource id.
22
+ # @return [String]
23
+ attr_accessor :listing_resource_id
24
+
25
+ # The display name of the listing.
26
+ # @return [String]
27
+ attr_accessor :display_name
28
+
29
+ # The short summary to the listing.
30
+ # @return [String]
31
+ attr_accessor :summary
32
+
33
+ # The compartmentID of the subscription.
34
+ # @return [String]
35
+ attr_accessor :compartment_id
36
+
37
+ # Date and time at which the subscription was created, in RFC3339 format.
38
+ # Example: `2018-03-20T12:32:53.532Z`
39
+ #
40
+ # @return [DateTime]
41
+ attr_accessor :time_created
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ # rubocop:disable Style/SymbolLiteral
47
+ 'publisher_name': :'publisherName',
48
+ 'listing_id': :'listingId',
49
+ 'listing_resource_version': :'listingResourceVersion',
50
+ 'listing_resource_id': :'listingResourceId',
51
+ 'display_name': :'displayName',
52
+ 'summary': :'summary',
53
+ 'compartment_id': :'compartmentId',
54
+ 'time_created': :'timeCreated'
55
+ # rubocop:enable Style/SymbolLiteral
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ # rubocop:disable Style/SymbolLiteral
63
+ 'publisher_name': :'String',
64
+ 'listing_id': :'String',
65
+ 'listing_resource_version': :'String',
66
+ 'listing_resource_id': :'String',
67
+ 'display_name': :'String',
68
+ 'summary': :'String',
69
+ 'compartment_id': :'String',
70
+ 'time_created': :'DateTime'
71
+ # rubocop:enable Style/SymbolLiteral
72
+ }
73
+ end
74
+
75
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
76
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
77
+
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @option attributes [String] :publisher_name The value to assign to the {#publisher_name} property
82
+ # @option attributes [String] :listing_id The value to assign to the {#listing_id} property
83
+ # @option attributes [String] :listing_resource_version The value to assign to the {#listing_resource_version} property
84
+ # @option attributes [String] :listing_resource_id The value to assign to the {#listing_resource_id} property
85
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
86
+ # @option attributes [String] :summary The value to assign to the {#summary} property
87
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
88
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
89
+ def initialize(attributes = {})
90
+ return unless attributes.is_a?(Hash)
91
+
92
+ # convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
94
+
95
+ self.publisher_name = attributes[:'publisherName'] if attributes[:'publisherName']
96
+
97
+ raise 'You cannot provide both :publisherName and :publisher_name' if attributes.key?(:'publisherName') && attributes.key?(:'publisher_name')
98
+
99
+ self.publisher_name = attributes[:'publisher_name'] if attributes[:'publisher_name']
100
+
101
+ self.listing_id = attributes[:'listingId'] if attributes[:'listingId']
102
+
103
+ raise 'You cannot provide both :listingId and :listing_id' if attributes.key?(:'listingId') && attributes.key?(:'listing_id')
104
+
105
+ self.listing_id = attributes[:'listing_id'] if attributes[:'listing_id']
106
+
107
+ self.listing_resource_version = attributes[:'listingResourceVersion'] if attributes[:'listingResourceVersion']
108
+
109
+ raise 'You cannot provide both :listingResourceVersion and :listing_resource_version' if attributes.key?(:'listingResourceVersion') && attributes.key?(:'listing_resource_version')
110
+
111
+ self.listing_resource_version = attributes[:'listing_resource_version'] if attributes[:'listing_resource_version']
112
+
113
+ self.listing_resource_id = attributes[:'listingResourceId'] if attributes[:'listingResourceId']
114
+
115
+ raise 'You cannot provide both :listingResourceId and :listing_resource_id' if attributes.key?(:'listingResourceId') && attributes.key?(:'listing_resource_id')
116
+
117
+ self.listing_resource_id = attributes[:'listing_resource_id'] if attributes[:'listing_resource_id']
118
+
119
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
120
+
121
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
122
+
123
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
124
+
125
+ self.summary = attributes[:'summary'] if attributes[:'summary']
126
+
127
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
128
+
129
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
130
+
131
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
132
+
133
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
134
+
135
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
136
+
137
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
138
+ end
139
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
140
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
141
+
142
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
143
+
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] other the other object to be compared
147
+ def ==(other)
148
+ return true if equal?(other)
149
+ self.class == other.class &&
150
+ publisher_name == other.publisher_name &&
151
+ listing_id == other.listing_id &&
152
+ listing_resource_version == other.listing_resource_version &&
153
+ listing_resource_id == other.listing_resource_id &&
154
+ display_name == other.display_name &&
155
+ summary == other.summary &&
156
+ compartment_id == other.compartment_id &&
157
+ time_created == other.time_created
158
+ end
159
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
160
+
161
+ # @see the `==` method
162
+ # @param [Object] other the other object to be compared
163
+ def eql?(other)
164
+ self == other
165
+ end
166
+
167
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
168
+
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Fixnum] Hash code
172
+ def hash
173
+ [publisher_name, listing_id, listing_resource_version, listing_resource_id, display_name, summary, compartment_id, time_created].hash
174
+ end
175
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
176
+
177
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
178
+
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.swagger_types.each_pair do |key, type|
186
+ if type =~ /^Array<(.*)>/i
187
+ # check to ensure the input is an array given that the the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ public_method("#{key}=").call(
191
+ attributes[self.class.attribute_map[key]]
192
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
193
+ )
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ public_method("#{key}=").call(
197
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
198
+ )
199
+ end
200
+ # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = public_method(attr).call
219
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ private
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+ end
245
+ end
246
+ # rubocop:enable Lint/UnneededCopDisableDirective