late-sdk 0.0.715 → 0.0.716

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -10
  3. data/docs/AdAnalyticsResponse.md +22 -0
  4. data/docs/{GetAdAnalytics200ResponseAd.md → AdAnalyticsResponseAd.md} +2 -4
  5. data/docs/AdCampaignsApi.md +12 -12
  6. data/docs/AdInsightsApi.md +8 -8
  7. data/docs/AdTreeResponse.md +22 -0
  8. data/docs/AdsListResponse.md +22 -0
  9. data/docs/AdsTimelineResponse.md +20 -0
  10. data/docs/{GetAdsTimeline200ResponseRowsInner.md → AdsTimelineResponseRowsInner.md} +2 -2
  11. data/docs/CampaignAnalyticsResponse.md +22 -0
  12. data/docs/{GetCampaignAnalytics200ResponseAnalytics.md → CampaignAnalyticsResponseAnalytics.md} +3 -3
  13. data/docs/{GetCampaignAnalytics200ResponseAnalyticsDailyInner.md → CampaignAnalyticsResponseAnalyticsDailyInner.md} +2 -2
  14. data/docs/{GetCampaignAnalytics200ResponseCampaign.md → CampaignAnalyticsResponseCampaign.md} +2 -2
  15. data/docs/GetAdAnalytics202Response.md +22 -0
  16. data/docs/GetAdTree202Response.md +22 -0
  17. data/docs/GetAdsTimeline202Response.md +20 -0
  18. data/docs/GetCampaignAnalytics202Response.md +22 -0
  19. data/docs/ListAds202Response.md +22 -0
  20. data/lib/zernio-sdk/api/ad_campaigns_api.rb +9 -9
  21. data/lib/zernio-sdk/api/ad_insights_api.rb +6 -6
  22. data/lib/zernio-sdk/models/{get_ad_analytics200_response.rb → ad_analytics_response.rb} +15 -15
  23. data/lib/zernio-sdk/models/{get_ad_analytics200_response_ad.rb → ad_analytics_response_ad.rb} +4 -47
  24. data/lib/zernio-sdk/models/{get_ad_tree200_response.rb → ad_tree_response.rb} +17 -17
  25. data/lib/zernio-sdk/models/{list_ads200_response.rb → ads_list_response.rb} +17 -17
  26. data/lib/zernio-sdk/models/{get_ads_timeline200_response.rb → ads_timeline_response.rb} +17 -17
  27. data/lib/zernio-sdk/models/{get_ads_timeline200_response_rows_inner.rb → ads_timeline_response_rows_inner.rb} +3 -3
  28. data/lib/zernio-sdk/models/{get_campaign_analytics200_response.rb → campaign_analytics_response.rb} +15 -15
  29. data/lib/zernio-sdk/models/{get_campaign_analytics200_response_analytics.rb → campaign_analytics_response_analytics.rb} +4 -4
  30. data/lib/zernio-sdk/models/{get_campaign_analytics200_response_analytics_daily_inner.rb → campaign_analytics_response_analytics_daily_inner.rb} +3 -3
  31. data/lib/zernio-sdk/models/{get_campaign_analytics200_response_campaign.rb → campaign_analytics_response_campaign.rb} +3 -3
  32. data/lib/zernio-sdk/models/get_ad_analytics202_response.rb +213 -0
  33. data/lib/zernio-sdk/models/get_ad_tree202_response.rb +215 -0
  34. data/lib/zernio-sdk/models/get_ads_timeline202_response.rb +206 -0
  35. data/lib/zernio-sdk/models/get_campaign_analytics202_response.rb +213 -0
  36. data/lib/zernio-sdk/models/list_ads202_response.rb +215 -0
  37. data/lib/zernio-sdk/version.rb +1 -1
  38. data/lib/zernio-sdk.rb +15 -10
  39. data/openapi.yaml +190 -122
  40. data/spec/api/ad_campaigns_api_spec.rb +3 -3
  41. data/spec/api/ad_insights_api_spec.rb +2 -2
  42. data/spec/models/{get_campaign_analytics200_response_campaign_spec.rb → ad_analytics_response_ad_spec.rb} +6 -6
  43. data/spec/models/{get_ad_analytics200_response_spec.rb → ad_analytics_response_spec.rb} +8 -8
  44. data/spec/models/{get_ad_tree200_response_spec.rb → ad_tree_response_spec.rb} +8 -8
  45. data/spec/models/{list_ads200_response_spec.rb → ads_list_response_spec.rb} +8 -8
  46. data/spec/models/{get_ads_timeline200_response_rows_inner_spec.rb → ads_timeline_response_rows_inner_spec.rb} +6 -6
  47. data/spec/models/{get_ads_timeline200_response_spec.rb → ads_timeline_response_spec.rb} +8 -8
  48. data/spec/models/{get_campaign_analytics200_response_analytics_daily_inner_spec.rb → campaign_analytics_response_analytics_daily_inner_spec.rb} +6 -6
  49. data/spec/models/{get_campaign_analytics200_response_analytics_spec.rb → campaign_analytics_response_analytics_spec.rb} +6 -6
  50. data/spec/models/{get_ad_analytics200_response_ad_spec.rb → campaign_analytics_response_campaign_spec.rb} +6 -16
  51. data/spec/models/{get_campaign_analytics200_response_spec.rb → campaign_analytics_response_spec.rb} +8 -8
  52. data/spec/models/get_ad_analytics202_response_spec.rb +52 -0
  53. data/spec/models/get_ad_tree202_response_spec.rb +52 -0
  54. data/spec/models/get_ads_timeline202_response_spec.rb +46 -0
  55. data/spec/models/get_campaign_analytics202_response_spec.rb +52 -0
  56. data/spec/models/list_ads202_response_spec.rb +52 -0
  57. data/zernio-sdk-0.0.716.gem +0 -0
  58. metadata +62 -42
  59. data/docs/GetAdAnalytics200Response.md +0 -22
  60. data/docs/GetAdTree200Response.md +0 -22
  61. data/docs/GetAdsTimeline200Response.md +0 -20
  62. data/docs/GetCampaignAnalytics200Response.md +0 -22
  63. data/docs/ListAds200Response.md +0 -22
  64. data/zernio-sdk-0.0.715.gem +0 -0
