tremendous_ruby 5.12.0 → 5.14.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.
- checksums.yaml +4 -4
- data/lib/tremendous/api/tremendous_api.rb +202 -9
- data/lib/tremendous/models/allow_email.rb +9 -0
- data/lib/tremendous/models/allow_email1.rb +9 -0
- data/lib/tremendous/models/allow_ip.rb +9 -0
- data/lib/tremendous/models/allow_ip1.rb +9 -0
- data/lib/tremendous/models/create_invoice_request.rb +48 -2
- data/lib/tremendous/models/create_topup200_response.rb +220 -0
- data/lib/tremendous/models/create_topup_request.rb +292 -0
- data/lib/tremendous/models/custom_field.rb +1 -1
- data/lib/tremendous/models/fraud_config_allow_email.rb +9 -0
- data/lib/tremendous/models/fraud_config_ip.rb +9 -0
- data/lib/tremendous/models/fraud_config_review_email.rb +19 -0
- data/lib/tremendous/models/fraud_review.rb +66 -56
- data/lib/tremendous/models/fraud_review_base.rb +358 -0
- data/lib/tremendous/models/fraud_review_list_item.rb +85 -4
- data/lib/tremendous/models/fraud_review_redemption_method.rb +7 -5
- data/lib/tremendous/models/funding_source.rb +3 -3
- data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +66 -56
- data/lib/tremendous/models/invoice.rb +26 -2
- data/lib/tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner.rb +85 -4
- data/lib/tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner_geo.rb +242 -0
- data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +3 -3
- data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +7 -2
- data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +26 -2
- data/lib/tremendous/models/list_products_response_products_inner.rb +24 -2
- data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +1 -1
- data/lib/tremendous/models/list_topups200_response.rb +232 -0
- data/lib/tremendous/models/list_topups200_response_topups_inner.rb +326 -0
- data/lib/tremendous/models/product.rb +24 -2
- data/lib/tremendous/models/review_email.rb +19 -0
- data/lib/tremendous/models/review_email1.rb +19 -0
- data/lib/tremendous/models/review_ip.rb +9 -0
- data/lib/tremendous/models/review_ip1.rb +9 -0
- data/lib/tremendous/models/reward_base_custom_fields_inner.rb +1 -1
- data/lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb +1 -1
- data/lib/tremendous/models/topup.rb +326 -0
- data/lib/tremendous/models/topup_create_request.rb +292 -0
- data/lib/tremendous/version.rb +1 -1
- data/lib/tremendous.rb +8 -1
- metadata +9 -1
|
@@ -88,6 +88,10 @@ module Tremendous
|
|
|
88
88
|
def list_invalid_properties
|
|
89
89
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
90
90
|
invalid_properties = Array.new
|
|
91
|
+
if !@emails.nil? && @emails.length > 50000
|
|
92
|
+
invalid_properties.push('invalid value for "emails", number of items must be less than or equal to 50000.')
|
|
93
|
+
end
|
|
94
|
+
|
|
91
95
|
invalid_properties
|
|
92
96
|
end
|
|
93
97
|
|
|
@@ -95,9 +99,24 @@ module Tremendous
|
|
|
95
99
|
# @return true if the model is valid
|
|
96
100
|
def valid?
|
|
97
101
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
102
|
+
return false if !@emails.nil? && @emails.length > 50000
|
|
98
103
|
true
|
|
99
104
|
end
|
|
100
105
|
|
|
106
|
+
# Custom attribute writer method with validation
|
|
107
|
+
# @param [Object] emails Value to be assigned
|
|
108
|
+
def emails=(emails)
|
|
109
|
+
if emails.nil?
|
|
110
|
+
fail ArgumentError, 'emails cannot be nil'
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if emails.length > 50000
|
|
114
|
+
fail ArgumentError, 'invalid value for "emails", number of items must be less than or equal to 50000.'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
@emails = emails
|
|
118
|
+
end
|
|
119
|
+
|
|
101
120
|
# Checks equality by comparing each attribute.
|
|
102
121
|
# @param [Object] Object to be compared
|
|
103
122
|
def ==(o)
|
|
@@ -83,6 +83,10 @@ module Tremendous
|
|
|
83
83
|
invalid_properties.push('invalid value for "ips", ips cannot be nil.')
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
if @ips.length > 50000
|
|
87
|
+
invalid_properties.push('invalid value for "ips", number of items must be less than or equal to 50000.')
|
|
88
|
+
end
|
|
89
|
+
|
|
86
90
|
invalid_properties
|
|
87
91
|
end
|
|
88
92
|
|
|
@@ -91,6 +95,7 @@ module Tremendous
|
|
|
91
95
|
def valid?
|
|
92
96
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
93
97
|
return false if @ips.nil?
|
|
98
|
+
return false if @ips.length > 50000
|
|
94
99
|
true
|
|
95
100
|
end
|
|
96
101
|
|
|
@@ -101,6 +106,10 @@ module Tremendous
|
|
|
101
106
|
fail ArgumentError, 'ips cannot be nil'
|
|
102
107
|
end
|
|
103
108
|
|
|
109
|
+
if ips.length > 50000
|
|
110
|
+
fail ArgumentError, 'invalid value for "ips", number of items must be less than or equal to 50000.'
|
|
111
|
+
end
|
|
112
|
+
|
|
104
113
|
@ips = ips
|
|
105
114
|
end
|
|
106
115
|
|
|
@@ -83,6 +83,10 @@ module Tremendous
|
|
|
83
83
|
invalid_properties.push('invalid value for "ips", ips cannot be nil.')
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
if @ips.length > 50000
|
|
87
|
+
invalid_properties.push('invalid value for "ips", number of items must be less than or equal to 50000.')
|
|
88
|
+
end
|
|
89
|
+
|
|
86
90
|
invalid_properties
|
|
87
91
|
end
|
|
88
92
|
|
|
@@ -91,6 +95,7 @@ module Tremendous
|
|
|
91
95
|
def valid?
|
|
92
96
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
93
97
|
return false if @ips.nil?
|
|
98
|
+
return false if @ips.length > 50000
|
|
94
99
|
true
|
|
95
100
|
end
|
|
96
101
|
|
|
@@ -101,6 +106,10 @@ module Tremendous
|
|
|
101
106
|
fail ArgumentError, 'ips cannot be nil'
|
|
102
107
|
end
|
|
103
108
|
|
|
109
|
+
if ips.length > 50000
|
|
110
|
+
fail ArgumentError, 'invalid value for "ips", number of items must be less than or equal to 50000.'
|
|
111
|
+
end
|
|
112
|
+
|
|
104
113
|
@ips = ips
|
|
105
114
|
end
|
|
106
115
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Tremendous
|
|
17
|
-
# Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/
|
|
17
|
+
# Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/docs/using-custom-fields-to-add-custom-data-to-rewards).)
|
|
18
18
|
class RewardBaseCustomFieldsInner
|
|
19
19
|
# Tremendous ID of the custom field
|
|
20
20
|
attr_accessor :id
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Tremendous
|
|
17
|
-
# Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/
|
|
17
|
+
# Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/docs/using-custom-fields-to-add-custom-data-to-rewards).)
|
|
18
18
|
class SingleRewardOrderRewardCustomFieldsInner
|
|
19
19
|
# Tremendous ID of the custom field
|
|
20
20
|
attr_accessor :id
|
|
@@ -0,0 +1,326 @@
|
|
|
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.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Tremendous
|
|
17
|
+
class Topup
|
|
18
|
+
# Unique identifier for the topup request.
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# Amount in USD intended to be added to your organization’s balance.
|
|
22
|
+
attr_accessor :amount
|
|
23
|
+
|
|
24
|
+
# Amount of the processing fee for the topup (typically reserved for credit card topups).
|
|
25
|
+
attr_accessor :processing_fee
|
|
26
|
+
|
|
27
|
+
# ID of the funding_source object used for this topup.
|
|
28
|
+
attr_accessor :funding_source_id
|
|
29
|
+
|
|
30
|
+
# Status of the topup <table> <thead> <tr> <th> Status </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <code> created </code> </td> <td> The topup is processing (and may be under review). </td> </tr> <tr> <td> <code> fully_credited </code> </td> <td> The funds have been added to the balance. </td> </tr> <tr> <td> <code> reversed </code> </td> <td> The topup was credited, but then reversed due to a chargeback or ACH return. </td> </tr> <tr> <td> <code> rejected </code> </td> <td> The topup was rejected by an admin. </td> </tr> </tbody> </table>
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
|
|
33
|
+
# Timestamp indicating when the topup object was created (when the request was made).
|
|
34
|
+
attr_accessor :created_at
|
|
35
|
+
|
|
36
|
+
# Timestamp indicating when the topup amount was fully credited to the balance.
|
|
37
|
+
attr_accessor :fully_credited_at
|
|
38
|
+
|
|
39
|
+
# Timestamp indicating when the topup was rejected.
|
|
40
|
+
attr_accessor :rejected_at
|
|
41
|
+
|
|
42
|
+
# Timestamp indicating when the topup was reversed.
|
|
43
|
+
attr_accessor :reversed_at
|
|
44
|
+
|
|
45
|
+
# A sentence explaining why the topup was reversed.
|
|
46
|
+
attr_accessor :reversed_reason
|
|
47
|
+
|
|
48
|
+
# Idempotency key to prevent duplicate requests.
|
|
49
|
+
attr_accessor :idempotency_key
|
|
50
|
+
|
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
|
+
def self.attribute_map
|
|
53
|
+
{
|
|
54
|
+
:'id' => :'id',
|
|
55
|
+
:'amount' => :'amount',
|
|
56
|
+
:'processing_fee' => :'processing_fee',
|
|
57
|
+
:'funding_source_id' => :'funding_source_id',
|
|
58
|
+
:'status' => :'status',
|
|
59
|
+
:'created_at' => :'created_at',
|
|
60
|
+
:'fully_credited_at' => :'fully_credited_at',
|
|
61
|
+
:'rejected_at' => :'rejected_at',
|
|
62
|
+
:'reversed_at' => :'reversed_at',
|
|
63
|
+
:'reversed_reason' => :'reversed_reason',
|
|
64
|
+
:'idempotency_key' => :'idempotency_key'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Returns attribute mapping this model knows about
|
|
69
|
+
def self.acceptable_attribute_map
|
|
70
|
+
attribute_map
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Returns all the JSON keys this model knows about
|
|
74
|
+
def self.acceptable_attributes
|
|
75
|
+
acceptable_attribute_map.values
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Attribute type mapping.
|
|
79
|
+
def self.openapi_types
|
|
80
|
+
{
|
|
81
|
+
:'id' => :'String',
|
|
82
|
+
:'amount' => :'Float',
|
|
83
|
+
:'processing_fee' => :'Float',
|
|
84
|
+
:'funding_source_id' => :'String',
|
|
85
|
+
:'status' => :'String',
|
|
86
|
+
:'created_at' => :'Time',
|
|
87
|
+
:'fully_credited_at' => :'Time',
|
|
88
|
+
:'rejected_at' => :'Time',
|
|
89
|
+
:'reversed_at' => :'Time',
|
|
90
|
+
:'reversed_reason' => :'String',
|
|
91
|
+
:'idempotency_key' => :'String'
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# List of attributes with nullable: true
|
|
96
|
+
def self.openapi_nullable
|
|
97
|
+
Set.new([
|
|
98
|
+
:'fully_credited_at',
|
|
99
|
+
:'rejected_at',
|
|
100
|
+
:'reversed_at',
|
|
101
|
+
:'reversed_reason',
|
|
102
|
+
:'idempotency_key'
|
|
103
|
+
])
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Initializes the object
|
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
108
|
+
def initialize(attributes = {})
|
|
109
|
+
if (!attributes.is_a?(Hash))
|
|
110
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Topup` initialize method"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
114
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
116
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
117
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Topup`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
118
|
+
end
|
|
119
|
+
h[k.to_sym] = v
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'id')
|
|
123
|
+
self.id = attributes[:'id']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'amount')
|
|
127
|
+
self.amount = attributes[:'amount']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'processing_fee')
|
|
131
|
+
self.processing_fee = attributes[:'processing_fee']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'funding_source_id')
|
|
135
|
+
self.funding_source_id = attributes[:'funding_source_id']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'status')
|
|
139
|
+
self.status = attributes[:'status']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'created_at')
|
|
143
|
+
self.created_at = attributes[:'created_at']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'fully_credited_at')
|
|
147
|
+
self.fully_credited_at = attributes[:'fully_credited_at']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'rejected_at')
|
|
151
|
+
self.rejected_at = attributes[:'rejected_at']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'reversed_at')
|
|
155
|
+
self.reversed_at = attributes[:'reversed_at']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'reversed_reason')
|
|
159
|
+
self.reversed_reason = attributes[:'reversed_reason']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'idempotency_key')
|
|
163
|
+
self.idempotency_key = attributes[:'idempotency_key']
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
168
|
+
# @return Array for valid properties with the reasons
|
|
169
|
+
def list_invalid_properties
|
|
170
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
171
|
+
invalid_properties = Array.new
|
|
172
|
+
invalid_properties
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Check to see if the all the properties in the model are valid
|
|
176
|
+
# @return true if the model is valid
|
|
177
|
+
def valid?
|
|
178
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
179
|
+
true
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Checks equality by comparing each attribute.
|
|
183
|
+
# @param [Object] Object to be compared
|
|
184
|
+
def ==(o)
|
|
185
|
+
return true if self.equal?(o)
|
|
186
|
+
self.class == o.class &&
|
|
187
|
+
id == o.id &&
|
|
188
|
+
amount == o.amount &&
|
|
189
|
+
processing_fee == o.processing_fee &&
|
|
190
|
+
funding_source_id == o.funding_source_id &&
|
|
191
|
+
status == o.status &&
|
|
192
|
+
created_at == o.created_at &&
|
|
193
|
+
fully_credited_at == o.fully_credited_at &&
|
|
194
|
+
rejected_at == o.rejected_at &&
|
|
195
|
+
reversed_at == o.reversed_at &&
|
|
196
|
+
reversed_reason == o.reversed_reason &&
|
|
197
|
+
idempotency_key == o.idempotency_key
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# @see the `==` method
|
|
201
|
+
# @param [Object] Object to be compared
|
|
202
|
+
def eql?(o)
|
|
203
|
+
self == o
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Calculates hash code according to all attributes.
|
|
207
|
+
# @return [Integer] Hash code
|
|
208
|
+
def hash
|
|
209
|
+
[id, amount, processing_fee, funding_source_id, status, created_at, fully_credited_at, rejected_at, reversed_at, reversed_reason, idempotency_key].hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Builds the object from hash
|
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
214
|
+
# @return [Object] Returns the model itself
|
|
215
|
+
def self.build_from_hash(attributes)
|
|
216
|
+
return nil unless attributes.is_a?(Hash)
|
|
217
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
218
|
+
transformed_hash = {}
|
|
219
|
+
openapi_types.each_pair do |key, type|
|
|
220
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
221
|
+
transformed_hash["#{key}"] = nil
|
|
222
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
223
|
+
# check to ensure the input is an array given that the attribute
|
|
224
|
+
# is documented as an array but the input is not
|
|
225
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
226
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
227
|
+
end
|
|
228
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
229
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
new(transformed_hash)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Deserializes the data based on type
|
|
236
|
+
# @param string type Data type
|
|
237
|
+
# @param string value Value to be deserialized
|
|
238
|
+
# @return [Object] Deserialized data
|
|
239
|
+
def self._deserialize(type, value)
|
|
240
|
+
case type.to_sym
|
|
241
|
+
when :Time
|
|
242
|
+
Time.parse(value)
|
|
243
|
+
when :Date
|
|
244
|
+
Date.parse(value)
|
|
245
|
+
when :String
|
|
246
|
+
value.to_s
|
|
247
|
+
when :Integer
|
|
248
|
+
value.to_i
|
|
249
|
+
when :Float
|
|
250
|
+
value.to_f
|
|
251
|
+
when :Boolean
|
|
252
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
253
|
+
true
|
|
254
|
+
else
|
|
255
|
+
false
|
|
256
|
+
end
|
|
257
|
+
when :Object
|
|
258
|
+
# generic object (usually a Hash), return directly
|
|
259
|
+
value
|
|
260
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
261
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
262
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
263
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
264
|
+
k_type = Regexp.last_match[:k_type]
|
|
265
|
+
v_type = Regexp.last_match[:v_type]
|
|
266
|
+
{}.tap do |hash|
|
|
267
|
+
value.each do |k, v|
|
|
268
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
else # model
|
|
272
|
+
# models (e.g. Pet) or oneOf
|
|
273
|
+
klass = Tremendous.const_get(type)
|
|
274
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Returns the string representation of the object
|
|
279
|
+
# @return [String] String presentation of the object
|
|
280
|
+
def to_s
|
|
281
|
+
to_hash.to_s
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
|
286
|
+
def to_body
|
|
287
|
+
to_hash
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Returns the object in the form of hash
|
|
291
|
+
# @return [Hash] Returns the object in the form of hash
|
|
292
|
+
def to_hash
|
|
293
|
+
hash = {}
|
|
294
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
295
|
+
value = self.send(attr)
|
|
296
|
+
if value.nil?
|
|
297
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
298
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
hash[param] = _to_hash(value)
|
|
302
|
+
end
|
|
303
|
+
hash
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Outputs non-array value in the form of hash
|
|
307
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
308
|
+
# @param [Object] value Any valid value
|
|
309
|
+
# @return [Hash] Returns the value in the form of hash
|
|
310
|
+
def _to_hash(value)
|
|
311
|
+
if value.is_a?(Array)
|
|
312
|
+
value.compact.map { |v| _to_hash(v) }
|
|
313
|
+
elsif value.is_a?(Hash)
|
|
314
|
+
{}.tap do |hash|
|
|
315
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
316
|
+
end
|
|
317
|
+
elsif value.respond_to? :to_hash
|
|
318
|
+
value.to_hash
|
|
319
|
+
else
|
|
320
|
+
value
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
end
|