tremendous_ruby 5.0.1 → 5.3.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +677 -9
  3. data/lib/tremendous/models/campaign.rb +25 -14
  4. data/lib/tremendous/models/campaign_base.rb +287 -0
  5. data/lib/tremendous/models/{get_campaign200_response.rb → create_campaign201_response.rb} +3 -3
  6. data/lib/tremendous/models/create_campaign_request.rb +273 -0
  7. data/lib/tremendous/models/create_member.rb +2 -53
  8. data/lib/tremendous/models/create_member_request.rb +2 -53
  9. data/lib/tremendous/models/create_order_request_reward.rb +1 -1
  10. data/lib/tremendous/models/create_order_request_reward_custom_fields_inner.rb +248 -0
  11. data/lib/tremendous/models/create_organization_request_copy_settings.rb +29 -5
  12. data/lib/tremendous/models/{list_products200_response_products_inner_countries_inner.rb → create_public_key.rb} +15 -15
  13. data/lib/tremendous/models/create_public_key200_response.rb +221 -0
  14. data/lib/tremendous/models/create_public_key_request.rb +222 -0
  15. data/lib/tremendous/models/custom_field.rb +15 -5
  16. data/lib/tremendous/models/get_member200_response_member.rb +13 -21
  17. data/lib/tremendous/models/invoice.rb +2 -2
  18. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +25 -14
  19. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +270 -0
  20. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +270 -0
  21. data/lib/tremendous/models/{get_product200_response.rb → list_forex_response.rb} +16 -14
  22. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +2 -2
  23. data/lib/tremendous/models/list_members200_response_members_inner.rb +13 -21
  24. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +15 -5
  25. data/lib/tremendous/models/{list_products200_response.rb → list_roles200_response.rb} +15 -15
  26. data/lib/tremendous/models/{list_products200_response_products_inner_images_inner.rb → list_roles200_response_roles_inner.rb} +59 -57
  27. data/lib/tremendous/models/member.rb +13 -21
  28. data/lib/tremendous/models/member_base.rb +13 -21
  29. data/lib/tremendous/models/member_with_events.rb +13 -21
  30. data/lib/tremendous/models/member_without_events.rb +13 -21
  31. data/lib/tremendous/models/public_key.rb +257 -0
  32. data/lib/tremendous/models/public_keys_response.rb +223 -0
  33. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +257 -0
  34. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +15 -5
  35. data/lib/tremendous/models/{list_products200_response_products_inner_skus_inner.rb → role.rb} +51 -53
  36. data/lib/tremendous/models/test_public_key.rb +222 -0
  37. data/lib/tremendous/models/test_public_key_request.rb +222 -0
  38. data/lib/tremendous/models/update_campaign.rb +287 -0
  39. data/lib/tremendous/models/update_campaign_request.rb +257 -0
  40. data/lib/tremendous/version.rb +1 -1
  41. data/lib/tremendous.rb +20 -1
  42. metadata +23 -10
  43. data/lib/tremendous/models/list_products200_response_products_inner.rb +0 -457
@@ -24,7 +24,10 @@ module Tremendous
24
24
  # Full name of the member
25
25
  attr_accessor :name
26
26
 
27
- # Role of the member within the organization. <table> <thead> <tr> <th>Role</th> <th>Description</th> </tr> </thead> <tr> <td><code>MEMBER</code></td> <td>Limited permissions. Can view their own reward and order histories only.</td> </tr> <tr> <td><code>ADMIN</code></td> <td>Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.</td> </tr> <tr> <td><code>DELETED</code></td> <td>No longer a member of this organization.</td> </tr> <tbody> </tbody> </table>
27
+ # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
+ attr_accessor :active
29
+
30
+ # The role ID associated with the member within the organization.
28
31
  attr_accessor :role
29
32
 
30
33
  # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`.
@@ -58,6 +61,7 @@ module Tremendous
58
61
  :'id' => :'id',
59
62
  :'email' => :'email',
60
63
  :'name' => :'name',
64
+ :'active' => :'active',
61
65
  :'role' => :'role',
62
66
  :'status' => :'status'
63
67
  }
