tremendous_ruby 5.1.0 → 5.4.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +1125 -38
  3. data/lib/tremendous/models/allow_email.rb +225 -0
  4. data/lib/tremendous/models/allow_email1.rb +225 -0
  5. data/lib/tremendous/models/allow_ip.rb +225 -0
  6. data/lib/tremendous/models/allow_ip1.rb +225 -0
  7. data/lib/tremendous/models/base_order_for_create.rb +232 -0
  8. data/lib/tremendous/models/campaign_base.rb +287 -0
  9. data/lib/tremendous/models/create_member.rb +1 -35
  10. data/lib/tremendous/models/create_member_request.rb +1 -35
  11. data/lib/tremendous/models/create_order200_response.rb +1 -1
  12. data/lib/tremendous/models/create_order_request.rb +73 -217
  13. data/lib/tremendous/models/create_organization_request_copy_settings.rb +14 -2
  14. data/lib/tremendous/models/create_public_key.rb +222 -0
  15. data/lib/tremendous/models/create_public_key200_response.rb +221 -0
  16. data/lib/tremendous/models/create_public_key_request.rb +222 -0
  17. data/lib/tremendous/models/delete_fraud_rule200_response.rb +222 -0
  18. data/lib/tremendous/models/fraud_config_allow_email.rb +224 -0
  19. data/lib/tremendous/models/fraud_config_country.rb +275 -0
  20. data/lib/tremendous/models/fraud_config_country_update_list.rb +224 -0
  21. data/lib/tremendous/models/fraud_config_ip.rb +224 -0
  22. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +292 -0
  23. data/lib/tremendous/models/fraud_config_redeemed_rewards_count.rb +292 -0
  24. data/lib/tremendous/models/fraud_config_review_email.rb +229 -0
  25. data/lib/tremendous/models/fraud_generic_response.rb +222 -0
  26. data/lib/tremendous/models/fraud_review.rb +351 -0
  27. data/lib/tremendous/models/fraud_review_geo.rb +235 -0
  28. data/lib/tremendous/models/{reward_with_link_delivery.rb → fraud_review_list_item.rb} +26 -51
  29. data/lib/tremendous/models/fraud_review_reason.rb +58 -0
  30. data/lib/tremendous/models/fraud_review_redemption_method.rb +44 -0
  31. data/lib/tremendous/models/fraud_review_related_rewards.rb +304 -0
  32. data/lib/tremendous/models/fraud_review_status.rb +41 -0
  33. data/lib/tremendous/models/fraud_rule200_response.rb +222 -0
  34. data/lib/tremendous/models/fraud_rule400_response.rb +221 -0
  35. data/lib/tremendous/models/fraud_rule422_response.rb +221 -0
  36. data/lib/tremendous/models/fraud_rule_request.rb +214 -0
  37. data/lib/tremendous/models/fraud_rule_request_config.rb +110 -0
  38. data/lib/tremendous/models/fraud_rule_type.rb +49 -0
  39. data/lib/tremendous/models/fraud_rules_list_item.rb +261 -0
  40. data/lib/tremendous/models/get_fraud_review200_response.rb +221 -0
  41. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +351 -0
  42. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_geo.rb +236 -0
  43. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb +305 -0
  44. data/lib/tremendous/models/get_member200_response_member.rb +2 -20
  45. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +2 -0
  46. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +1 -0
  47. data/lib/tremendous/models/list_forex_response.rb +223 -0
  48. data/lib/tremendous/models/list_fraud_reviews200_response.rb +223 -0
  49. data/lib/tremendous/models/{delivery_details_with_link.rb → list_fraud_reviews200_response_fraud_reviews_inner.rb} +26 -51
  50. data/lib/tremendous/models/list_fraud_rules200_response.rb +223 -0
  51. data/lib/tremendous/models/{create_order200_response_order_rewards_inner_delivery.rb → list_fraud_rules200_response_fraud_rules_inner.rb} +28 -63
  52. data/lib/tremendous/models/list_members200_response_members_inner.rb +2 -20
  53. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +0 -21
  54. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +1 -6
  55. data/lib/tremendous/models/list_roles200_response.rb +223 -0
  56. data/lib/tremendous/models/list_roles200_response_roles_inner.rb +275 -0
  57. data/lib/tremendous/models/member.rb +2 -20
  58. data/lib/tremendous/models/member_base.rb +2 -20
  59. data/lib/tremendous/models/member_with_events.rb +2 -20
  60. data/lib/tremendous/models/member_without_events.rb +2 -20
  61. data/lib/tremendous/models/order_without_link_reward.rb +0 -21
  62. data/lib/tremendous/models/public_key.rb +257 -0
  63. data/lib/tremendous/models/public_keys_response.rb +223 -0
  64. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +257 -0
  65. data/lib/tremendous/models/review_country.rb +276 -0
  66. data/lib/tremendous/models/review_country1.rb +225 -0
  67. data/lib/tremendous/models/review_email.rb +230 -0
  68. data/lib/tremendous/models/review_email1.rb +230 -0
  69. data/lib/tremendous/models/review_ip.rb +225 -0
  70. data/lib/tremendous/models/review_ip1.rb +225 -0
  71. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +293 -0
  72. data/lib/tremendous/models/review_redeemed_rewards_count.rb +293 -0
  73. data/lib/tremendous/models/reward.rb +0 -21
  74. data/lib/tremendous/models/reward_base.rb +0 -21
  75. data/lib/tremendous/models/reward_for_order_create.rb +1 -22
  76. data/lib/tremendous/models/reward_value.rb +1 -6
  77. data/lib/tremendous/models/reward_without_link.rb +0 -21
  78. data/lib/tremendous/models/role.rb +275 -0
  79. data/lib/tremendous/models/{order_for_create.rb → single_reward_order.rb} +6 -12
  80. data/lib/tremendous/models/single_reward_order1.rb +242 -0
  81. data/lib/tremendous/models/{create_order_request_payment.rb → single_reward_order1_payment.rb} +3 -3
  82. data/lib/tremendous/models/{create_order_request_reward.rb → single_reward_order1_reward.rb} +5 -26
  83. data/lib/tremendous/models/{create_order_request_reward_custom_fields_inner.rb → single_reward_order1_reward_custom_fields_inner.rb} +3 -3
  84. data/lib/tremendous/models/{create_order_request_reward_delivery.rb → single_reward_order1_reward_delivery.rb} +3 -3
  85. data/lib/tremendous/models/{order_for_create_reward.rb → single_reward_order_reward.rb} +4 -25
  86. data/lib/tremendous/models/{create_order201_response.rb → single_reward_order_without_link.rb} +4 -4
  87. data/lib/tremendous/models/{order_with_link.rb → single_reward_order_without_link_order.rb} +10 -31
  88. data/lib/tremendous/models/test_public_key.rb +222 -0
  89. data/lib/tremendous/models/test_public_key_request.rb +222 -0
  90. data/lib/tremendous/models/update_campaign.rb +287 -0
  91. data/lib/tremendous/models/update_campaign_request.rb +257 -0
  92. data/lib/tremendous/models/update_fraud_rule_list200_response.rb +222 -0
  93. data/lib/tremendous/models/update_fraud_rule_list_request.rb +272 -0
  94. data/lib/tremendous/models/update_fraud_rule_list_request_config.rb +108 -0
  95. data/lib/tremendous/version.rb +1 -1
  96. data/lib/tremendous.rb +71 -15
  97. metadata +74 -18
  98. data/lib/tremendous/models/create_order200_response_order.rb +0 -400
  99. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +0 -347
  100. data/lib/tremendous/models/order_with_link_rewards_inner.rb +0 -406
  101. data/lib/tremendous/models/reward_with_link.rb +0 -406