@@ -14,19 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class GetCampaignAnalytics200Response < ApiModelBase
18
- attr_accessor :campaign
19
-
20
- # Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
17
+ class CampaignAnalyticsResponse < ApiModelBase
18
+ # Present and true while historical data is being backfilled.
21
19
  attr_accessor :backfill_pending
22
20
 
21
+ attr_accessor :campaign
22
+
23
23
  attr_accessor :analytics
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
26
26
  def self.attribute_map
27
27
  {
28
- :'campaign' => :'campaign',
29
28
  :'backfill_pending' => :'backfillPending',
29
+ :'campaign' => :'campaign',
30
30
  :'analytics' => :'analytics'
31
31
  }
32
32
  end
@@ -44,9 +44,9 @@ module Zernio
44
44
  # Attribute type mapping.
45
45
  def self.openapi_types
46
46
  {
47
- :'campaign' => :'GetCampaignAnalytics200ResponseCampaign',
48
47
  :'backfill_pending' => :'Boolean',
49
- :'analytics' => :'GetCampaignAnalytics200ResponseAnalytics'
48
+ :'campaign' => :'CampaignAnalyticsResponseCampaign',
49
+ :'analytics' => :'CampaignAnalyticsResponseAnalytics'
50
50
  }
51
51
  end
52
52
 
@@ -60,26 +60,26 @@ module Zernio
60
60
  # @param [Hash] attributes Model attributes in the form of hash
61
61
  def initialize(attributes = {})
62
62
  if (!attributes.is_a?(Hash))
63
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetCampaignAnalytics200Response` initialize method"
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CampaignAnalyticsResponse` initialize method"
64
64
  end
65
65
 
66
66
  # check to see if the attribute exists and convert string to symbol for hash key
67
67
  acceptable_attribute_map = self.class.acceptable_attribute_map
68
68
  attributes = attributes.each_with_object({}) { |(k, v), h|
69
69
  if (!acceptable_attribute_map.key?(k.to_sym))
70
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetCampaignAnalytics200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CampaignAnalyticsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
71
71
  end
72
72
  h[k.to_sym] = v
73
73
  }
74
74
 
75
- if attributes.key?(:'campaign')
76
- self.campaign = attributes[:'campaign']
77
- end
78
-
79
75
  if attributes.key?(:'backfill_pending')
80
76
  self.backfill_pending = attributes[:'backfill_pending']
81
77
  end
82
78
 
79
+ if attributes.key?(:'campaign')
80
+ self.campaign = attributes[:'campaign']
81
+ end
82
+
83
83
  if attributes.key?(:'analytics')
84
84
  self.analytics = attributes[:'analytics']
85
85
  end
@@ -105,8 +105,8 @@ module Zernio
105
105
  def ==(o)
106
106
  return true if self.equal?(o)
107
107
  self.class == o.class &&
108
- campaign == o.campaign &&
109
108
  backfill_pending == o.backfill_pending &&
109
+ campaign == o.campaign &&
110
110
  analytics == o.analytics
111
111
  end
112
112
 
@@ -119,7 +119,7 @@ module Zernio
119
119
  # Calculates hash code according to all attributes.
120
120
  # @return [Integer] Hash code
121
121
  def hash