@@ -74,6 +78,7 @@ module Tremendous
74
78
  :'id' => :'String',
75
79
  :'email' => :'String',
76
80
  :'name' => :'String',
81
+ :'active' => :'Boolean',
77
82
  :'role' => :'String',
78
83
  :'status' => :'String'
79
84
  }
@@ -83,6 +88,7 @@ module Tremendous
83
88
  def self.openapi_nullable
84
89
  Set.new([
85
90
  :'name',
91
+ :'role',
86
92
  ])
87
93
  end
88
94
 
@@ -119,10 +125,12 @@ module Tremendous
119
125
  self.name = nil
120
126
  end
121
127
 
128
+ if attributes.key?(:'active')
129
+ self.active = attributes[:'active']
130
+ end
131
+
122
132
  if attributes.key?(:'role')
123
133
  self.role = attributes[:'role']
124
- else
125
- self.role = nil
126
134
  end
127
135
 
128
136
  if attributes.key?(:'status')
@@ -150,10 +158,6 @@ module Tremendous
150
158
  invalid_properties.push('invalid value for "email", email cannot be nil.')
151
159
  end
152
160
 
153
- if @role.nil?
154
- invalid_properties.push('invalid value for "role", role cannot be nil.')
155
- end
156
-
157
161
  if @status.nil?
158
162
  invalid_properties.push('invalid value for "status", status cannot be nil.')
159
163
  end
@@ -168,9 +172,6 @@ module Tremendous
168
172
  return false if @id.nil?
169
173
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
170
174
  return false if @email.nil?
171
- return false if @role.nil?
172
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
173
- return false unless role_validator.valid?(@role)
174
175
  return false if @status.nil?
175
176
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
176
177
  return false unless status_validator.valid?(@status)
@@ -192,16 +193,6 @@ module Tremendous
192
193
  @id = id
193
194
  end
194
195
 
195
- # Custom attribute writer method checking allowed values (enum).
196
- # @param [Object] role Object to be assigned
197
- def role=(role)
198
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
199
- unless validator.valid?(role)
200
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
201
- end
202
- @role = role
203
- end
204
-
205
196
  # Custom attribute writer method checking allowed values (enum).
206
197
  # @param [Object] status Object to be assigned
207
198
  def status=(status)
@@ -220,6 +211,7 @@ module Tremendous
220
211
  id == o.id &&
221
212
  email == o.email &&
222
213
  name == o.name &&
214
+ active == o.active &&
223
215
  role == o.role &&
224
216
  status == o.status
225
217
  end
@@ -233,7 +225,7 @@ module Tremendous
233
225
  # Calculates hash code according to all attributes.
234
226
  # @return [Integer] Hash code
235
227
  def hash
236
- [id, email, name, role, status].hash
228
+ [id, email, name, active, role, status].hash
237
229
  end
238
230
 
239
231
  # Builds the object from hash
@@ -24,7 +24,10 @@ module Tremendous
24
24
  # Full name of the member
25
25
  attr_accessor :name
26
26
 
27
- # Role of the member within the organization. <table> <thead> <tr> <th>Role</th> <th>Description</th> </tr> </thead> <tr> <td><code>MEMBER</code></td> <td>Limited permissions. Can view their own reward and order histories only.</td> </tr> <tr> <td><code>ADMIN</code></td> <td>Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.</td> </tr> <tr> <td><code>DELETED</code></td> <td>No longer a member of this organization.</td> </tr> <tbody> </tbody> </table>
27
+ # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
+ attr_accessor :active
29
+
30
+ # The role ID associated with the member within the organization.
28
31
  attr_accessor :role
29
32
 
30
33
  # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`.
@@ -61,6 +64,7 @@ module Tremendous
61
64
  :'id' => :'id',
62
65
  :'email' => :'email',
63
66
  :'name' => :'name',
67
+ :'active' => :'active',
64
68
  :'role' => :'role',
65
69
  :'status' => :'status',
66
70
  :'events' => :'events'
@@ -78,6 +82,7 @@ module Tremendous
78
82
  :'id' => :'String',
79
83
  :'email' => :'String',
80
84
  :'name' => :'String',
85
+ :'active' => :'Boolean',
81
86
  :'role' => :'String',
