adzerk_decision_sdk 1.0.0.pre.beta.2 → 1.0.0.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +8 -10
- data/README.md +44 -4
- data/adzerk_decision_sdk.gemspec +3 -4
- data/docs/ConsentRequest.md +10 -9
- data/docs/Content.md +16 -15
- data/docs/Decision.md +28 -25
- data/docs/DecisionApi.md +30 -13
- data/docs/DecisionRequest.md +44 -33
- data/docs/DecisionResponse.md +12 -11
- data/docs/Event.md +10 -9
- data/docs/MatchedPoint.md +20 -0
- data/docs/Placement.md +46 -37
- data/docs/PricingData.md +16 -15
- data/docs/RequestLocation.md +19 -0
- data/docs/User.md +8 -7
- data/docs/UserdbApi.md +252 -140
- data/lib/adzerk_decision_sdk.rb +1 -1
- data/lib/adzerk_decision_sdk/api/decision_api.rb +5 -4
- data/lib/adzerk_decision_sdk/api/userdb_api.rb +37 -95
- data/lib/adzerk_decision_sdk/api_client.rb +50 -46
- data/lib/adzerk_decision_sdk/api_error.rb +1 -1
- data/lib/adzerk_decision_sdk/client.rb +2 -2
- data/lib/adzerk_decision_sdk/configuration.rb +39 -10
- data/lib/adzerk_decision_sdk/decision_client.rb +12 -1
- data/lib/adzerk_decision_sdk/models/consent_request.rb +19 -7
- data/lib/adzerk_decision_sdk/models/content.rb +20 -8
- data/lib/adzerk_decision_sdk/models/decision.rb +31 -8
- data/lib/adzerk_decision_sdk/models/decision_request.rb +74 -12
- data/lib/adzerk_decision_sdk/models/decision_response.rb +19 -7
- data/lib/adzerk_decision_sdk/models/event.rb +19 -7
- data/lib/adzerk_decision_sdk/models/matched_point.rb +227 -0
- data/lib/adzerk_decision_sdk/models/placement.rb +91 -12
- data/lib/adzerk_decision_sdk/models/pricing_data.rb +19 -7
- data/lib/adzerk_decision_sdk/models/{decision_data.rb → request_location.rb} +17 -44
- data/lib/adzerk_decision_sdk/models/user.rb +19 -7
- data/lib/adzerk_decision_sdk/pixel_client.rb +8 -2
- data/lib/adzerk_decision_sdk/user_db_client.rb +16 -2
- data/lib/adzerk_decision_sdk/version.rb +2 -2
- data/spec/spec_helper.rb +91 -0
- metadata +15 -33
- data/docs/DecisionData.md +0 -25
- data/pkg/adzerk_decision_sdk-1.0.0.gem +0 -0
- data/pkg/adzerk_decision_sdk-1.0.0.pre.beta.1.gem +0 -0
@@ -6,11 +6,12 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module AdzerkDecisionSdk
|
16
17
|
class DecisionRequest
|
@@ -55,6 +56,16 @@ module AdzerkDecisionSdk
|
|
55
56
|
# RTB requests only - sets an Identifier for Advertisers (IFA or IDFA)
|
56
57
|
attr_accessor :device_id
|
57
58
|
|
59
|
+
attr_accessor :parallel
|
60
|
+
|
61
|
+
attr_accessor :intended_latitude
|
62
|
+
|
63
|
+
attr_accessor :intended_longitude
|
64
|
+
|
65
|
+
attr_accessor :radius
|
66
|
+
|
67
|
+
attr_accessor :include_matched_points
|
68
|
+
|
58
69
|
# Attribute mapping from ruby-style variable name to JSON key.
|
59
70
|
def self.attribute_map
|
60
71
|
{
|
@@ -71,10 +82,20 @@ module AdzerkDecisionSdk
|
|
71
82
|
:'enable_bot_filtering' => :'enableBotFiltering',
|
72
83
|
:'enable_user_dbip' => :'enableUserDBIP',
|
73
84
|
:'consent' => :'consent',
|
74
|
-
:'device_id' => :'deviceID'
|
85
|
+
:'device_id' => :'deviceID',
|
86
|
+
:'parallel' => :'parallel',
|
87
|
+
:'intended_latitude' => :'intendedLatitude',
|
88
|
+
:'intended_longitude' => :'intendedLongitude',
|
89
|
+
:'radius' => :'radius',
|
90
|
+
:'include_matched_points' => :'includeMatchedPoints'
|
75
91
|
}
|
76
92
|
end
|
77
93
|
|
94
|
+
# Returns all the JSON keys this model knows about
|
95
|
+
def self.acceptable_attributes
|
96
|
+
attribute_map.values
|
97
|
+
end
|
98
|
+
|
78
99
|
# Attribute type mapping.
|
79
100
|
def self.openapi_types
|
80
101
|
{
|
@@ -91,7 +112,12 @@ module AdzerkDecisionSdk
|
|
91
112
|
:'enable_bot_filtering' => :'Boolean',
|
92
113
|
:'enable_user_dbip' => :'Boolean',
|
93
114
|
:'consent' => :'Object',
|
94
|
-
:'device_id' => :'String'
|
115
|
+
:'device_id' => :'String',
|
116
|
+
:'parallel' => :'Boolean',
|
117
|
+
:'intended_latitude' => :'Float',
|
118
|
+
:'intended_longitude' => :'Float',
|
119
|
+
:'radius' => :'Float',
|
120
|
+
:'include_matched_points' => :'Boolean'
|
95
121
|
}
|
96
122
|
end
|
97
123
|
|
@@ -109,7 +135,12 @@ module AdzerkDecisionSdk
|
|
109
135
|
:'enable_bot_filtering',
|
110
136
|
:'enable_user_dbip',
|
111
137
|
:'consent',
|
112
|
-
:'device_id'
|
138
|
+
:'device_id',
|
139
|
+
:'parallel',
|
140
|
+
:'intended_latitude',
|
141
|
+
:'intended_longitude',
|
142
|
+
:'radius',
|
143
|
+
:'include_matched_points'
|
113
144
|
])
|
114
145
|
end
|
115
146
|
|
@@ -189,6 +220,26 @@ module AdzerkDecisionSdk
|
|
189
220
|
if attributes.key?(:'device_id')
|
190
221
|
self.device_id = attributes[:'device_id']
|
191
222
|
end
|
223
|
+
|
224
|
+
if attributes.key?(:'parallel')
|
225
|
+
self.parallel = attributes[:'parallel']
|
226
|
+
end
|
227
|
+
|
228
|
+
if attributes.key?(:'intended_latitude')
|
229
|
+
self.intended_latitude = attributes[:'intended_latitude']
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.key?(:'intended_longitude')
|
233
|
+
self.intended_longitude = attributes[:'intended_longitude']
|
234
|
+
end
|
235
|
+
|
236
|
+
if attributes.key?(:'radius')
|
237
|
+
self.radius = attributes[:'radius']
|
238
|
+
end
|
239
|
+
|
240
|
+
if attributes.key?(:'include_matched_points')
|
241
|
+
self.include_matched_points = attributes[:'include_matched_points']
|
242
|
+
end
|
192
243
|
end
|
193
244
|
|
194
245
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -227,7 +278,12 @@ module AdzerkDecisionSdk
|
|
227
278
|
enable_bot_filtering == o.enable_bot_filtering &&
|
228
279
|
enable_user_dbip == o.enable_user_dbip &&
|
229
280
|
consent == o.consent &&
|
230
|
-
device_id == o.device_id
|
281
|
+
device_id == o.device_id &&
|
282
|
+
parallel == o.parallel &&
|
283
|
+
intended_latitude == o.intended_latitude &&
|
284
|
+
intended_longitude == o.intended_longitude &&
|
285
|
+
radius == o.radius &&
|
286
|
+
include_matched_points == o.include_matched_points
|
231
287
|
end
|
232
288
|
|
233
289
|
# @see the `==` method
|
@@ -239,7 +295,7 @@ module AdzerkDecisionSdk
|
|
239
295
|
# Calculates hash code according to all attributes.
|
240
296
|
# @return [Integer] Hash code
|
241
297
|
def hash
|
242
|
-
[placements, user, keywords, url, referrer, ip, blocked_creatives, is_mobile, include_pricing_data, notrack, enable_bot_filtering, enable_user_dbip, consent, device_id].hash
|
298
|
+
[placements, user, keywords, url, referrer, ip, blocked_creatives, is_mobile, include_pricing_data, notrack, enable_bot_filtering, enable_user_dbip, consent, device_id, parallel, intended_latitude, intended_longitude, radius, include_matched_points].hash
|
243
299
|
end
|
244
300
|
|
245
301
|
# Builds the object from hash
|
@@ -255,7 +311,9 @@ module AdzerkDecisionSdk
|
|
255
311
|
def build_from_hash(attributes)
|
256
312
|
return nil unless attributes.is_a?(Hash)
|
257
313
|
self.class.openapi_types.each_pair do |key, type|
|
258
|
-
if
|
314
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
315
|
+
self.send("#{key}=", nil)
|
316
|
+
elsif type =~ /\AArray<(.*)>/i
|
259
317
|
# check to ensure the input is an array given that the attribute
|
260
318
|
# is documented as an array but the input is not
|
261
319
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -263,7 +321,7 @@ module AdzerkDecisionSdk
|
|
263
321
|
end
|
264
322
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
265
323
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
266
|
-
end
|
324
|
+
end
|
267
325
|
end
|
268
326
|
|
269
327
|
self
|
@@ -275,8 +333,8 @@ module AdzerkDecisionSdk
|
|
275
333
|
# @return [Object] Deserialized data
|
276
334
|
def _deserialize(type, value)
|
277
335
|
case type.to_sym
|
278
|
-
when :
|
279
|
-
|
336
|
+
when :Time
|
337
|
+
Time.parse(value)
|
280
338
|
when :Date
|
281
339
|
Date.parse(value)
|
282
340
|
when :String
|
@@ -306,7 +364,9 @@ module AdzerkDecisionSdk
|
|
306
364
|
end
|
307
365
|
end
|
308
366
|
else # model
|
309
|
-
|
367
|
+
# models (e.g. Pet) or oneOf
|
368
|
+
klass = AdzerkDecisionSdk.const_get(type)
|
369
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
310
370
|
end
|
311
371
|
end
|
312
372
|
|
@@ -332,7 +392,7 @@ module AdzerkDecisionSdk
|
|
332
392
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
333
393
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
334
394
|
end
|
335
|
-
|
395
|
+
|
336
396
|
hash[param] = _to_hash(value)
|
337
397
|
end
|
338
398
|
hash
|
@@ -355,5 +415,7 @@ module AdzerkDecisionSdk
|
|
355
415
|
value
|
356
416
|
end
|
357
417
|
end
|
418
|
+
|
358
419
|
end
|
420
|
+
|
359
421
|
end
|
@@ -6,11 +6,12 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module AdzerkDecisionSdk
|
16
17
|
class DecisionResponse
|
@@ -29,6 +30,11 @@ module AdzerkDecisionSdk
|
|
29
30
|
}
|
30
31
|
end
|
31
32
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
32
38
|
# Attribute type mapping.
|
33
39
|
def self.openapi_types
|
34
40
|
{
|
@@ -120,7 +126,9 @@ module AdzerkDecisionSdk
|
|
120
126
|
def build_from_hash(attributes)
|
121
127
|
return nil unless attributes.is_a?(Hash)
|
122
128
|
self.class.openapi_types.each_pair do |key, type|
|
123
|
-
if
|
129
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
130
|
+
self.send("#{key}=", nil)
|
131
|
+
elsif type =~ /\AArray<(.*)>/i
|
124
132
|
# check to ensure the input is an array given that the attribute
|
125
133
|
# is documented as an array but the input is not
|
126
134
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -128,7 +136,7 @@ module AdzerkDecisionSdk
|
|
128
136
|
end
|
129
137
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
138
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
131
|
-
end
|
139
|
+
end
|
132
140
|
end
|
133
141
|
|
134
142
|
self
|
@@ -140,8 +148,8 @@ module AdzerkDecisionSdk
|
|
140
148
|
# @return [Object] Deserialized data
|
141
149
|
def _deserialize(type, value)
|
142
150
|
case type.to_sym
|
143
|
-
when :
|
144
|
-
|
151
|
+
when :Time
|
152
|
+
Time.parse(value)
|
145
153
|
when :Date
|
146
154
|
Date.parse(value)
|
147
155
|
when :String
|
@@ -171,7 +179,9 @@ module AdzerkDecisionSdk
|
|
171
179
|
end
|
172
180
|
end
|
173
181
|
else # model
|
174
|
-
|
182
|
+
# models (e.g. Pet) or oneOf
|
183
|
+
klass = AdzerkDecisionSdk.const_get(type)
|
184
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
185
|
end
|
176
186
|
end
|
177
187
|
|
@@ -197,7 +207,7 @@ module AdzerkDecisionSdk
|
|
197
207
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
198
208
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
199
209
|
end
|
200
|
-
|
210
|
+
|
201
211
|
hash[param] = _to_hash(value)
|
202
212
|
end
|
203
213
|
hash
|
@@ -220,5 +230,7 @@ module AdzerkDecisionSdk
|
|
220
230
|
value
|
221
231
|
end
|
222
232
|
end
|
233
|
+
|
223
234
|
end
|
235
|
+
|
224
236
|
end
|
@@ -6,11 +6,12 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module AdzerkDecisionSdk
|
16
17
|
class Event
|
@@ -26,6 +27,11 @@ module AdzerkDecisionSdk
|
|
26
27
|
}
|
27
28
|
end
|
28
29
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
29
35
|
# Attribute type mapping.
|
30
36
|
def self.openapi_types
|
31
37
|
{
|
@@ -111,7 +117,9 @@ module AdzerkDecisionSdk
|
|
111
117
|
def build_from_hash(attributes)
|
112
118
|
return nil unless attributes.is_a?(Hash)
|
113
119
|
self.class.openapi_types.each_pair do |key, type|
|
114
|
-
if
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
+
self.send("#{key}=", nil)
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
115
123
|
# check to ensure the input is an array given that the attribute
|
116
124
|
# is documented as an array but the input is not
|
117
125
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -119,7 +127,7 @@ module AdzerkDecisionSdk
|
|
119
127
|
end
|
120
128
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
129
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
-
end
|
130
|
+
end
|
123
131
|
end
|
124
132
|
|
125
133
|
self
|
@@ -131,8 +139,8 @@ module AdzerkDecisionSdk
|
|
131
139
|
# @return [Object] Deserialized data
|
132
140
|
def _deserialize(type, value)
|
133
141
|
case type.to_sym
|
134
|
-
when :
|
135
|
-
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
136
144
|
when :Date
|
137
145
|
Date.parse(value)
|
138
146
|
when :String
|
@@ -162,7 +170,9 @@ module AdzerkDecisionSdk
|
|
162
170
|
end
|
163
171
|
end
|
164
172
|
else # model
|
165
|
-
|
173
|
+
# models (e.g. Pet) or oneOf
|
174
|
+
klass = AdzerkDecisionSdk.const_get(type)
|
175
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
166
176
|
end
|
167
177
|
end
|
168
178
|
|
@@ -188,7 +198,7 @@ module AdzerkDecisionSdk
|
|
188
198
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
189
199
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
190
200
|
end
|
191
|
-
|
201
|
+
|
192
202
|
hash[param] = _to_hash(value)
|
193
203
|
end
|
194
204
|
hash
|
@@ -211,5 +221,7 @@ module AdzerkDecisionSdk
|
|
211
221
|
value
|
212
222
|
end
|
213
223
|
end
|
224
|
+
|
214
225
|
end
|
226
|
+
|
215
227
|
end
|
@@ -0,0 +1,227 @@
|
|
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: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module AdzerkDecisionSdk
|
17
|
+
class MatchedPoint
|
18
|
+
attr_accessor :lat
|
19
|
+
|
20
|
+
attr_accessor :lon
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'lat' => :'lat',
|
26
|
+
:'lon' => :'lon'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'lat' => :'String',
|
39
|
+
:'lon' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AdzerkDecisionSdk::MatchedPoint` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AdzerkDecisionSdk::MatchedPoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'lat')
|
65
|
+
self.lat = attributes[:'lat']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'lon')
|
69
|
+
self.lon = attributes[:'lon']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
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
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
lat == o.lat &&
|
92
|
+
lon == o.lon
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[lat, lon].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
+
self.send("#{key}=", nil)
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
# models (e.g. Pet) or oneOf
|
174
|
+
klass = AdzerkDecisionSdk.const_get(type)
|
175
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the string representation of the object
|
180
|
+
# @return [String] String presentation of the object
|
181
|
+
def to_s
|
182
|
+
to_hash.to_s
|
183
|
+
end
|
184
|
+
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_body
|
188
|
+
to_hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the object in the form of hash
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_hash
|
194
|
+
hash = {}
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
196
|
+
value = self.send(attr)
|
197
|
+
if value.nil?
|
198
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
199
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
200
|
+
end
|
201
|
+
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|