tremendous_ruby 5.5.0 → 5.7.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +54 -256
  3. data/lib/tremendous/models/base_order_for_create.rb +1 -1
  4. data/lib/tremendous/models/create_order200_response.rb +1 -1
  5. data/lib/tremendous/models/create_order200_response_order.rb +403 -0
  6. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +326 -0
  7. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  8. data/lib/tremendous/models/{create_public_key_request.rb → create_order201_response.rb} +14 -15
  9. data/lib/tremendous/models/create_order_request.rb +1 -1
  10. data/lib/tremendous/models/create_organization.rb +51 -4
  11. data/lib/tremendous/models/create_organization200_response_organization.rb +20 -45
  12. data/lib/tremendous/models/{public_keys_response_public_keys_inner.rb → create_organization_for_response.rb} +72 -20
  13. data/lib/tremendous/models/{public_key.rb → create_organization_properties.rb} +57 -20
  14. data/lib/tremendous/models/create_organization_request.rb +7 -0
  15. data/lib/tremendous/models/create_report201_response.rb +231 -0
  16. data/lib/tremendous/models/create_report201_response_report.rb +291 -0
  17. data/lib/tremendous/models/create_report_request.rb +295 -0
  18. data/lib/tremendous/models/{create_public_key200_response.rb → create_report_request_filters.rb} +12 -17
  19. data/lib/tremendous/models/{create_invoice.rb → create_report_request_filters_digital_rewards.rb} +128 -32
  20. data/lib/tremendous/models/{create_public_key.rb → create_report_request_filters_digital_rewards_amount.rb} +22 -18
  21. data/lib/tremendous/models/{public_keys_response.rb → create_report_request_filters_digital_rewards_created_at.rb} +22 -19
  22. data/lib/tremendous/models/delivery_details.rb +0 -14
  23. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  24. data/lib/tremendous/models/error_model.rb +11 -1
  25. data/lib/tremendous/models/fraud_rule400_response.rb +11 -1
  26. data/lib/tremendous/models/fraud_rule422_response.rb +11 -1
  27. data/lib/tremendous/models/fraud_rules_list_item.rb +4 -2
  28. data/lib/tremendous/models/generate_reward_link403_response.rb +11 -1
  29. data/lib/tremendous/models/invoice.rb +10 -1
  30. data/lib/tremendous/models/list_fraud_reviews200_response.rb +21 -4
  31. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -2
  32. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +37 -7
  33. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +225 -0
  34. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +10 -1
  35. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +4 -48
  36. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +0 -14
  37. data/lib/tremendous/models/list_rewards401_response.rb +11 -1
  38. data/lib/tremendous/models/list_rewards401_response_errors.rb +4 -2
  39. data/lib/tremendous/models/list_rewards429_response.rb +11 -1
  40. data/lib/tremendous/models/order_base_payment.rb +4 -48
  41. data/lib/tremendous/models/order_with_link.rb +403 -0
  42. data/lib/tremendous/models/order_with_link_rewards_inner.rb +385 -0
  43. data/lib/tremendous/models/payment_details.rb +4 -48
  44. data/lib/tremendous/models/payout.rb +352 -0
  45. data/lib/tremendous/models/report.rb +291 -0
  46. data/lib/tremendous/models/resend_reward422_response.rb +11 -1
  47. data/lib/tremendous/models/resend_reward_request.rb +225 -0
  48. data/lib/tremendous/models/reward_for_order_create.rb +1 -1
  49. data/lib/tremendous/models/{single_reward_order1_reward.rb → reward_with_link.rb} +78 -16
  50. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  51. data/lib/tremendous/models/reward_without_link_delivery.rb +0 -14
  52. data/lib/tremendous/models/single_reward_order.rb +1 -1
  53. data/lib/tremendous/models/{single_reward_order1_payment.rb → single_reward_order_payment.rb} +3 -3
  54. data/lib/tremendous/models/single_reward_order_reward.rb +3 -75
  55. data/lib/tremendous/models/{single_reward_order1_reward_custom_fields_inner.rb → single_reward_order_reward_custom_fields_inner.rb} +3 -3
  56. data/lib/tremendous/models/{single_reward_order1_reward_delivery.rb → single_reward_order_reward_delivery.rb} +3 -3
  57. data/lib/tremendous/models/{test_public_key.rb → single_reward_order_with_link.rb} +14 -15
  58. data/lib/tremendous/models/single_reward_order_with_link_order.rb +403 -0
  59. data/lib/tremendous/version.rb +1 -1
  60. data/lib/tremendous.rb +27 -14
  61. metadata +29 -16
  62. data/lib/tremendous/models/single_reward_order1.rb +0 -242
  63. data/lib/tremendous/models/test_public_key_request.rb +0 -222
@@ -91,6 +91,8 @@ module Tremendous
91
91
 
92
92
  if attributes.key?(:'with_api_key')
93
93
  self.with_api_key = attributes[:'with_api_key']
94
+ else
95
+ self.with_api_key = nil
94
96
  end
95
97
 
96
98
  if attributes.key?(:'copy_settings')
@@ -115,6 +117,10 @@ module Tremendous
115
117
  invalid_properties.push('invalid value for "website", website cannot be nil.')
116
118
  end
117
119
 
120
+ if @with_api_key.nil?
121
+ invalid_properties.push('invalid value for "with_api_key", with_api_key cannot be nil.')
122
+ end
123
+
118
124
  invalid_properties
119
125
  end
120
126
 
