oci 2.3.7 → 2.3.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -7,7 +7,7 @@ require 'logger'
7
7
  module OCI
8
8
  # Pre-authenticated requests provide a way to let users access a bucket or an object without having their own credentials.
9
9
  # When you create a pre-authenticated request, a unique URL is generated. Users in your organization, partners, or third
10
- # parties can use this URL to access the targets identified in the pre-authenticated request. See [Using Pre-Authenticated Requests](https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/usingpreauthenticatedrequests.htm).
10
+ # parties can use this URL to access the targets identified in the pre-authenticated request. See [Managing Access to Buckets and Objects](https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm).
11
11
  #
12
12
  # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator.
13
13
  # If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
@@ -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
+ # Creates a new object lifecycle policy for a bucket.
8
+ #
9
+ class ObjectStorage::Models::PutObjectLifecyclePolicyDetails # rubocop:disable Metrics/LineLength
10
+ # The bucket's set of lifecycle policy rules.
11
+ # @return [Array<OCI::ObjectStorage::Models::ObjectLifecycleRule>]
12
+ attr_accessor :items
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'items': :'items'
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
+ 'items': :'Array<OCI::ObjectStorage::Models::ObjectLifecycleRule>'
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 [Array<OCI::ObjectStorage::Models::ObjectLifecycleRule>] :items The value to assign to the {#items} 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.items = attributes[:'items'] if attributes[:'items']
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
+ items == other.items
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
+ [items].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
@@ -6,12 +6,12 @@ require 'date'
6
6
  module OCI
7
7
  # RestoreObjectsDetails model.
8
8
  class ObjectStorage::Models::RestoreObjectsDetails # rubocop:disable Metrics/LineLength
9
- # **[Required]** A object which was in an archived state and need to be restored.
9
+ # **[Required]** An object which is in archive-tier storage and needs to be restored.
10
10
  # @return [String]
11
11
  attr_accessor :object_name
12
12
 
13
13
  # The number of hours for which this object will be restored.
14
- # By default object will be restored for 24 hours.It can be configured using hours parameter.
14
+ # By default objects will be restored for 24 hours. Duration can be configured using the hours parameter.
15
15
  #
16
16
  # @return [Integer]
17
17
  attr_accessor :hours
@@ -0,0 +1,304 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # A description of workRequest status
9
+ class ObjectStorage::Models::WorkRequest # rubocop:disable Metrics/LineLength
10
+ OPERATION_TYPE_ENUM = [
11
+ OPERATION_TYPE_COPY_OBJECT = 'COPY_OBJECT'.freeze,
12
+ OPERATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
13
+ ].freeze
14
+
15
+ STATUS_ENUM = [
16
+ STATUS_ACCEPTED = 'ACCEPTED'.freeze,
17
+ STATUS_IN_PROGRESS = 'IN_PROGRESS'.freeze,
18
+ STATUS_FAILED = 'FAILED'.freeze,
19
+ STATUS_COMPLETED = 'COMPLETED'.freeze,
20
+ STATUS_CANCELING = 'CANCELING'.freeze,
21
+ STATUS_CANCELED = 'CANCELED'.freeze,
22
+ STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
23
+ ].freeze
24
+
25
+ # type of the work request
26
+ # @return [String]
27
+ attr_reader :operation_type
28
+
29
+ # status of current work request.
30
+ # @return [String]
31
+ attr_reader :status
32
+
33
+ # The id of the work request.
34
+ # @return [String]
35
+ attr_accessor :id
36
+
37
+ # The ocid of the compartment that contains the work request. Work requests should be scoped to
38
+ # the same compartment as the resource the work request affects. If the work request affects multiple resources,
39
+ # and those resources are not in the same compartment, it is up to the service team to pick the primary
40
+ # resource whose compartment should be used
41
+ #
42
+ # @return [String]
43
+ attr_accessor :compartment_id
44
+
45
+ # @return [Array<OCI::ObjectStorage::Models::WorkRequestResource>]
46
+ attr_accessor :resources
47
+
48
+ # Percentage of the request completed.
49
+ # @return [Float]
50
+ attr_accessor :percent_complete
51
+
52
+ # The date and time the request was created, as described in
53
+ # [RFC 3339](https://tools.ietf.org/rfc/rfc3339), section 14.29.
54
+ #
55
+ # @return [DateTime]
56
+ attr_accessor :time_accepted
57
+
58
+ # The date and time the request was started, as described in [RFC 3339](https://tools.ietf.org/rfc/rfc3339),
59
+ # section 14.29.
60
+ #
61
+ # @return [DateTime]
62
+ attr_accessor :time_started
63
+
64
+ # The date and time the object was finished, as described in [RFC 3339](https://tools.ietf.org/rfc/rfc3339).
65
+ #
66
+ # @return [DateTime]
67
+ attr_accessor :time_finished
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ # rubocop:disable Style/SymbolLiteral
73
+ 'operation_type': :'operationType',
74
+ 'status': :'status',
75
+ 'id': :'id',
76
+ 'compartment_id': :'compartmentId',
77
+ 'resources': :'resources',
78
+ 'percent_complete': :'percentComplete',
79
+ 'time_accepted': :'timeAccepted',
80
+ 'time_started': :'timeStarted',
81
+ 'time_finished': :'timeFinished'
82
+ # rubocop:enable Style/SymbolLiteral
83
+ }
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.swagger_types
88
+ {
89
+ # rubocop:disable Style/SymbolLiteral
90
+ 'operation_type': :'String',
91
+ 'status': :'String',
92
+ 'id': :'String',
93
+ 'compartment_id': :'String',
94
+ 'resources': :'Array<OCI::ObjectStorage::Models::WorkRequestResource>',
95
+ 'percent_complete': :'Float',
96
+ 'time_accepted': :'DateTime',
97
+ 'time_started': :'DateTime',
98
+ 'time_finished': :'DateTime'
99
+ # rubocop:enable Style/SymbolLiteral
100
+ }
101
+ end
102
+
103
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
104
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
105
+
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @option attributes [String] :operation_type The value to assign to the {#operation_type} property
110
+ # @option attributes [String] :status The value to assign to the {#status} property
111
+ # @option attributes [String] :id The value to assign to the {#id} property
112
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
113
+ # @option attributes [Array<OCI::ObjectStorage::Models::WorkRequestResource>] :resources The value to assign to the {#resources} property
114
+ # @option attributes [Float] :percent_complete The value to assign to the {#percent_complete} property
115
+ # @option attributes [DateTime] :time_accepted The value to assign to the {#time_accepted} property
116
+ # @option attributes [DateTime] :time_started The value to assign to the {#time_started} property
117
+ # @option attributes [DateTime] :time_finished The value to assign to the {#time_finished} property
118
+ def initialize(attributes = {})
119
+ return unless attributes.is_a?(Hash)
120
+
121
+ # convert string to symbol for hash key
122
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
123
+
124
+ self.operation_type = attributes[:'operationType'] if attributes[:'operationType']
125
+
126
+ raise 'You cannot provide both :operationType and :operation_type' if attributes.key?(:'operationType') && attributes.key?(:'operation_type')
127
+
128
+ self.operation_type = attributes[:'operation_type'] if attributes[:'operation_type']
129
+
130
+ self.status = attributes[:'status'] if attributes[:'status']
131
+
132
+ self.id = attributes[:'id'] if attributes[:'id']
133
+
134
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
135
+
136
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
137
+
138
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
139
+
140
+ self.resources = attributes[:'resources'] if attributes[:'resources']
141
+
142
+ self.percent_complete = attributes[:'percentComplete'] if attributes[:'percentComplete']
143
+
144
+ raise 'You cannot provide both :percentComplete and :percent_complete' if attributes.key?(:'percentComplete') && attributes.key?(:'percent_complete')
145
+
146
+ self.percent_complete = attributes[:'percent_complete'] if attributes[:'percent_complete']
147
+
148
+ self.time_accepted = attributes[:'timeAccepted'] if attributes[:'timeAccepted']
149
+
150
+ raise 'You cannot provide both :timeAccepted and :time_accepted' if attributes.key?(:'timeAccepted') && attributes.key?(:'time_accepted')
151
+
152
+ self.time_accepted = attributes[:'time_accepted'] if attributes[:'time_accepted']
153
+
154
+ self.time_started = attributes[:'timeStarted'] if attributes[:'timeStarted']
155
+
156
+ raise 'You cannot provide both :timeStarted and :time_started' if attributes.key?(:'timeStarted') && attributes.key?(:'time_started')
157
+
158
+ self.time_started = attributes[:'time_started'] if attributes[:'time_started']
159
+
160
+ self.time_finished = attributes[:'timeFinished'] if attributes[:'timeFinished']
161
+
162
+ raise 'You cannot provide both :timeFinished and :time_finished' if attributes.key?(:'timeFinished') && attributes.key?(:'time_finished')
163
+
164
+ self.time_finished = attributes[:'time_finished'] if attributes[:'time_finished']
165
+ end
166
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
167
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
168
+
169
+ # Custom attribute writer method checking allowed values (enum).
170
+ # @param [Object] operation_type Object to be assigned
171
+ def operation_type=(operation_type)
172
+ # rubocop:disable Style/ConditionalAssignment
173
+ if operation_type && !OPERATION_TYPE_ENUM.include?(operation_type)
174
+ # rubocop: disable Metrics/LineLength
175
+ OCI.logger.debug("Unknown value for 'operation_type' [" + operation_type + "]. Mapping to 'OPERATION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
176
+ # rubocop: enable Metrics/LineLength
177
+ @operation_type = OPERATION_TYPE_UNKNOWN_ENUM_VALUE
178
+ else
179
+ @operation_type = operation_type
180
+ end
181
+ # rubocop:enable Style/ConditionalAssignment
182
+ end
183
+
184
+ # Custom attribute writer method checking allowed values (enum).
185
+ # @param [Object] status Object to be assigned
186
+ def status=(status)
187
+ # rubocop:disable Style/ConditionalAssignment
188
+ if status && !STATUS_ENUM.include?(status)
189
+ # rubocop: disable Metrics/LineLength
190
+ OCI.logger.debug("Unknown value for 'status' [" + status + "]. Mapping to 'STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
191
+ # rubocop: enable Metrics/LineLength
192
+ @status = STATUS_UNKNOWN_ENUM_VALUE
193
+ else
194
+ @status = status
195
+ end
196
+ # rubocop:enable Style/ConditionalAssignment
197
+ end
198
+
199
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
200
+
201
+
202
+ # Checks equality by comparing each attribute.
203
+ # @param [Object] other the other object to be compared
204
+ def ==(other)
205
+ return true if equal?(other)
206
+ self.class == other.class &&
207
+ operation_type == other.operation_type &&
208
+ status == other.status &&
209
+ id == other.id &&
210
+ compartment_id == other.compartment_id &&
211
+ resources == other.resources &&
212
+ percent_complete == other.percent_complete &&
213
+ time_accepted == other.time_accepted &&
214
+ time_started == other.time_started &&
215
+ time_finished == other.time_finished
216
+ end
217
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
218
+
219
+ # @see the `==` method
220
+ # @param [Object] other the other object to be compared
221
+ def eql?(other)
222
+ self == other
223
+ end
224
+
225
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
226
+
227
+
228
+ # Calculates hash code according to all attributes.
229
+ # @return [Fixnum] Hash code
230
+ def hash
231
+ [operation_type, status, id, compartment_id, resources, percent_complete, time_accepted, time_started, time_finished].hash
232
+ end
233
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
234
+
235
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
236
+
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def build_from_hash(attributes)
242
+ return nil unless attributes.is_a?(Hash)
243
+ self.class.swagger_types.each_pair do |key, type|
244
+ if type =~ /^Array<(.*)>/i
245
+ # check to ensure the input is an array given that the the attribute
246
+ # is documented as an array but the input is not
247
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
248
+ public_method("#{key}=").call(
249
+ attributes[self.class.attribute_map[key]]
250
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
251
+ )
252
+ end
253
+ elsif !attributes[self.class.attribute_map[key]].nil?
254
+ public_method("#{key}=").call(
255
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
256
+ )
257
+ end
258
+ # or else data not found in attributes(hash), not an issue as the data can be optional
259
+ end
260
+
261
+ self
262
+ end
263
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = public_method(attr).call
277
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ private
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+ end
303
+ end
304
+ # rubocop:enable Lint/UnneededCopDisableDirective