82
87
  :'status' => :'String',
83
88
  :'events' => :'Array<GetMember200ResponseMemberEventsInner>'
@@ -88,6 +93,7 @@ module Tremendous
88
93
  def self.openapi_nullable
89
94
  Set.new([
90
95
  :'name',
96
+ :'role',
91
97
  ])
92
98
  end
93
99
 
@@ -124,10 +130,12 @@ module Tremendous
124
130
  self.name = nil
125
131
  end
126
132
 
133
+ if attributes.key?(:'active')
134
+ self.active = attributes[:'active']
135
+ end
136
+
127
137
  if attributes.key?(:'role')
128
138
  self.role = attributes[:'role']
129
- else
130
- self.role = nil
131
139
  end
132
140
 
133
141
  if attributes.key?(:'status')
@@ -161,10 +169,6 @@ module Tremendous
161
169
  invalid_properties.push('invalid value for "email", email cannot be nil.')
162
170
  end
163
171
 
164
- if @role.nil?
165
- invalid_properties.push('invalid value for "role", role cannot be nil.')
166
- end
167
-
168
172
  if @status.nil?
169
173
  invalid_properties.push('invalid value for "status", status cannot be nil.')
170
174
  end
@@ -179,9 +183,6 @@ module Tremendous
179
183
  return false if @id.nil?
180
184
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
181
185
  return false if @email.nil?
182
- return false if @role.nil?
183
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
184
- return false unless role_validator.valid?(@role)
185
186
  return false if @status.nil?
186
187
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
187
188
  return false unless status_validator.valid?(@status)
@@ -203,16 +204,6 @@ module Tremendous
203
204
  @id = id
204
205
  end
205
206
 
206
- # Custom attribute writer method checking allowed values (enum).
207
- # @param [Object] role Object to be assigned
208
- def role=(role)
209
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
210
- unless validator.valid?(role)
211
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
212
- end
213
- @role = role
214
- end
215
-
216
207
  # Custom attribute writer method checking allowed values (enum).
217
208
  # @param [Object] status Object to be assigned
218
209
  def status=(status)
@@ -231,6 +222,7 @@ module Tremendous
231
222
  id == o.id &&
232
223
  email == o.email &&
233
224
  name == o.name &&
225
+ active == o.active &&
234
226
  role == o.role &&
235
227
  status == o.status &&
236
228
  events == o.events
@@ -245,7 +237,7 @@ module Tremendous
245
237
  # Calculates hash code according to all attributes.
246
238
  # @return [Integer] Hash code
247
239
  def hash
248
- [id, email, name, role, status, events].hash
240
+ [id, email, name, active, role, status, events].hash
249
241
  end
250
242
 
251
243
  # Builds the object from hash
@@ -24,7 +24,10 @@ module Tremendous
24
24
  # Full name of the member
25
25
  attr_accessor :name
26
26
 
27
- # Role of the member within the organization. <table> <thead> <tr> <th>Role</th> <th>Description</th> </tr> </thead> <tr> <td><code>MEMBER</code></td> <td>Limited permissions. Can view their own reward and order histories only.</td> </tr> <tr> <td><code>ADMIN</code></td> <td>Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.</td> </tr> <tr> <td><code>DELETED</code></td> <td>No longer a member of this organization.</td> </tr> <tbody> </tbody> </table>
27
+ # Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
28
+ attr_accessor :active
29
+
30
+ # The role ID associated with the member within the organization.
28
31
  attr_accessor :role
29
32
 
30
33
  # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`.
@@ -64,6 +67,7 @@ module Tremendous
64
67
  :'id' => :'id',
65
68
  :'email' => :'email',
66
69
  :'name' => :'name',
70
+ :'active' => :'active',
67
71
  :'role' => :'role',
68
72
  :'status' => :'status',
69
73
  :'created_at' => :'created_at',
@@ -82,6 +86,7 @@ module Tremendous
82
86
  :'id' => :'String',
83
87
  :'email' => :'String',
84
88
  :'name' => :'String',
89
+ :'active' => :'Boolean',
85
90
  :'role' => :'String',
86
91
  :'status' => :'String',
