oci 2.2.0 → 2.2.1

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.
@@ -0,0 +1,282 @@
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
+ # An `AuthToken` is an Oracle-generated token string that you can use to authenticate with third-party APIs
9
+ # that do not support Oracle Cloud Infrastructure's signature-based authentication. For example, use an `AuthToken`
10
+ # to authenticate with a Swift client with the Object Storage Service.
11
+ #
12
+ # The auth token is associated with the user's Console login. Auth tokens never expire. A user can have up to two
13
+ # auth tokens at a time.
14
+ #
15
+ # **Note:** The token is always an Oracle-generated string; you can't change it to a string of your choice.
16
+ #
17
+ # For more information, see [Managing User Credentials](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingcredentials.htm).
18
+ #
19
+ class Identity::Models::AuthToken # rubocop:disable Metrics/LineLength
20
+ LIFECYCLE_STATE_ENUM = [
21
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
22
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
23
+ LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
24
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
25
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
26
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
27
+ ].freeze
28
+
29
+ # The auth token. The value is available only in the response for `CreateAuthToken`, and not
30
+ # for `ListAuthTokens` or `UpdateAuthToken`.
31
+ #
32
+ # @return [String]
33
+ attr_accessor :token
34
+
35
+ # The OCID of the auth token.
36
+ # @return [String]
37
+ attr_accessor :id
38
+
39
+ # The OCID of the user the auth token belongs to.
40
+ # @return [String]
41
+ attr_accessor :user_id
42
+
43
+ # The description you assign to the auth token. Does not have to be unique, and it's changeable.
44
+ # @return [String]
45
+ attr_accessor :description
46
+
47
+ # Date and time the `AuthToken` object was created, in the format defined by RFC3339.
48
+ #
49
+ # Example: `2016-08-25T21:10:29.600Z`
50
+ #
51
+ # @return [DateTime]
52
+ attr_accessor :time_created
53
+
54
+ # Date and time when this auth token will expire, in the format defined by RFC3339.
55
+ # Null if it never expires.
56
+ #
57
+ # Example: `2016-08-25T21:10:29.600Z`
58
+ #
59
+ # @return [DateTime]
60
+ attr_accessor :time_expires
61
+
62
+ # The token's current state. After creating an auth token, make sure its `lifecycleState` changes from
63
+ # CREATING to ACTIVE before using it.
64
+ #
65
+ # @return [String]
66
+ attr_reader :lifecycle_state
67
+
68
+ # The detailed status of INACTIVE lifecycleState.
69
+ # @return [Integer]
70
+ attr_accessor :inactive_status
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ # rubocop:disable Style/SymbolLiteral
76
+ 'token': :'token',
77
+ 'id': :'id',
78
+ 'user_id': :'userId',
79
+ 'description': :'description',
80
+ 'time_created': :'timeCreated',
81
+ 'time_expires': :'timeExpires',
82
+ 'lifecycle_state': :'lifecycleState',
83
+ 'inactive_status': :'inactiveStatus'
84
+ # rubocop:enable Style/SymbolLiteral
85
+ }
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.swagger_types
90
+ {
91
+ # rubocop:disable Style/SymbolLiteral
92
+ 'token': :'String',
93
+ 'id': :'String',
94
+ 'user_id': :'String',
95
+ 'description': :'String',
96
+ 'time_created': :'DateTime',
97
+ 'time_expires': :'DateTime',
98
+ 'lifecycle_state': :'String',
99
+ 'inactive_status': :'Integer'
100
+ # rubocop:enable Style/SymbolLiteral
101
+ }
102
+ end
103
+
104
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
105
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
106
+
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @option attributes [String] :token The value to assign to the {#token} property
111
+ # @option attributes [String] :id The value to assign to the {#id} property
112
+ # @option attributes [String] :user_id The value to assign to the {#user_id} property
113
+ # @option attributes [String] :description The value to assign to the {#description} property
114
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
115
+ # @option attributes [DateTime] :time_expires The value to assign to the {#time_expires} property
116
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
117
+ # @option attributes [Integer] :inactive_status The value to assign to the {#inactive_status} 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.token = attributes[:'token'] if attributes[:'token']
125
+
126
+ self.id = attributes[:'id'] if attributes[:'id']
127
+
128
+ self.user_id = attributes[:'userId'] if attributes[:'userId']
129
+
130
+ raise 'You cannot provide both :userId and :user_id' if attributes.key?(:'userId') && attributes.key?(:'user_id')
131
+
132
+ self.user_id = attributes[:'user_id'] if attributes[:'user_id']
133
+
134
+ self.description = attributes[:'description'] if attributes[:'description']
135
+
136
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
137
+
138
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
139
+
140
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
141
+
142
+ self.time_expires = attributes[:'timeExpires'] if attributes[:'timeExpires']
143
+
144
+ raise 'You cannot provide both :timeExpires and :time_expires' if attributes.key?(:'timeExpires') && attributes.key?(:'time_expires')
145
+
146
+ self.time_expires = attributes[:'time_expires'] if attributes[:'time_expires']
147
+
148
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
149
+
150
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
151
+
152
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
153
+
154
+ self.inactive_status = attributes[:'inactiveStatus'] if attributes[:'inactiveStatus']
155
+
156
+ raise 'You cannot provide both :inactiveStatus and :inactive_status' if attributes.key?(:'inactiveStatus') && attributes.key?(:'inactive_status')
157
+
158
+ self.inactive_status = attributes[:'inactive_status'] if attributes[:'inactive_status']
159
+ end
160
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
161
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] lifecycle_state Object to be assigned
165
+ def lifecycle_state=(lifecycle_state)
166
+ # rubocop:disable Style/ConditionalAssignment
167
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
168
+ # rubocop: disable Metrics/LineLength
169
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
170
+ # rubocop: enable Metrics/LineLength
171
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
172
+ else
173
+ @lifecycle_state = lifecycle_state
174
+ end
175
+ # rubocop:enable Style/ConditionalAssignment
176
+ end
177
+
178
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
179
+
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] other the other object to be compared
183
+ def ==(other)
184
+ return true if equal?(other)
185
+ self.class == other.class &&
186
+ token == other.token &&
187
+ id == other.id &&
188
+ user_id == other.user_id &&
189
+ description == other.description &&
190
+ time_created == other.time_created &&
191
+ time_expires == other.time_expires &&
192
+ lifecycle_state == other.lifecycle_state &&
193
+ inactive_status == other.inactive_status
194
+ end
195
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
196
+
197
+ # @see the `==` method
198
+ # @param [Object] other the other object to be compared
199
+ def eql?(other)
200
+ self == other
201
+ end
202
+
203
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
204
+
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Fixnum] Hash code
208
+ def hash
209
+ [token, id, user_id, description, time_created, time_expires, lifecycle_state, inactive_status].hash
210
+ end
211
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
212
+
213
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
214
+
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.swagger_types.each_pair do |key, type|
222
+ if type =~ /^Array<(.*)>/i
223
+ # check to ensure the input is an array given that the the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ public_method("#{key}=").call(
227
+ attributes[self.class.attribute_map[key]]
228
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
229
+ )
230
+ end
231
+ elsif !attributes[self.class.attribute_map[key]].nil?
232
+ public_method("#{key}=").call(
233
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
234
+ )
235
+ end
236
+ # or else data not found in attributes(hash), not an issue as the data can be optional
237
+ end
238
+
239
+ self
240
+ end
241
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = public_method(attr).call
255
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ private
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+ end
281
+ end
282
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -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
+ # CreateAuthTokenDetails model.
8
+ class Identity::Models::CreateAuthTokenDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
10
+ #
11
+ # @return [String]
12
+ attr_accessor :description
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'description': :'description'
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
+ 'description': :'String'
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 [String] :description The value to assign to the {#description} 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.description = attributes[:'description'] if attributes[:'description']
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
+ description == other.description
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
+ [description].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
@@ -5,8 +5,10 @@ require 'logger'
5
5
 
6
6
  # rubocop:disable Lint/UnneededCopDisableDirective
7
7
  module OCI
8
+ # **Deprecated. Use {AuthToken} instead.**
9
+ #
8
10
  # Swift is the OpenStack object storage service. A `SwiftPassword` is an Oracle-provided password for using a
9
- # Swift client with the Oracle Cloud Infrastructure Object Storage Service. This password is associated with
11
+ # Swift client with the Object Storage Service. This password is associated with
10
12
  # the user's Console login. Swift passwords never expire. A user can have up to two Swift passwords at a time.
11
13
  #
12
14
  # **Note:** The password is always an Oracle-generated string; you can't change it to a string of your choice.
@@ -0,0 +1,146 @@
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
+ # UpdateAuthTokenDetails model.
8
+ class Identity::Models::UpdateAuthTokenDetails # rubocop:disable Metrics/LineLength
9
+ # The description you assign to the auth token. Does not have to be unique, and it's changeable.
10
+ # @return [String]
11
+ attr_accessor :description
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ # rubocop:disable Style/SymbolLiteral
17
+ 'description': :'description'
18
+ # rubocop:enable Style/SymbolLiteral
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'description': :'String'
27
+ # rubocop:enable Style/SymbolLiteral
28
+ }
29
+ end
30
+
31
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
32
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
33
+
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ # @option attributes [String] :description The value to assign to the {#description} property
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
43
+
44
+ self.description = attributes[:'description'] if attributes[:'description']
45
+ end
46
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
47
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
50
+
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] other the other object to be compared
54
+ def ==(other)
55
+ return true if equal?(other)
56
+ self.class == other.class &&
57
+ description == other.description
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
60
+
61
+ # @see the `==` method
62
+ # @param [Object] other the other object to be compared
63
+ def eql?(other)
64
+ self == other
65
+ end
66
+
67
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
68
+
69
+
70
+ # Calculates hash code according to all attributes.
71
+ # @return [Fixnum] Hash code
72
+ def hash
73
+ [description].hash
74
+ end
75
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
76
+
77
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
78
+
79
+
80
+ # Builds the object from hash
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ self.class.swagger_types.each_pair do |key, type|
86
+ if type =~ /^Array<(.*)>/i
87
+ # check to ensure the input is an array given that the the attribute
88
+ # is documented as an array but the input is not
89
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
90
+ public_method("#{key}=").call(
91
+ attributes[self.class.attribute_map[key]]
92
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
93
+ )
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ public_method("#{key}=").call(
97
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
98
+ )
99
+ end
100
+ # or else data not found in attributes(hash), not an issue as the data can be optional
101
+ end
102
+
103
+ self
104
+ end
105
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
106
+
107
+ # Returns the string representation of the object
108
+ # @return [String] String presentation of the object
109
+ def to_s
110
+ to_hash.to_s
111
+ end
112
+
113
+ # Returns the object in the form of hash
114
+ # @return [Hash] Returns the object in the form of hash
115
+ def to_hash
116
+ hash = {}
117
+ self.class.attribute_map.each_pair do |attr, param|
118
+ value = public_method(attr).call
119
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
120
+ hash[param] = _to_hash(value)
121
+ end
122
+ hash
123
+ end
124
+
125
+ private
126
+
127
+ # Outputs non-array value in the form of hash
128
+ # For object, use to_hash. Otherwise, just return the value
129
+ # @param [Object] value Any valid value
130
+ # @return [Hash] Returns the value in the form of hash
131
+ def _to_hash(value)
132
+ if value.is_a?(Array)
133
+ value.compact.map { |v| _to_hash(v) }
134
+ elsif value.is_a?(Hash)
135
+ {}.tap do |hash|
136
+ value.each { |k, v| hash[k] = _to_hash(v) }
137
+ end
138
+ elsif value.respond_to? :to_hash
139
+ value.to_hash
140
+ else
141
+ value
142
+ end
143
+ end
144
+ end
145
+ end
146
+ # rubocop:enable Lint/UnneededCopDisableDirective