122
- [campaign, backfill_pending, analytics].hash
122
+ [backfill_pending, campaign, analytics].hash
123
123
  end
124
124
 
125
125
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class GetCampaignAnalytics200ResponseAnalytics < ApiModelBase
17
+ class CampaignAnalyticsResponseAnalytics < ApiModelBase
18
18
  attr_accessor :summary
19
19
 
20
20
  attr_accessor :daily
@@ -44,7 +44,7 @@ module Zernio
44
44
  def self.openapi_types
45
45
  {
46
46
  :'summary' => :'AdMetrics',
47
- :'daily' => :'Array<GetCampaignAnalytics200ResponseAnalyticsDailyInner>',
47
+ :'daily' => :'Array<CampaignAnalyticsResponseAnalyticsDailyInner>',
48
48
  :'breakdowns' => :'Hash<String, Array<Object>>'
49
49
  }
50
50
  end
@@ -59,14 +59,14 @@ module Zernio
59
59
  # @param [Hash] attributes Model attributes in the form of hash
60
60
  def initialize(attributes = {})
61
61
  if (!attributes.is_a?(Hash))
62
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetCampaignAnalytics200ResponseAnalytics` initialize method"
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CampaignAnalyticsResponseAnalytics` initialize method"
63
63
  end
64
64
 
65
65
  # check to see if the attribute exists and convert string to symbol for hash key
66
66
  acceptable_attribute_map = self.class.acceptable_attribute_map
67
67
  attributes = attributes.each_with_object({}) { |(k, v), h|
68
68
  if (!acceptable_attribute_map.key?(k.to_sym))
69
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetCampaignAnalytics200ResponseAnalytics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CampaignAnalyticsResponseAnalytics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
70
  end
71
71
  h[k.to_sym] = v
72
72
  }
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class GetCampaignAnalytics200ResponseAnalyticsDailyInner < ApiModelBase
17
+ class CampaignAnalyticsResponseAnalyticsDailyInner < ApiModelBase
18
18
  attr_accessor :spend
19
19
 
20
20
  attr_accessor :impressions
@@ -222,14 +222,14 @@ module Zernio
222
222
  # @param [Hash] attributes Model attributes in the form of hash
223
223
  def initialize(attributes = {})
224
224
  if (!attributes.is_a?(Hash))
225
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetCampaignAnalytics200ResponseAnalyticsDailyInner` initialize method"
225
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CampaignAnalyticsResponseAnalyticsDailyInner` initialize method"
226
226
  end
227
227
 
228
228
  # check to see if the attribute exists and convert string to symbol for hash key
229
229
  acceptable_attribute_map = self.class.acceptable_attribute_map
230
230
  attributes = attributes.each_with_object({}) { |(k, v), h|
231
231
  if (!acceptable_attribute_map.key?(k.to_sym))
232
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetCampaignAnalytics200ResponseAnalyticsDailyInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
232
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CampaignAnalyticsResponseAnalyticsDailyInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
233
233
  end
234
234
  h[k.to_sym] = v
235
235
  }
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class GetCampaignAnalytics200ResponseCampaign < ApiModelBase
17
+ class CampaignAnalyticsResponseCampaign < ApiModelBase
18
18
  attr_accessor :id
19
19
 
20
20
  attr_accessor :name
@@ -72,14 +72,14 @@ module Zernio
72
72
  # @param [Hash] attributes Model attributes in the form of hash
73
73
  def initialize(attributes = {})
74
74
  if (!attributes.is_a?(Hash))
75
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetCampaignAnalytics200ResponseCampaign` initialize method"
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CampaignAnalyticsResponseCampaign` initialize method"
76
76
  end
77
77
 
78
78
  # check to see if the attribute exists and convert string to symbol for hash key
79
79
  acceptable_attribute_map = self.class.acceptable_attribute_map
