adzerk_decision_sdk 1.0.0.pre.beta.1

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 (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/README.md +97 -0
  5. data/Rakefile +10 -0
  6. data/adzerk_decision_sdk.gemspec +39 -0
  7. data/docs/Consent.md +17 -0
  8. data/docs/ConsentRequest.md +19 -0
  9. data/docs/Content.md +25 -0
  10. data/docs/Decision.md +35 -0
  11. data/docs/DecisionApi.md +57 -0
  12. data/docs/DecisionData.md +25 -0
  13. data/docs/DecisionRequest.md +43 -0
  14. data/docs/DecisionResponse.md +21 -0
  15. data/docs/Event.md +19 -0
  16. data/docs/GdprConsent.md +19 -0
  17. data/docs/Placement.md +47 -0
  18. data/docs/PricingData.md +25 -0
  19. data/docs/Request.md +43 -0
  20. data/docs/RequestConsent.md +17 -0
  21. data/docs/Response.md +21 -0
  22. data/docs/User.md +17 -0
  23. data/docs/UserdbApi.md +536 -0
  24. data/git_push.sh +58 -0
  25. data/lib/adzerk_decision_sdk/api/decision_api.rb +80 -0
  26. data/lib/adzerk_decision_sdk/api/userdb_api.rb +731 -0
  27. data/lib/adzerk_decision_sdk/api_client.rb +386 -0
  28. data/lib/adzerk_decision_sdk/api_error.rb +57 -0
  29. data/lib/adzerk_decision_sdk/client.rb +43 -0
  30. data/lib/adzerk_decision_sdk/configuration.rb +262 -0
  31. data/lib/adzerk_decision_sdk/decision_client.rb +73 -0
  32. data/lib/adzerk_decision_sdk/event_type.rb +61 -0
  33. data/lib/adzerk_decision_sdk/models/consent_request.rb +215 -0
  34. data/lib/adzerk_decision_sdk/models/content.rb +242 -0
  35. data/lib/adzerk_decision_sdk/models/decision.rb +291 -0
  36. data/lib/adzerk_decision_sdk/models/decision_data.rb +242 -0
  37. data/lib/adzerk_decision_sdk/models/decision_request.rb +359 -0
  38. data/lib/adzerk_decision_sdk/models/decision_response.rb +224 -0
  39. data/lib/adzerk_decision_sdk/models/event.rb +215 -0
  40. data/lib/adzerk_decision_sdk/models/placement.rb +377 -0
  41. data/lib/adzerk_decision_sdk/models/pricing_data.rb +242 -0
  42. data/lib/adzerk_decision_sdk/models/user.rb +208 -0
  43. data/lib/adzerk_decision_sdk/pixel_client.rb +26 -0
  44. data/lib/adzerk_decision_sdk/rate_type.rb +8 -0
  45. data/lib/adzerk_decision_sdk/user_db_client.rb +64 -0
  46. data/lib/adzerk_decision_sdk/version.rb +15 -0
  47. data/lib/adzerk_decision_sdk.rb +58 -0
  48. data/pkg/adzerk_decision_sdk-1.0.0.gem +0 -0
  49. data/spec/.gitkeep +0 -0
  50. data/spec/placeholder_spec.rb +9 -0
  51. metadata +153 -0
@@ -0,0 +1,377 @@
1
+ =begin
2
+ #Adzerk Decision API
3
+
4
+ #Adzerk Decision API
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AdzerkDecisionSdk
16
+ class Placement
17
+ # A unique name for the placement defined by you
18
+ attr_accessor :div_name
19
+
20
+ # The numeric network id
21
+ attr_accessor :network_id
22
+
23
+ # The numeric site id
24
+ attr_accessor :site_id
25
+
26
+ # One or more integer ad types. More info [here](https://dev.adzerk.com/docs/ad-sizes)
27
+ attr_accessor :ad_types
28
+
29
+ # Zone IDs to use
30
+ attr_accessor :zone_ids
31
+
32
+ # A numeric campaign id; if specified, only consider ads in that campaign
33
+ attr_accessor :campaign_id
34
+
35
+ # A numeric ad (flight-creative map) id; if specified, only serve that ad if possible
36
+ attr_accessor :flight_id
37
+
38
+ # A numeric ad (flight-creative map) id; if specified, only serve that ad if possible
39
+ attr_accessor :ad_id
40
+
41
+ # The ad's click-through URL
42
+ attr_accessor :click_url
43
+
44
+ # A map of key/value pairs used for [Custom Targeting](https://dev.adzerk.com/docs/custom-targeting)
45
+ attr_accessor :properties
46
+
47
+ # An array of numeric event types. Requests tracking URLs for custom events. See here for [Event Tracking IDs](https://dev.adzerk.com/v1.0/docs/custom-event-tracking)
48
+ attr_accessor :event_ids
49
+
50
+ # An object that overrides values for an advertiser, campaign, flight or ad. Used especially for header bidding
51
+ attr_accessor :overrides
52
+
53
+ # A map of key/value pairs used with [ContentDB](https://dev.adzerk.com/docs/contentdb-1). The format is `\"contentKeys\": {\"schema\": \"contentKey\"}`
54
+ attr_accessor :content_keys
55
+
56
+ # (BETA) The number of ads to return per placement. Integer between 1 and 20
57
+ attr_accessor :count
58
+
59
+ # (BETA) If true, fills ads in a multi-winner placement in proportion to the flight's goals
60
+ attr_accessor :proportionality
61
+
62
+ # (BETA) The name of the eCPM Partition that should be used to source eCPM data for auctions
63
+ attr_accessor :ecpm_partition
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'div_name' => :'divName',
69
+ :'network_id' => :'networkId',
70
+ :'site_id' => :'siteId',
71
+ :'ad_types' => :'adTypes',
72
+ :'zone_ids' => :'zoneIds',
73
+ :'campaign_id' => :'campaignId',
74
+ :'flight_id' => :'flightId',
75
+ :'ad_id' => :'adId',
76
+ :'click_url' => :'clickUrl',
77
+ :'properties' => :'properties',
78
+ :'event_ids' => :'eventIds',
79
+ :'overrides' => :'overrides',
80
+ :'content_keys' => :'contentKeys',
81
+ :'count' => :'count',
82
+ :'proportionality' => :'proportionality',
83
+ :'ecpm_partition' => :'ecpmPartition'
84
+ }
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'div_name' => :'String',
91
+ :'network_id' => :'Integer',
92
+ :'site_id' => :'Integer',
93
+ :'ad_types' => :'Array<Integer>',
94
+ :'zone_ids' => :'Array<Integer>',
95
+ :'campaign_id' => :'Integer',
96
+ :'flight_id' => :'Integer',
97
+ :'ad_id' => :'Integer',
98
+ :'click_url' => :'String',
99
+ :'properties' => :'Object',
100
+ :'event_ids' => :'Array<Integer>',
101
+ :'overrides' => :'Object',
102
+ :'content_keys' => :'Hash<String, Integer>',
103
+ :'count' => :'Integer',
104
+ :'proportionality' => :'Boolean',
105
+ :'ecpm_partition' => :'String'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ :'zone_ids',
113
+ :'campaign_id',
114
+ :'flight_id',
115
+ :'ad_id',
116
+ :'click_url',
117
+ :'properties',
118
+ :'event_ids',
119
+ :'overrides',
120
+ :'content_keys',
121
+ :'count',
122
+ :'proportionality',
123
+ :'ecpm_partition'
124
+ ])
125
+ end
126
+
127
+ # Initializes the object
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ def initialize(attributes = {})
130
+ if (!attributes.is_a?(Hash))
131
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AdzerkDecisionSdk::Placement` initialize method"
132
+ end
133
+
134
+ # check to see if the attribute exists and convert string to symbol for hash key
135
+ attributes = attributes.each_with_object({}) { |(k, v), h|
136
+ if (!self.class.attribute_map.key?(k.to_sym))
137
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AdzerkDecisionSdk::Placement`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
138
+ end
139
+ h[k.to_sym] = v
140
+ }
141
+
142
+ if attributes.key?(:'div_name')
143
+ self.div_name = attributes[:'div_name']
144
+ end
145
+
146
+ if attributes.key?(:'network_id')
147
+ self.network_id = attributes[:'network_id']
148
+ end
149
+
150
+ if attributes.key?(:'site_id')
151
+ self.site_id = attributes[:'site_id']
152
+ end
153
+
154
+ if attributes.key?(:'ad_types')
155
+ if (value = attributes[:'ad_types']).is_a?(Array)
156
+ self.ad_types = value
157
+ end
158
+ end
159
+
160
+ if attributes.key?(:'zone_ids')
161
+ if (value = attributes[:'zone_ids']).is_a?(Array)
162
+ self.zone_ids = value
163
+ end
164
+ end
165
+
166
+ if attributes.key?(:'campaign_id')
167
+ self.campaign_id = attributes[:'campaign_id']
168
+ end
169
+
170
+ if attributes.key?(:'flight_id')
171
+ self.flight_id = attributes[:'flight_id']
172
+ end
173
+
174
+ if attributes.key?(:'ad_id')
175
+ self.ad_id = attributes[:'ad_id']
176
+ end
177
+
178
+ if attributes.key?(:'click_url')
179
+ self.click_url = attributes[:'click_url']
180
+ end
181
+
182
+ if attributes.key?(:'properties')
183
+ self.properties = attributes[:'properties']
184
+ end
185
+
186
+ if attributes.key?(:'event_ids')
187
+ if (value = attributes[:'event_ids']).is_a?(Array)
188
+ self.event_ids = value
189
+ end
190
+ end
191
+
192
+ if attributes.key?(:'overrides')
193
+ self.overrides = attributes[:'overrides']
194
+ end
195
+
196
+ if attributes.key?(:'content_keys')
197
+ if (value = attributes[:'content_keys']).is_a?(Hash)
198
+ self.content_keys = value
199
+ end
200
+ end
201
+
202
+ if attributes.key?(:'count')
203
+ self.count = attributes[:'count']
204
+ end
205
+
206
+ if attributes.key?(:'proportionality')
207
+ self.proportionality = attributes[:'proportionality']
208
+ end
209
+
210
+ if attributes.key?(:'ecpm_partition')
211
+ self.ecpm_partition = attributes[:'ecpm_partition']
212
+ end
213
+ end
214
+
215
+ # Show invalid properties with the reasons. Usually used together with valid?
216
+ # @return Array for valid properties with the reasons
217
+ def list_invalid_properties
218
+ invalid_properties = Array.new
219
+ invalid_properties
220
+ end
221
+
222
+ # Check to see if the all the properties in the model are valid
223
+ # @return true if the model is valid
224
+ def valid?
225
+ true
226
+ end
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] Object to be compared
230
+ def ==(o)
231
+ return true if self.equal?(o)
232
+ self.class == o.class &&
233
+ div_name == o.div_name &&
234
+ network_id == o.network_id &&
235
+ site_id == o.site_id &&
236
+ ad_types == o.ad_types &&
237
+ zone_ids == o.zone_ids &&
238
+ campaign_id == o.campaign_id &&
239
+ flight_id == o.flight_id &&
240
+ ad_id == o.ad_id &&
241
+ click_url == o.click_url &&
242
+ properties == o.properties &&
243
+ event_ids == o.event_ids &&
244
+ overrides == o.overrides &&
245
+ content_keys == o.content_keys &&
246
+ count == o.count &&
247
+ proportionality == o.proportionality &&
248
+ ecpm_partition == o.ecpm_partition
249
+ end
250
+
251
+ # @see the `==` method
252
+ # @param [Object] Object to be compared
253
+ def eql?(o)
254
+ self == o
255
+ end
256
+
257
+ # Calculates hash code according to all attributes.
258
+ # @return [Integer] Hash code
259
+ def hash
260
+ [div_name, network_id, site_id, ad_types, zone_ids, campaign_id, flight_id, ad_id, click_url, properties, event_ids, overrides, content_keys, count, proportionality, ecpm_partition].hash
261
+ end
262
+
263
+ # Builds the object from hash
264
+ # @param [Hash] attributes Model attributes in the form of hash
265
+ # @return [Object] Returns the model itself
266
+ def self.build_from_hash(attributes)
267
+ new.build_from_hash(attributes)
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def build_from_hash(attributes)
274
+ return nil unless attributes.is_a?(Hash)
275
+ self.class.openapi_types.each_pair do |key, type|
276
+ if type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
280
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
281
+ end
282
+ elsif !attributes[self.class.attribute_map[key]].nil?
283
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
284
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
285
+ end
286
+
287
+ self
288
+ end
289
+
290
+ # Deserializes the data based on type
291
+ # @param string type Data type
292
+ # @param string value Value to be deserialized
293
+ # @return [Object] Deserialized data
294
+ def _deserialize(type, value)
295
+ case type.to_sym
296
+ when :DateTime
297
+ DateTime.parse(value)
298
+ when :Date
299
+ Date.parse(value)
300
+ when :String
301
+ value.to_s
302
+ when :Integer
303
+ value.to_i
304
+ when :Float
305
+ value.to_f
306
+ when :Boolean
307
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
308
+ true
309
+ else
310
+ false
311
+ end
312
+ when :Object
313
+ # generic object (usually a Hash), return directly
314
+ value
315
+ when /\AArray<(?<inner_type>.+)>\z/
316
+ inner_type = Regexp.last_match[:inner_type]
317
+ value.map { |v| _deserialize(inner_type, v) }
318
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
319
+ k_type = Regexp.last_match[:k_type]
320
+ v_type = Regexp.last_match[:v_type]
321
+ {}.tap do |hash|
322
+ value.each do |k, v|
323
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
324
+ end
325
+ end
326
+ else # model
327
+ AdzerkDecisionSdk.const_get(type).build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ if value.nil?
350
+ is_nullable = self.class.openapi_nullable.include?(attr)
351
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
352
+ end
353
+
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map { |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+ end
377
+ end
@@ -0,0 +1,242 @@
1
+ =begin
2
+ #Adzerk Decision API
3
+
4
+ #Adzerk Decision API
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AdzerkDecisionSdk
16
+ class PricingData
17
+ attr_accessor :price
18
+
19
+ attr_accessor :clear_price
20
+
21
+ attr_accessor :revenue
22
+
23
+ attr_accessor :rate_type
24
+
25
+ attr_accessor :e_cpm
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'price' => :'price',
31
+ :'clear_price' => :'clearPrice',
32
+ :'revenue' => :'revenue',
33
+ :'rate_type' => :'rateType',
34
+ :'e_cpm' => :'eCPM'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'price' => :'Float',
42
+ :'clear_price' => :'Float',
43
+ :'revenue' => :'Float',
44
+ :'rate_type' => :'Integer',
45
+ :'e_cpm' => :'Float'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AdzerkDecisionSdk::PricingData` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AdzerkDecisionSdk::PricingData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'price')
71
+ self.price = attributes[:'price']
72
+ end
73
+
74
+ if attributes.key?(:'clear_price')
75
+ self.clear_price = attributes[:'clear_price']
76
+ end
77
+
78
+ if attributes.key?(:'revenue')
79
+ self.revenue = attributes[:'revenue']
80
+ end
81
+
82
+ if attributes.key?(:'rate_type')
83
+ self.rate_type = attributes[:'rate_type']
84
+ end
85
+
86
+ if attributes.key?(:'e_cpm')
87
+ self.e_cpm = attributes[:'e_cpm']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
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
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ price == o.price &&
110
+ clear_price == o.clear_price &&
111
+ revenue == o.revenue &&
112
+ rate_type == o.rate_type &&
113
+ e_cpm == o.e_cpm
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
+ [price, clear_price, revenue, rate_type, e_cpm].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
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ AdzerkDecisionSdk.const_get(type).build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end