@@ -0,0 +1,222 @@
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
+ OpenAPI Generator version: 7.3.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
@@ -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 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
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # With a campaign you can define the look & feel of how rewards are sent out. It also lets you set the available products (different gift cards, charity, etc.) recipients can choose from.
18
+ class UpdateCampaign
19
+ attr_accessor :id
20
+
21
+ # Name of the campaign
22
+ attr_accessor :name
23
+
24
+ # Description of the campaign
25
+ attr_accessor :description
26
+
27
+ # List of IDs of products (different gift cards, charity, etc.) that are available in this campaign.
28
+ attr_accessor :products
29
+
30
+ attr_accessor :webpage_style
31
+
32
+ attr_accessor :email_style
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'id' => :'id',
38
+ :'name' => :'name',
39
+ :'description' => :'description',
40
+ :'products' => :'products',
41
+ :'webpage_style' => :'webpage_style',
42
+ :'email_style' => :'email_style'
43
+ }
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'id' => :'String',
55
+ :'name' => :'String',
56
+ :'description' => :'String',
57
+ :'products' => :'Array<String>',
58
+ :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle',
59
+ :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'description',
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::UpdateCampaign` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::UpdateCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'id')
86
+ self.id = attributes[:'id']
87
+ end
88
+
89
+ if attributes.key?(:'name')
90
+ self.name = attributes[:'name']
91
+ end
92
+
93
+ if attributes.key?(:'description')
94
+ self.description = attributes[:'description']
95
+ end
96
+
97
+ if attributes.key?(:'products')
98
+ if (value = attributes[:'products']).is_a?(Array)
99
+ self.products = value
100
+ end
101
+ end
102
+
103
+ if attributes.key?(:'webpage_style')
104
+ self.webpage_style = attributes[:'webpage_style']
105
+ end
106
+
107
+ if attributes.key?(:'email_style')
108
+ self.email_style = attributes[:'email_style']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
+ invalid_properties = Array.new
117
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
118
+ if !@id.nil? && @id !~ pattern
119
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ warn '[DEPRECATED] the `valid?` method is obsolete'
129
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
130
+ true
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] id Value to be assigned
135
+ def id=(id)
136
+ if id.nil?
137
+ fail ArgumentError, 'id cannot be nil'
138
+ end
139
+
140
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
141
+ if id !~ pattern
142
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
143
+ end
144
+
145
+ @id = id
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ id == o.id &&
154
+ name == o.name &&
155
+ description == o.description &&
156
+ products == o.products &&
157
+ webpage_style == o.webpage_style &&
158
+ email_style == o.email_style
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, name, description, products, webpage_style, email_style].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