80
80
  attributes = attributes.each_with_object({}) { |(k, v), h|
81
81
  if (!acceptable_attribute_map.key?(k.to_sym))
82
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetCampaignAnalytics200ResponseCampaign`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CampaignAnalyticsResponseCampaign`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
83
  end
84
84
  h[k.to_sym] = v
85
85
  }
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class GetAdAnalytics202Response < ApiModelBase
18
+ attr_accessor :backfill_pending
19
+
20
+ attr_accessor :ad
21
+
22
+ attr_accessor :analytics
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'backfill_pending' => :'backfillPending',
50
+ :'ad' => :'ad',
51
+ :'analytics' => :'analytics'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'backfill_pending' => :'Boolean',
69
+ :'ad' => :'AdAnalyticsResponseAd',
70
+ :'analytics' => :'CampaignAnalyticsResponseAnalytics'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # List of class defined in allOf (OpenAPI v3)
81
+ def self.openapi_all_of
82
+ [
83
+ :'AdAnalyticsResponse'
84
+ ]
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetAdAnalytics202Response` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetAdAnalytics202Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'backfill_pending')
104
+ self.backfill_pending = attributes[:'backfill_pending']
105
+ else
106
+ self.backfill_pending = nil
107
+ end
108
+
109
+ if attributes.key?(:'ad')
110
+ self.ad = attributes[:'ad']
111
+ end
112
+
113
+ if attributes.key?(:'analytics')
114
+ self.analytics = attributes[:'analytics']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @backfill_pending.nil?
124
+ invalid_properties.push('invalid value for "backfill_pending", backfill_pending cannot be nil.')
125
+ end
126
+
127
+ invalid_properties
128
+ end
129
+
130
+ # Check to see if the all the properties in the model are valid
131
+ # @return true if the model is valid
132
+ def valid?
133
+ warn '[DEPRECATED] the `valid?` method is obsolete'
134
+ return false if @backfill_pending.nil?
135
+ backfill_pending_validator = EnumAttributeValidator.new('Boolean', ["true"])
136
+ return false unless backfill_pending_validator.valid?(@backfill_pending)
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method checking allowed values (enum).
141
+ # @param [Object] backfill_pending Object to be assigned
142
+ def backfill_pending=(backfill_pending)
143
+ validator = EnumAttributeValidator.new('Boolean', ["true"])
144
+ unless validator.valid?(backfill_pending)
145
+ fail ArgumentError, "invalid value for \"backfill_pending\", must be one of #{validator.allowable_values}."
146
+ end
147
+ @backfill_pending = backfill_pending
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ backfill_pending == o.backfill_pending &&
156
+ ad == o.ad &&
157
+ analytics == o.analytics
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [backfill_pending, ad, analytics].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ end
212
+
213
+ end
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class GetAdTree202Response < ApiModelBase
18
+ attr_accessor :campaigns
19
+
20
+ attr_accessor :pagination
21
+
22
+ attr_accessor :backfill_pending
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'campaigns' => :'campaigns',
50
+ :'pagination' => :'pagination',
51
+ :'backfill_pending' => :'backfillPending'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'campaigns' => :'Array<AdTreeCampaign>',
69
+ :'pagination' => :'Pagination',
70
+ :'backfill_pending' => :'Boolean'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # List of class defined in allOf (OpenAPI v3)
81
+ def self.openapi_all_of
82
+ [
83
+ :'AdTreeResponse'
84
+ ]
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetAdTree202Response` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetAdTree202Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'campaigns')
104
+ if (value = attributes[:'campaigns']).is_a?(Array)
105
+ self.campaigns = value
106
+ end
107
+ end
108
+
109
+ if attributes.key?(:'pagination')
110
+ self.pagination = attributes[:'pagination']
111
+ end
112
+
113
+ if attributes.key?(:'backfill_pending')
114
+ self.backfill_pending = attributes[:'backfill_pending']
115
+ else
116
+ self.backfill_pending = nil
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
+ invalid_properties = Array.new
125
+ if @backfill_pending.nil?
126
+ invalid_properties.push('invalid value for "backfill_pending", backfill_pending cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @backfill_pending.nil?
137
+ backfill_pending_validator = EnumAttributeValidator.new('Boolean', ["true"])
138
+ return false unless backfill_pending_validator.valid?(@backfill_pending)
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method checking allowed values (enum).
143
+ # @param [Object] backfill_pending Object to be assigned
144
+ def backfill_pending=(backfill_pending)
145
+ validator = EnumAttributeValidator.new('Boolean', ["true"])
146
+ unless validator.valid?(backfill_pending)
147
+ fail ArgumentError, "invalid value for \"backfill_pending\", must be one of #{validator.allowable_values}."
148
+ end
149
+ @backfill_pending = backfill_pending
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(o)
155
+ return true if self.equal?(o)
156
+ self.class == o.class &&
157
+ campaigns == o.campaigns &&
158
+ pagination == o.pagination &&
159
+ backfill_pending == o.backfill_pending
160
+ end
161
+
162
+ # @see the `==` method
163
+ # @param [Object] Object to be compared
164
+ def eql?(o)
165
+ self == o
166
+ end
167
+
168
+ # Calculates hash code according to all attributes.
169
+ # @return [Integer] Hash code
170
+ def hash
171
+ [campaigns, pagination, backfill_pending].hash
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def self.build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ attributes = attributes.transform_keys(&:to_sym)
180
+ transformed_hash = {}
181
+ openapi_types.each_pair do |key, type|
182
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = nil
184
+ elsif type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[attribute_map[key]].is_a?(Array)
188
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
189
+ end
190
+ elsif !attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
192
+ end
193
+ end
194
+ new(transformed_hash)
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ end
214
+
215
+ end