87
92
  :'created_at' => :'Time',
@@ -93,6 +98,7 @@ module Tremendous
93
98
  def self.openapi_nullable
94
99
  Set.new([
95
100
  :'name',
101
+ :'role',
96
102
  :'last_login_at'
97
103
  ])
98
104
  end
@@ -130,10 +136,12 @@ module Tremendous
130
136
  self.name = nil
131
137
  end
132
138
 
139
+ if attributes.key?(:'active')
140
+ self.active = attributes[:'active']
141
+ end
142
+
133
143
  if attributes.key?(:'role')
134
144
  self.role = attributes[:'role']
135
- else
136
- self.role = nil
137
145
  end
138
146
 
139
147
  if attributes.key?(:'status')
@@ -169,10 +177,6 @@ module Tremendous
169
177
  invalid_properties.push('invalid value for "email", email cannot be nil.')
170
178
  end
171
179
 
172
- if @role.nil?
173
- invalid_properties.push('invalid value for "role", role cannot be nil.')
174
- end
175
-
176
180
  if @status.nil?
177
181
  invalid_properties.push('invalid value for "status", status cannot be nil.')
178
182
  end
@@ -187,9 +191,6 @@ module Tremendous
187
191
  return false if @id.nil?
188
192
  return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
189
193
  return false if @email.nil?
190
- return false if @role.nil?
191
- role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
192
- return false unless role_validator.valid?(@role)
193
194
  return false if @status.nil?
194
195
  status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
195
196
  return false unless status_validator.valid?(@status)
@@ -211,16 +212,6 @@ module Tremendous
211
212
  @id = id
212
213
  end
213
214
 
214
- # Custom attribute writer method checking allowed values (enum).
215
- # @param [Object] role Object to be assigned
216
- def role=(role)
217
- validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"])
218
- unless validator.valid?(role)
219
- fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
220
- end
221
- @role = role
222
- end
223
-
224
215
  # Custom attribute writer method checking allowed values (enum).
225
216
  # @param [Object] status Object to be assigned
226
217
  def status=(status)
@@ -239,6 +230,7 @@ module Tremendous
239
230
  id == o.id &&
240
231
  email == o.email &&
241
232
  name == o.name &&
233
+ active == o.active &&
242
234
  role == o.role &&
243
235
  status == o.status &&
244
236
  created_at == o.created_at &&
@@ -254,7 +246,7 @@ module Tremendous
254
246
  # Calculates hash code according to all attributes.
255
247
  # @return [Integer] Hash code
256
248
  def hash
257
- [id, email, name, role, status, created_at, last_login_at].hash
249
+ [id, email, name, active, role, status, created_at, last_login_at].hash
258
250
  end
259
251
 
260
252
  # Builds the object from hash
@@ -0,0 +1,257 @@
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
+ # To authenticate your requests using asymmetric key pairs (e.g., for signing embed requests), you need to share your public key with us. The public key resource allows you to manage your active public keys and track their last usage.
18
+ class PublicKey
19
+ attr_accessor :id
20
+
21
+ # Your public key, PEM encoded
22
+ attr_accessor :pem
23
+
24
+ # The last time your public key was used to sign a request
25
+ attr_accessor :last_used_at
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'pem' => :'pem',
32
+ :'last_used_at' => :'last_used_at'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'id' => :'String',
45
+ :'pem' => :'String',
46
+ :'last_used_at' => :'Time'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'last_used_at'
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::PublicKey` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::PublicKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.key?(:'pem')
77
+ self.pem = attributes[:'pem']
78
+ end
79
+
80
+ if attributes.key?(:'last_used_at')
81
+ self.last_used_at = attributes[:'last_used_at']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
91
+ if !@id.nil? && @id !~ pattern
92
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
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 !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] id Value to be assigned
108
+ def id=(id)
109
+ if id.nil?
110
+ fail ArgumentError, 'id cannot be nil'
111
+ end
112
+
113
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
114
+ if id !~ pattern
115
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
116
+ end
117
+
118
+ @id = id
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ id == o.id &&
127
+ pem == o.pem &&
128
+ last_used_at == o.last_used_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [id, pem, last_used_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = Tremendous.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end