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,232 @@
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 for creating a subscription for a listing resource version.
8
+ class Core::Models::CreateAppCatalogSubscriptionDetails # rubocop:disable Metrics/LineLength
9
+ # The compartmentID for the subscription.
10
+ # @return [String]
11
+ attr_accessor :compartment_id
12
+
13
+ # The OCID of the listing.
14
+ # @return [String]
15
+ attr_accessor :listing_id
16
+
17
+ # Listing resource version.
18
+ # @return [String]
19
+ attr_accessor :listing_resource_version
20
+
21
+ # Oracle TOU link
22
+ # @return [String]
23
+ attr_accessor :oracle_terms_of_use_link
24
+
25
+ # EULA link
26
+ # @return [String]
27
+ attr_accessor :eula_link
28
+
29
+ # Date and time the agreements were retrieved, in RFC3339 format.
30
+ # Example: `2018-03-20T12:32:53.532Z`
31
+ #
32
+ # @return [DateTime]
33
+ attr_accessor :time_retrieved
34
+
35
+ # A generated signature for this listing resource version retrieved the agreements API.
36
+ # @return [String]
37
+ attr_accessor :signature
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'compartment_id': :'compartmentId',
44
+ 'listing_id': :'listingId',
45
+ 'listing_resource_version': :'listingResourceVersion',
46
+ 'oracle_terms_of_use_link': :'oracleTermsOfUseLink',
47
+ 'eula_link': :'eulaLink',
48
+ 'time_retrieved': :'timeRetrieved',
49
+ 'signature': :'signature'
50
+ # rubocop:enable Style/SymbolLiteral
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.swagger_types
56
+ {
57
+ # rubocop:disable Style/SymbolLiteral
58
+ 'compartment_id': :'String',
59
+ 'listing_id': :'String',
60
+ 'listing_resource_version': :'String',
61
+ 'oracle_terms_of_use_link': :'String',
62
+ 'eula_link': :'String',
63
+ 'time_retrieved': :'DateTime',
64
+ 'signature': :'String'
65
+ # rubocop:enable Style/SymbolLiteral
66
+ }
67
+ end
68
+
69
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
70
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
71
+
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
76
+ # @option attributes [String] :listing_id The value to assign to the {#listing_id} property
77
+ # @option attributes [String] :listing_resource_version The value to assign to the {#listing_resource_version} property
78
+ # @option attributes [String] :oracle_terms_of_use_link The value to assign to the {#oracle_terms_of_use_link} property
79
+ # @option attributes [String] :eula_link The value to assign to the {#eula_link} property
80
+ # @option attributes [DateTime] :time_retrieved The value to assign to the {#time_retrieved} property
81
+ # @option attributes [String] :signature The value to assign to the {#signature} property
82
+ def initialize(attributes = {})
83
+ return unless attributes.is_a?(Hash)
84
+
85
+ # convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
+
88
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
89
+
90
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
91
+
92
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
93
+
94
+ self.listing_id = attributes[:'listingId'] if attributes[:'listingId']
95
+
96
+ raise 'You cannot provide both :listingId and :listing_id' if attributes.key?(:'listingId') && attributes.key?(:'listing_id')
97
+
98
+ self.listing_id = attributes[:'listing_id'] if attributes[:'listing_id']
99
+
100
+ self.listing_resource_version = attributes[:'listingResourceVersion'] if attributes[:'listingResourceVersion']
101
+
102
+ raise 'You cannot provide both :listingResourceVersion and :listing_resource_version' if attributes.key?(:'listingResourceVersion') && attributes.key?(:'listing_resource_version')
103
+
104
+ self.listing_resource_version = attributes[:'listing_resource_version'] if attributes[:'listing_resource_version']
105
+
106
+ self.oracle_terms_of_use_link = attributes[:'oracleTermsOfUseLink'] if attributes[:'oracleTermsOfUseLink']
107
+
108
+ raise 'You cannot provide both :oracleTermsOfUseLink and :oracle_terms_of_use_link' if attributes.key?(:'oracleTermsOfUseLink') && attributes.key?(:'oracle_terms_of_use_link')
109
+
110
+ self.oracle_terms_of_use_link = attributes[:'oracle_terms_of_use_link'] if attributes[:'oracle_terms_of_use_link']
111
+
112
+ self.eula_link = attributes[:'eulaLink'] if attributes[:'eulaLink']
113
+
114
+ raise 'You cannot provide both :eulaLink and :eula_link' if attributes.key?(:'eulaLink') && attributes.key?(:'eula_link')
115
+
116
+ self.eula_link = attributes[:'eula_link'] if attributes[:'eula_link']
117
+
118
+ self.time_retrieved = attributes[:'timeRetrieved'] if attributes[:'timeRetrieved']
119
+
120
+ raise 'You cannot provide both :timeRetrieved and :time_retrieved' if attributes.key?(:'timeRetrieved') && attributes.key?(:'time_retrieved')
121
+
122
+ self.time_retrieved = attributes[:'time_retrieved'] if attributes[:'time_retrieved']
123
+
124
+ self.signature = attributes[:'signature'] if attributes[:'signature']
125
+ end
126
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
127
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
128
+
129
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
130
+
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] other the other object to be compared
134
+ def ==(other)
135
+ return true if equal?(other)
136
+ self.class == other.class &&
137
+ compartment_id == other.compartment_id &&
138
+ listing_id == other.listing_id &&
139
+ listing_resource_version == other.listing_resource_version &&
140
+ oracle_terms_of_use_link == other.oracle_terms_of_use_link &&
141
+ eula_link == other.eula_link &&
142
+ time_retrieved == other.time_retrieved &&
143
+ signature == other.signature
144
+ end
145
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
146
+
147
+ # @see the `==` method
148
+ # @param [Object] other the other object to be compared
149
+ def eql?(other)
150
+ self == other
151
+ end
152
+
153
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
154
+
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Fixnum] Hash code
158
+ def hash
159
+ [compartment_id, listing_id, listing_resource_version, oracle_terms_of_use_link, eula_link, time_retrieved, signature].hash
160
+ end
161
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
162
+
163
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
164
+
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /^Array<(.*)>/i
173
+ # check to ensure the input is an array given that the the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ public_method("#{key}=").call(
177
+ attributes[self.class.attribute_map[key]]
178
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
179
+ )
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ public_method("#{key}=").call(
183
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
184
+ )
185
+ end
186
+ # or else data not found in attributes(hash), not an issue as the data can be optional
187
+ end
188
+
189
+ self
190
+ end
191
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = public_method(attr).call
205
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ private
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+ end
231
+ end
232
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,239 @@
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
+ # CreateNatGatewayDetails model.
8
+ class Core::Models::CreateNatGatewayDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment to contain the
10
+ # NAT gateway.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :compartment_id
14
+
15
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
16
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
17
+ #
18
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
19
+ #
20
+ # @return [Hash<String, Hash<String, Object>>]
21
+ attr_accessor :defined_tags
22
+
23
+ # A user-friendly name. Does not have to be unique, and it's changeable.
24
+ # Avoid entering confidential information.
25
+ #
26
+ # @return [String]
27
+ attr_accessor :display_name
28
+
29
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
30
+ # predefined name, type, or namespace. For more information, see
31
+ # [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
32
+ #
33
+ # Example: `{\"Department\": \"Finance\"}`
34
+ #
35
+ # @return [Hash<String, String>]
36
+ attr_accessor :freeform_tags
37
+
38
+ # Whether the NAT gateway blocks traffic through it. The default is `false`.
39
+ #
40
+ # Example: `true`
41
+ #
42
+ # @return [BOOLEAN]
43
+ attr_accessor :block_traffic
44
+
45
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the VCN the gateway belongs to.
46
+ #
47
+ # @return [String]
48
+ attr_accessor :vcn_id
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ # rubocop:disable Style/SymbolLiteral
54
+ 'compartment_id': :'compartmentId',
55
+ 'defined_tags': :'definedTags',
56
+ 'display_name': :'displayName',
57
+ 'freeform_tags': :'freeformTags',
58
+ 'block_traffic': :'blockTraffic',
59
+ 'vcn_id': :'vcnId'
60
+ # rubocop:enable Style/SymbolLiteral
61
+ }
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ {
67
+ # rubocop:disable Style/SymbolLiteral
68
+ 'compartment_id': :'String',
69
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
70
+ 'display_name': :'String',
71
+ 'freeform_tags': :'Hash<String, String>',
72
+ 'block_traffic': :'BOOLEAN',
73
+ 'vcn_id': :'String'
74
+ # rubocop:enable Style/SymbolLiteral
75
+ }
76
+ end
77
+
78
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
79
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
80
+
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
85
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
86
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
87
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
88
+ # @option attributes [BOOLEAN] :block_traffic The value to assign to the {#block_traffic} property
89
+ # @option attributes [String] :vcn_id The value to assign to the {#vcn_id} property
90
+ def initialize(attributes = {})
91
+ return unless attributes.is_a?(Hash)
92
+
93
+ # convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
95
+
96
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
97
+
98
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
99
+
100
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
101
+
102
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
103
+
104
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
105
+
106
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
107
+
108
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
109
+
110
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
111
+
112
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
113
+
114
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
115
+
116
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
117
+
118
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
119
+
120
+ self.block_traffic = attributes[:'blockTraffic'] unless attributes[:'blockTraffic'].nil?
121
+ self.block_traffic = false if block_traffic.nil? && !attributes.key?(:'blockTraffic') # rubocop:disable Style/StringLiterals
122
+
123
+ raise 'You cannot provide both :blockTraffic and :block_traffic' if attributes.key?(:'blockTraffic') && attributes.key?(:'block_traffic')
124
+
125
+ self.block_traffic = attributes[:'block_traffic'] unless attributes[:'block_traffic'].nil?
126
+ self.block_traffic = false if block_traffic.nil? && !attributes.key?(:'blockTraffic') && !attributes.key?(:'block_traffic') # rubocop:disable Style/StringLiterals
127
+
128
+ self.vcn_id = attributes[:'vcnId'] if attributes[:'vcnId']
129
+
130
+ raise 'You cannot provide both :vcnId and :vcn_id' if attributes.key?(:'vcnId') && attributes.key?(:'vcn_id')
131
+
132
+ self.vcn_id = attributes[:'vcn_id'] if attributes[:'vcn_id']
133
+ end
134
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
135
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
136
+
137
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
138
+
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] other the other object to be compared
142
+ def ==(other)
143
+ return true if equal?(other)
144
+ self.class == other.class &&
145
+ compartment_id == other.compartment_id &&
146
+ defined_tags == other.defined_tags &&
147
+ display_name == other.display_name &&
148
+ freeform_tags == other.freeform_tags &&
149
+ block_traffic == other.block_traffic &&
150
+ vcn_id == other.vcn_id
151
+ end
152
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
153
+
154
+ # @see the `==` method
155
+ # @param [Object] other the other object to be compared
156
+ def eql?(other)
157
+ self == other
158
+ end
159
+
160
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
161
+
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Fixnum] Hash code
165
+ def hash
166
+ [compartment_id, defined_tags, display_name, freeform_tags, block_traffic, vcn_id].hash
167
+ end
168
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
169
+
170
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
171
+
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.swagger_types.each_pair do |key, type|
179
+ if type =~ /^Array<(.*)>/i
180
+ # check to ensure the input is an array given that the the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ public_method("#{key}=").call(
184
+ attributes[self.class.attribute_map[key]]
185
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
186
+ )
187
+ end
188
+ elsif !attributes[self.class.attribute_map[key]].nil?
189
+ public_method("#{key}=").call(
190
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
191
+ )
192
+ end
193
+ # or else data not found in attributes(hash), not an issue as the data can be optional
194
+ end
195
+
196
+ self
197
+ end
198
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = public_method(attr).call
212
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ private
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+ end
238
+ end
239
+ # rubocop:enable Lint/UnneededCopDisableDirective