tremendous_ruby 5.9.0 → 5.10.0

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +522 -53
  3. data/lib/tremendous/models/connected_organization.rb +287 -0
  4. data/lib/tremendous/models/connected_organization_member.rb +330 -0
  5. data/lib/tremendous/models/connected_organization_member_member.rb +366 -0
  6. data/lib/tremendous/models/connected_organization_member_session.rb +311 -0
  7. data/lib/tremendous/models/connected_organization_organization.rb +324 -0
  8. data/lib/tremendous/models/create_campaign200_response.rb +221 -0
  9. data/lib/tremendous/models/create_connected_organization200_response.rb +221 -0
  10. data/lib/tremendous/models/create_connected_organization_member200_response.rb +221 -0
  11. data/lib/tremendous/models/create_connected_organization_member_request.rb +222 -0
  12. data/lib/tremendous/models/create_connected_organization_member_session200_response.rb +221 -0
  13. data/lib/tremendous/models/create_connected_organization_member_session200_response_connected_organization_member_session.rb +311 -0
  14. data/lib/tremendous/models/create_connected_organization_member_session_request.rb +222 -0
  15. data/lib/tremendous/models/create_connected_organization_request.rb +222 -0
  16. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +1 -1
  17. data/lib/tremendous/models/create_organization_request_copy_settings.rb +16 -4
  18. data/lib/tremendous/models/create_report200_response.rb +231 -0
  19. data/lib/tremendous/models/create_report200_response_report.rb +291 -0
  20. data/lib/tremendous/models/delivery_details.rb +1 -1
  21. data/lib/tremendous/models/delivery_details_with_link.rb +1 -1
  22. data/lib/tremendous/models/funding_source.rb +35 -1
  23. data/lib/tremendous/models/list_connected_organization_members200_response.rb +240 -0
  24. data/lib/tremendous/models/list_connected_organization_members200_response_connected_organization_members_inner.rb +330 -0
  25. data/lib/tremendous/models/list_connected_organization_members200_response_connected_organization_members_inner_member.rb +366 -0
  26. data/lib/tremendous/models/list_connected_organizations200_response.rb +240 -0
  27. data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner.rb +287 -0
  28. data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner_organization.rb +324 -0
  29. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +35 -1
  30. data/lib/tremendous/models/list_products_response_products_inner.rb +27 -7
  31. data/lib/tremendous/models/list_products_response_products_inner_documents.rb +236 -0
  32. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +15 -4
  33. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +1 -1
  34. data/lib/tremendous/models/product.rb +27 -7
  35. data/lib/tremendous/models/product_documents.rb +236 -0
  36. data/lib/tremendous/models/reward_with_link_delivery.rb +1 -1
  37. data/lib/tremendous/models/reward_without_link_delivery.rb +1 -1
  38. data/lib/tremendous/version.rb +1 -1
  39. data/lib/tremendous.rb +23 -5
  40. metadata +26 -7
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class ConnectedOrganization
18
+ # Tremendous' identifier for the connected organization.
19
+ attr_accessor :id
20
+
21
+ # Client ID of the OAuth app that is to be used by the platform once the integration is complete.
22
+ attr_accessor :client_id
23
+
24
+ # Timestamp of when the connected organization was created.
25
+ attr_accessor :created_at
26
+
27
+ attr_accessor :organization
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'id' => :'id',
33
+ :'client_id' => :'client_id',
34
+ :'created_at' => :'created_at',
35
+ :'organization' => :'organization'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'id' => :'String',
48
+ :'client_id' => :'String',
49
+ :'created_at' => :'Time',
50
+ :'organization' => :'ConnectedOrganizationOrganization'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'organization'
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ConnectedOrganization` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ConnectedOrganization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
78
+ else
79
+ self.id = nil
80
+ end
81
+
82
+ if attributes.key?(:'client_id')
83
+ self.client_id = attributes[:'client_id']
84
+ else
85
+ self.client_id = nil
86
+ end
87
+
88
+ if attributes.key?(:'created_at')
89
+ self.created_at = attributes[:'created_at']
90
+ else
91
+ self.created_at = nil
92
+ end
93
+
94
+ if attributes.key?(:'organization')
95
+ self.organization = attributes[:'organization']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @id.nil?
105
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
106
+ end
107
+
108
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
109
+ if @id !~ pattern
110
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
111
+ end
112
+
113
+ if @client_id.nil?
114
+ invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
115
+ end
116
+
117
+ if @created_at.nil?
118
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
128
+ return false if @id.nil?
129
+ return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
130
+ return false if @client_id.nil?
131
+ return false if @created_at.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] id Value to be assigned
137
+ def id=(id)
138
+ if id.nil?
139
+ fail ArgumentError, 'id cannot be nil'
140
+ end
141
+
142
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
143
+ if id !~ pattern
144
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
145
+ end
146
+
147
+ @id = id
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ id == o.id &&
156
+ client_id == o.client_id &&
157
+ created_at == o.created_at &&
158
+ organization == o.organization
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [id, client_id, created_at, organization].hash
171
+ end
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 self.build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ attributes = attributes.transform_keys(&:to_sym)
179
+ transformed_hash = {}
180
+ openapi_types.each_pair do |key, type|
181
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = nil
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[attribute_map[key]].is_a?(Array)
187
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
188
+ end
189
+ elsif !attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
191
+ end
192
+ end
193
+ new(transformed_hash)
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def self._deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ # models (e.g. Pet) or oneOf
234
+ klass = Tremendous.const_get(type)
235
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end
@@ -0,0 +1,330 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class ConnectedOrganizationMember
18
+ # Tremendous' identifier for the connected organization member.
19
+ attr_accessor :id
20
+
21
+ # The name associated with the user in your systems.
22
+ attr_accessor :external_name
23
+
24
+ # The email associated with the user in your systems.
25
+ attr_accessor :external_email
26
+
27
+ # Timestamp of when the connected organization member was created.
28
+ attr_accessor :created_at
29
+
30
+ # Tremendous' identifier for the connected organization.
31
+ attr_accessor :connected_organization_id
32
+
33
+ attr_accessor :member
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'id' => :'id',
39
+ :'external_name' => :'external_name',
40
+ :'external_email' => :'external_email',
41
+ :'created_at' => :'created_at',
42
+ :'connected_organization_id' => :'connected_organization_id',
43
+ :'member' => :'member'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'id' => :'String',
56
+ :'external_name' => :'String',
57
+ :'external_email' => :'String',
58
+ :'created_at' => :'Time',
59
+ :'connected_organization_id' => :'String',
60
+ :'member' => :'ConnectedOrganizationMemberMember'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'external_name',
68
+ :'external_email',
69
+ :'member'
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ConnectedOrganizationMember` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ConnectedOrganizationMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'id')
89
+ self.id = attributes[:'id']
90
+ else
91
+ self.id = nil
92
+ end
93
+
94
+ if attributes.key?(:'external_name')
95
+ self.external_name = attributes[:'external_name']
96
+ end
97
+
98
+ if attributes.key?(:'external_email')
99
+ self.external_email = attributes[:'external_email']
100
+ end
101
+
102
+ if attributes.key?(:'created_at')
103
+ self.created_at = attributes[:'created_at']
104
+ else
105
+ self.created_at = nil
106
+ end
107
+
108
+ if attributes.key?(:'connected_organization_id')
109
+ self.connected_organization_id = attributes[:'connected_organization_id']
110
+ else
111
+ self.connected_organization_id = nil
112
+ end
113
+
114
+ if attributes.key?(:'member')
115
+ self.member = attributes[:'member']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ if @id.nil?
125
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
126
+ end
127
+
128
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
129
+ if @id !~ pattern
130
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
131
+ end
132
+
133
+ if @created_at.nil?
134
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
135
+ end
136
+
137
+ if @connected_organization_id.nil?
138
+ invalid_properties.push('invalid value for "connected_organization_id", connected_organization_id cannot be nil.')
139
+ end
140
+
141
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
142
+ if @connected_organization_id !~ pattern
143
+ invalid_properties.push("invalid value for \"connected_organization_id\", must conform to the pattern #{pattern}.")
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ warn '[DEPRECATED] the `valid?` method is obsolete'
153
+ return false if @id.nil?
154
+ return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
155
+ return false if @created_at.nil?
156
+ return false if @connected_organization_id.nil?
157
+ return false if @connected_organization_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] id Value to be assigned
163
+ def id=(id)
164
+ if id.nil?
165
+ fail ArgumentError, 'id cannot be nil'
166
+ end
167
+
168
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
169
+ if id !~ pattern
170
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
171
+ end
172
+
173
+ @id = id
174
+ end
175
+
176
+ # Custom attribute writer method with validation
177
+ # @param [Object] connected_organization_id Value to be assigned
178
+ def connected_organization_id=(connected_organization_id)
179
+ if connected_organization_id.nil?
180
+ fail ArgumentError, 'connected_organization_id cannot be nil'
181
+ end
182
+
183
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
184
+ if connected_organization_id !~ pattern
185
+ fail ArgumentError, "invalid value for \"connected_organization_id\", must conform to the pattern #{pattern}."
186
+ end
187
+
188
+ @connected_organization_id = connected_organization_id
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ id == o.id &&
197
+ external_name == o.external_name &&
198
+ external_email == o.external_email &&
199
+ created_at == o.created_at &&
200
+ connected_organization_id == o.connected_organization_id &&
201
+ member == o.member
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Integer] Hash code
212
+ def hash
213
+ [id, external_name, external_email, created_at, connected_organization_id, member].hash
214
+ end
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 self.build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ attributes = attributes.transform_keys(&:to_sym)
222
+ transformed_hash = {}
223
+ openapi_types.each_pair do |key, type|
224
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = nil
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[attribute_map[key]].is_a?(Array)
230
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
231
+ end
232
+ elsif !attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
234
+ end
235
+ end
236
+ new(transformed_hash)
237
+ end
238
+
239
+ # Deserializes the data based on type
240
+ # @param string type Data type
241
+ # @param string value Value to be deserialized
242
+ # @return [Object] Deserialized data
243
+ def self._deserialize(type, value)
244
+ case type.to_sym
245
+ when :Time
246
+ Time.parse(value)
247
+ when :Date
248
+ Date.parse(value)
249
+ when :String
250
+ value.to_s
251
+ when :Integer
252
+ value.to_i
253
+ when :Float
254
+ value.to_f
255
+ when :Boolean
256
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
257
+ true
258
+ else
259
+ false
260
+ end
261
+ when :Object
262
+ # generic object (usually a Hash), return directly
263
+ value
264
+ when /\AArray<(?<inner_type>.+)>\z/
265
+ inner_type = Regexp.last_match[:inner_type]
266
+ value.map { |v| _deserialize(inner_type, v) }
267
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
268
+ k_type = Regexp.last_match[:k_type]
269
+ v_type = Regexp.last_match[:v_type]
270
+ {}.tap do |hash|
271
+ value.each do |k, v|
272
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
273
+ end
274
+ end
275
+ else # model
276
+ # models (e.g. Pet) or oneOf
277
+ klass = Tremendous.const_get(type)
278
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ if value.nil?
301
+ is_nullable = self.class.openapi_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
314
+ def _to_hash(value)
315
+ if value.is_a?(Array)
316
+ value.compact.map { |v| _to_hash(v) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash
323
+ else
324
+ value
325
+ end
326
+ end
327
+
328
+ end
329
+
330
+ end