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.
- checksums.yaml +4 -4
- data/lib/tremendous/api/tremendous_api.rb +54 -256
- data/lib/tremendous/models/base_order_for_create.rb +1 -1
- data/lib/tremendous/models/create_order200_response.rb +1 -1
- data/lib/tremendous/models/create_order200_response_order.rb +403 -0
- data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +326 -0
- data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
- data/lib/tremendous/models/{create_public_key_request.rb → create_order201_response.rb} +14 -15
- data/lib/tremendous/models/create_order_request.rb +1 -1
- data/lib/tremendous/models/create_organization.rb +51 -4
- data/lib/tremendous/models/create_organization200_response_organization.rb +20 -45
- data/lib/tremendous/models/{public_keys_response_public_keys_inner.rb → create_organization_for_response.rb} +72 -20
- data/lib/tremendous/models/{public_key.rb → create_organization_properties.rb} +57 -20
- data/lib/tremendous/models/create_organization_request.rb +7 -0
- data/lib/tremendous/models/create_report201_response.rb +231 -0
- data/lib/tremendous/models/create_report201_response_report.rb +291 -0
- data/lib/tremendous/models/create_report_request.rb +295 -0
- data/lib/tremendous/models/{create_public_key200_response.rb → create_report_request_filters.rb} +12 -17
- data/lib/tremendous/models/{create_invoice.rb → create_report_request_filters_digital_rewards.rb} +128 -32
- data/lib/tremendous/models/{create_public_key.rb → create_report_request_filters_digital_rewards_amount.rb} +22 -18
- data/lib/tremendous/models/{public_keys_response.rb → create_report_request_filters_digital_rewards_created_at.rb} +22 -19
- data/lib/tremendous/models/delivery_details.rb +0 -14
- data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
- data/lib/tremendous/models/error_model.rb +11 -1
- data/lib/tremendous/models/fraud_rule400_response.rb +11 -1
- data/lib/tremendous/models/fraud_rule422_response.rb +11 -1
- data/lib/tremendous/models/fraud_rules_list_item.rb +4 -2
- data/lib/tremendous/models/generate_reward_link403_response.rb +11 -1
- data/lib/tremendous/models/invoice.rb +10 -1
- data/lib/tremendous/models/list_fraud_reviews200_response.rb +21 -4
- data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -2
- data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +37 -7
- data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +225 -0
- data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +10 -1
- data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +4 -48
- data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +0 -14
- data/lib/tremendous/models/list_rewards401_response.rb +11 -1
- data/lib/tremendous/models/list_rewards401_response_errors.rb +4 -2
- data/lib/tremendous/models/list_rewards429_response.rb +11 -1
- data/lib/tremendous/models/order_base_payment.rb +4 -48
- data/lib/tremendous/models/order_with_link.rb +403 -0
- data/lib/tremendous/models/order_with_link_rewards_inner.rb +385 -0
- data/lib/tremendous/models/payment_details.rb +4 -48
- data/lib/tremendous/models/payout.rb +352 -0
- data/lib/tremendous/models/report.rb +291 -0
- data/lib/tremendous/models/resend_reward422_response.rb +11 -1
- data/lib/tremendous/models/resend_reward_request.rb +225 -0
- data/lib/tremendous/models/reward_for_order_create.rb +1 -1
- data/lib/tremendous/models/{single_reward_order1_reward.rb → reward_with_link.rb} +78 -16
- data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
- data/lib/tremendous/models/reward_without_link_delivery.rb +0 -14
- data/lib/tremendous/models/single_reward_order.rb +1 -1
- data/lib/tremendous/models/{single_reward_order1_payment.rb → single_reward_order_payment.rb} +3 -3
- data/lib/tremendous/models/single_reward_order_reward.rb +3 -75
- data/lib/tremendous/models/{single_reward_order1_reward_custom_fields_inner.rb → single_reward_order_reward_custom_fields_inner.rb} +3 -3
- data/lib/tremendous/models/{single_reward_order1_reward_delivery.rb → single_reward_order_reward_delivery.rb} +3 -3
- data/lib/tremendous/models/{test_public_key.rb → single_reward_order_with_link.rb} +14 -15
- data/lib/tremendous/models/single_reward_order_with_link_order.rb +403 -0
- data/lib/tremendous/version.rb +1 -1
- data/lib/tremendous.rb +27 -14
- metadata +29 -16
- data/lib/tremendous/models/single_reward_order1.rb +0 -242
- data/lib/tremendous/models/test_public_key_request.rb +0 -222
@@ -1,242 +0,0 @@
|
|
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
|
-
# An order that contains a single reward. The reward is sent to a single recipient.
|
18
|
-
class SingleRewardOrder1
|
19
|
-
# Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
|
20
|
-
attr_accessor :external_id
|
21
|
-
|
22
|
-
attr_accessor :payment
|
23
|
-
|
24
|
-
attr_accessor :reward
|
25
|
-
|
26
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
-
def self.attribute_map
|
28
|
-
{
|
29
|
-
:'external_id' => :'external_id',
|
30
|
-
:'payment' => :'payment',
|
31
|
-
:'reward' => :'reward'
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
# Returns all the JSON keys this model knows about
|
36
|
-
def self.acceptable_attributes
|
37
|
-
attribute_map.values
|
38
|
-
end
|
39
|
-
|
40
|
-
# Attribute type mapping.
|
41
|
-
def self.openapi_types
|
42
|
-
{
|
43
|
-
:'external_id' => :'String',
|
44
|
-
:'payment' => :'SingleRewardOrder1Payment',
|
45
|
-
:'reward' => :'SingleRewardOrder1Reward'
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
# List of attributes with nullable: true
|
50
|
-
def self.openapi_nullable
|
51
|
-
Set.new([
|
52
|
-
:'external_id',
|
53
|
-
])
|
54
|
-
end
|
55
|
-
|
56
|
-
# Initializes the object
|
57
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
-
def initialize(attributes = {})
|
59
|
-
if (!attributes.is_a?(Hash))
|
60
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1` initialize method"
|
61
|
-
end
|
62
|
-
|
63
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
67
|
-
end
|
68
|
-
h[k.to_sym] = v
|
69
|
-
}
|
70
|
-
|
71
|
-
if attributes.key?(:'external_id')
|
72
|
-
self.external_id = attributes[:'external_id']
|
73
|
-
end
|
74
|
-
|
75
|
-
if attributes.key?(:'payment')
|
76
|
-
self.payment = attributes[:'payment']
|
77
|
-
end
|
78
|
-
|
79
|
-
if attributes.key?(:'reward')
|
80
|
-
self.reward = attributes[:'reward']
|
81
|
-
else
|
82
|
-
self.reward = nil
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
-
# @return Array for valid properties with the reasons
|
88
|
-
def list_invalid_properties
|
89
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
90
|
-
invalid_properties = Array.new
|
91
|
-
if @reward.nil?
|
92
|
-
invalid_properties.push('invalid value for "reward", reward cannot be nil.')
|
93
|
-
end
|
94
|
-
|
95
|
-
invalid_properties
|
96
|
-
end
|
97
|
-
|
98
|
-
# Check to see if the all the properties in the model are valid
|
99
|
-
# @return true if the model is valid
|
100
|
-
def valid?
|
101
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
102
|
-
return false if @reward.nil?
|
103
|
-
true
|
104
|
-
end
|
105
|
-
|
106
|
-
# Checks equality by comparing each attribute.
|
107
|
-
# @param [Object] Object to be compared
|
108
|
-
def ==(o)
|
109
|
-
return true if self.equal?(o)
|
110
|
-
self.class == o.class &&
|
111
|
-
external_id == o.external_id &&
|
112
|
-
payment == o.payment &&
|
113
|
-
reward == o.reward
|
114
|
-
end
|
115
|
-
|
116
|
-
# @see the `==` method
|
117
|
-
# @param [Object] Object to be compared
|
118
|
-
def eql?(o)
|
119
|
-
self == o
|
120
|
-
end
|
121
|
-
|
122
|
-
# Calculates hash code according to all attributes.
|
123
|
-
# @return [Integer] Hash code
|
124
|
-
def hash
|
125
|
-
[external_id, payment, reward].hash
|
126
|
-
end
|
127
|
-
|
128
|
-
# Builds the object from hash
|
129
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
130
|
-
# @return [Object] Returns the model itself
|
131
|
-
def self.build_from_hash(attributes)
|
132
|
-
return nil unless attributes.is_a?(Hash)
|
133
|
-
attributes = attributes.transform_keys(&:to_sym)
|
134
|
-
transformed_hash = {}
|
135
|
-
openapi_types.each_pair do |key, type|
|
136
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
137
|
-
transformed_hash["#{key}"] = nil
|
138
|
-
elsif type =~ /\AArray<(.*)>/i
|
139
|
-
# check to ensure the input is an array given that the attribute
|
140
|
-
# is documented as an array but the input is not
|
141
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
142
|
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
143
|
-
end
|
144
|
-
elsif !attributes[attribute_map[key]].nil?
|
145
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
146
|
-
end
|
147
|
-
end
|
148
|
-
new(transformed_hash)
|
149
|
-
end
|
150
|
-
|
151
|
-
# Deserializes the data based on type
|
152
|
-
# @param string type Data type
|
153
|
-
# @param string value Value to be deserialized
|
154
|
-
# @return [Object] Deserialized data
|
155
|
-
def self._deserialize(type, value)
|
156
|
-
case type.to_sym
|
157
|
-
when :Time
|
158
|
-
Time.parse(value)
|
159
|
-
when :Date
|
160
|
-
Date.parse(value)
|
161
|
-
when :String
|
162
|
-
value.to_s
|
163
|
-
when :Integer
|
164
|
-
value.to_i
|
165
|
-
when :Float
|
166
|
-
value.to_f
|
167
|
-
when :Boolean
|
168
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
|
-
true
|
170
|
-
else
|
171
|
-
false
|
172
|
-
end
|
173
|
-
when :Object
|
174
|
-
# generic object (usually a Hash), return directly
|
175
|
-
value
|
176
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
-
inner_type = Regexp.last_match[:inner_type]
|
178
|
-
value.map { |v| _deserialize(inner_type, v) }
|
179
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
180
|
-
k_type = Regexp.last_match[:k_type]
|
181
|
-
v_type = Regexp.last_match[:v_type]
|
182
|
-
{}.tap do |hash|
|
183
|
-
value.each do |k, v|
|
184
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
else # model
|
188
|
-
# models (e.g. Pet) or oneOf
|
189
|
-
klass = Tremendous.const_get(type)
|
190
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
# Returns the string representation of the object
|
195
|
-
# @return [String] String presentation of the object
|
196
|
-
def to_s
|
197
|
-
to_hash.to_s
|
198
|
-
end
|
199
|
-
|
200
|
-
# to_body is an alias to to_hash (backward compatibility)
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_body
|
203
|
-
to_hash
|
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 = self.send(attr)
|
212
|
-
if value.nil?
|
213
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
214
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
215
|
-
end
|
216
|
-
|
217
|
-
hash[param] = _to_hash(value)
|
218
|
-
end
|
219
|
-
hash
|
220
|
-
end
|
221
|
-
|
222
|
-
# Outputs non-array value in the form of hash
|
223
|
-
# For object, use to_hash. Otherwise, just return the value
|
224
|
-
# @param [Object] value Any valid value
|
225
|
-
# @return [Hash] Returns the value in the form of hash
|
226
|
-
def _to_hash(value)
|
227
|
-
if value.is_a?(Array)
|
228
|
-
value.compact.map { |v| _to_hash(v) }
|
229
|
-
elsif value.is_a?(Hash)
|
230
|
-
{}.tap do |hash|
|
231
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
232
|
-
end
|
233
|
-
elsif value.respond_to? :to_hash
|
234
|
-
value.to_hash
|
235
|
-
else
|
236
|
-
value
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|
@@ -1,222 +0,0 @@
|
|
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 TestPublicKeyRequest
|
18
|
-
# A JWT token encoded with RS256, signed using the RSA private key corresponding to your public key.
|
19
|
-
attr_accessor :jwt
|
20
|
-
|
21
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
-
def self.attribute_map
|
23
|
-
{
|
24
|
-
:'jwt' => :'jwt'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
# Returns all the JSON keys this model knows about
|
29
|
-
def self.acceptable_attributes
|
30
|
-
attribute_map.values
|
31
|
-
end
|
32
|
-
|
33
|
-
# Attribute type mapping.
|
34
|
-
def self.openapi_types
|
35
|
-
{
|
36
|
-
:'jwt' => :'String'
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
# List of attributes with nullable: true
|
41
|
-
def self.openapi_nullable
|
42
|
-
Set.new([
|
43
|
-
])
|
44
|
-
end
|
45
|
-
|
46
|
-
# Initializes the object
|
47
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
-
def initialize(attributes = {})
|
49
|
-
if (!attributes.is_a?(Hash))
|
50
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::TestPublicKeyRequest` initialize method"
|
51
|
-
end
|
52
|
-
|
53
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::TestPublicKeyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
-
end
|
58
|
-
h[k.to_sym] = v
|
59
|
-
}
|
60
|
-
|
61
|
-
if attributes.key?(:'jwt')
|
62
|
-
self.jwt = attributes[:'jwt']
|
63
|
-
else
|
64
|
-
self.jwt = nil
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
-
# @return Array for valid properties with the reasons
|
70
|
-
def list_invalid_properties
|
71
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
72
|
-
invalid_properties = Array.new
|
73
|
-
if @jwt.nil?
|
74
|
-
invalid_properties.push('invalid value for "jwt", jwt cannot be nil.')
|
75
|
-
end
|
76
|
-
|
77
|
-
invalid_properties
|
78
|
-
end
|
79
|
-
|
80
|
-
# Check to see if the all the properties in the model are valid
|
81
|
-
# @return true if the model is valid
|
82
|
-
def valid?
|
83
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
84
|
-
return false if @jwt.nil?
|
85
|
-
true
|
86
|
-
end
|
87
|
-
|
88
|
-
# Checks equality by comparing each attribute.
|
89
|
-
# @param [Object] Object to be compared
|
90
|
-
def ==(o)
|
91
|
-
return true if self.equal?(o)
|
92
|
-
self.class == o.class &&
|
93
|
-
jwt == o.jwt
|
94
|
-
end
|
95
|
-
|
96
|
-
# @see the `==` method
|
97
|
-
# @param [Object] Object to be compared
|
98
|
-
def eql?(o)
|
99
|
-
self == o
|
100
|
-
end
|
101
|
-
|
102
|
-
# Calculates hash code according to all attributes.
|
103
|
-
# @return [Integer] Hash code
|
104
|
-
def hash
|
105
|
-
[jwt].hash
|
106
|
-
end
|
107
|
-
|
108
|
-
# Builds the object from hash
|
109
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
-
# @return [Object] Returns the model itself
|
111
|
-
def self.build_from_hash(attributes)
|
112
|
-
return nil unless attributes.is_a?(Hash)
|
113
|
-
attributes = attributes.transform_keys(&:to_sym)
|
114
|
-
transformed_hash = {}
|
115
|
-
openapi_types.each_pair do |key, type|
|
116
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
117
|
-
transformed_hash["#{key}"] = nil
|
118
|
-
elsif type =~ /\AArray<(.*)>/i
|
119
|
-
# check to ensure the input is an array given that the attribute
|
120
|
-
# is documented as an array but the input is not
|
121
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
122
|
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
123
|
-
end
|
124
|
-
elsif !attributes[attribute_map[key]].nil?
|
125
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
126
|
-
end
|
127
|
-
end
|
128
|
-
new(transformed_hash)
|
129
|
-
end
|
130
|
-
|
131
|
-
# Deserializes the data based on type
|
132
|
-
# @param string type Data type
|
133
|
-
# @param string value Value to be deserialized
|
134
|
-
# @return [Object] Deserialized data
|
135
|
-
def self._deserialize(type, value)
|
136
|
-
case type.to_sym
|
137
|
-
when :Time
|
138
|
-
Time.parse(value)
|
139
|
-
when :Date
|
140
|
-
Date.parse(value)
|
141
|
-
when :String
|
142
|
-
value.to_s
|
143
|
-
when :Integer
|
144
|
-
value.to_i
|
145
|
-
when :Float
|
146
|
-
value.to_f
|
147
|
-
when :Boolean
|
148
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
-
true
|
150
|
-
else
|
151
|
-
false
|
152
|
-
end
|
153
|
-
when :Object
|
154
|
-
# generic object (usually a Hash), return directly
|
155
|
-
value
|
156
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
-
inner_type = Regexp.last_match[:inner_type]
|
158
|
-
value.map { |v| _deserialize(inner_type, v) }
|
159
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
-
k_type = Regexp.last_match[:k_type]
|
161
|
-
v_type = Regexp.last_match[:v_type]
|
162
|
-
{}.tap do |hash|
|
163
|
-
value.each do |k, v|
|
164
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
else # model
|
168
|
-
# models (e.g. Pet) or oneOf
|
169
|
-
klass = Tremendous.const_get(type)
|
170
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# Returns the string representation of the object
|
175
|
-
# @return [String] String presentation of the object
|
176
|
-
def to_s
|
177
|
-
to_hash.to_s
|
178
|
-
end
|
179
|
-
|
180
|
-
# to_body is an alias to to_hash (backward compatibility)
|
181
|
-
# @return [Hash] Returns the object in the form of hash
|
182
|
-
def to_body
|
183
|
-
to_hash
|
184
|
-
end
|
185
|
-
|
186
|
-
# Returns the object in the form of hash
|
187
|
-
# @return [Hash] Returns the object in the form of hash
|
188
|
-
def to_hash
|
189
|
-
hash = {}
|
190
|
-
self.class.attribute_map.each_pair do |attr, param|
|
191
|
-
value = self.send(attr)
|
192
|
-
if value.nil?
|
193
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
194
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
195
|
-
end
|
196
|
-
|
197
|
-
hash[param] = _to_hash(value)
|
198
|
-
end
|
199
|
-
hash
|
200
|
-
end
|
201
|
-
|
202
|
-
# Outputs non-array value in the form of hash
|
203
|
-
# For object, use to_hash. Otherwise, just return the value
|
204
|
-
# @param [Object] value Any valid value
|
205
|
-
# @return [Hash] Returns the value in the form of hash
|
206
|
-
def _to_hash(value)
|
207
|
-
if value.is_a?(Array)
|
208
|
-
value.compact.map { |v| _to_hash(v) }
|
209
|
-
elsif value.is_a?(Hash)
|
210
|
-
{}.tap do |hash|
|
211
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
-
end
|
213
|
-
elsif value.respond_to? :to_hash
|
214
|
-
value.to_hash
|
215
|
-
else
|
216
|
-
value
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
end
|