@@ -124,6 +130,7 @@ module Tremendous
124
130
  warn '[DEPRECATED] the `valid?` method is obsolete'
125
131
  return false if @name.nil?
126
132
  return false if @website.nil?
133
+ return false if @with_api_key.nil?
127
134
  true
128
135
  end
129
136
 
@@ -0,0 +1,231 @@
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 it's 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 CreateReport201Response
18
+ attr_accessor :report
19
+
20
+ # Report status message
21
+ attr_accessor :message
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'report' => :'report',
27
+ :'message' => :'message'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'report' => :'CreateReport201ResponseReport',
40
+ :'message' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateReport201Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateReport201Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'report')
66
+ self.report = attributes[:'report']
67
+ else
68
+ self.report = nil
69
+ end
70
+
71
+ if attributes.key?(:'message')
72
+ self.message = attributes[:'message']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
+ invalid_properties = Array.new
81
+ if @report.nil?
82
+ invalid_properties.push('invalid value for "report", report cannot be nil.')
83
+ end
84
+
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ return false if @report.nil?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ report == o.report &&
102
+ message == o.message
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [report, message].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def self._deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = Tremendous.const_get(type)
179
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,291 @@
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 it's 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
+ # Reports represent a collection of your Tremendous data that can be filtered and downloaded. The report object that is returned has a unique ID, a status, and an predicted time of report generation completion. When the report generation is complete, it will also contain an expiring url where you can retrieve your report.
18
+ class CreateReport201ResponseReport
19
+ # Tremendous ID of the report, used to retrieve your report
20
+ attr_accessor :id
21
+
22
+ # Status of this report <table> <thead> <tr> <th>Status</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>CREATED</code></td> <td>Report has been created</td> </tr> <tr> <td><code>PROCESSING</code></td> <td>Report is currently being generated</td> </tr> <tr> <td><code>READY_FOR_DOWNLOAD</code></td> <td>Report generation is complete and ready for download</td> </tr> <tr> <td><code>FAILED</code></td> <td>Report failed to generate</td> </tr> </tbody> </table>
23
+ attr_accessor :status
24
+
25
+ # Timestamp of when the report was created
26
+ attr_accessor :created_at
27
+
28
+ # Timestamp of when the report is expected to finish generating. If the report if complete, this will return the time the report completed generating at.
29
+ attr_accessor :expected_completion_at
30
+
31
+ # URL to download the report. Only returned when the report generation is complete and report is ready for download. URL is valid for 7 days from generation completion
32
+ attr_accessor :url
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'id' => :'id',
60
+ :'status' => :'status',
61
+ :'created_at' => :'created_at',
62
+ :'expected_completion_at' => :'expected_completion_at',
63
+ :'url' => :'url'
64
+ }
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'id' => :'String',
76
+ :'status' => :'String',
77
+ :'created_at' => :'Time',
78
+ :'expected_completion_at' => :'Time',
79
+ :'url' => :'String'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ :'url'
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateReport201ResponseReport` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateReport201ResponseReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'id')
106
+ self.id = attributes[:'id']
107
+ end
108
+
109
+ if attributes.key?(:'status')
110
+ self.status = attributes[:'status']
111
+ end
112
+
113
+ if attributes.key?(:'created_at')
114
+ self.created_at = attributes[:'created_at']
115
+ end
116
+
117
+ if attributes.key?(:'expected_completion_at')
118
+ self.expected_completion_at = attributes[:'expected_completion_at']
119
+ end
120
+
121
+ if attributes.key?(:'url')
122
+ self.url = attributes[:'url']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ warn '[DEPRECATED] the `valid?` method is obsolete'
138
+ status_validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "READY_FOR_DOWNLOAD", "FAILED"])
139
+ return false unless status_validator.valid?(@status)
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method checking allowed values (enum).
144
+ # @param [Object] status Object to be assigned
145
+ def status=(status)
146
+ validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "READY_FOR_DOWNLOAD", "FAILED"])
147
+ unless validator.valid?(status)
148
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
149
+ end
150
+ @status = status
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ id == o.id &&
159
+ status == o.status &&
160
+ created_at == o.created_at &&
161
+ expected_completion_at == o.expected_completion_at &&
162
+ url == o.url
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [id, status, created_at, expected_completion_at, url].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ attributes = attributes.transform_keys(&:to_sym)
183
+ transformed_hash = {}
184
+ openapi_types.each_pair do |key, type|
185
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = nil
187
+ elsif type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[attribute_map[key]].is_a?(Array)
191
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
192
+ end
193
+ elsif !attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
195
+ end
196
+ end
197
+ new(transformed_hash)
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def self._deserialize(type, value)
205
+ case type.to_sym
206
+ when :Time
207
+ Time.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :Boolean
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ # models (e.g. Pet) or oneOf
238
+ klass = Tremendous.const_get(type)
239
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
240
+ end
241
+ end
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
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ # Outputs non-array value in the form of hash
272
+ # For object, use to_hash. Otherwise, just return the value
273
+ # @param [Object] value Any valid value
274
+ # @return [Hash] Returns the value in the form of hash
275
+ def _to_hash(value)
276
+ if value.is_a?(Array)
277
+ value.compact.map { |v| _to_hash(v) }
278
+ elsif value.is_a?(Hash)
279
+ {}.tap do |hash|
280
+ value.each { |k, v| hash[k] = _to_hash(v) }
281
+ end
282
+ elsif value.respond_to? :to_hash
283
+ value.to_hash
284
+ else
285
+ value
286
+ end
287
+ end
288
+
289
+ end
290
+
291
+ end