late-sdk 0.0.856 → 0.0.857

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -2
  3. data/docs/AdCampaignsApi.md +364 -6
  4. data/docs/{ListAdKeywords200ResponseKeywordsInner.md → AdKeyword.md} +7 -3
  5. data/docs/AdKeywordMetrics.md +30 -0
  6. data/docs/AddAdKeywords201Response.md +18 -0
  7. data/docs/AddAdKeywordsRequest.md +24 -0
  8. data/docs/AddAdKeywordsRequestKeywordsInner.md +20 -0
  9. data/docs/AddAdKeywordsRequestKeywordsInnerAnyOf.md +20 -0
  10. data/docs/CreateStandaloneAdRequest.md +4 -2
  11. data/docs/KeywordEntry.md +49 -0
  12. data/docs/ListAdKeywords200Response.md +1 -1
  13. data/docs/ListCampaignNegativeKeywords200Response.md +18 -0
  14. data/docs/ListCampaignNegativeKeywords200ResponseKeywordsInner.md +22 -0
  15. data/docs/RemoveAdKeyword200Response.md +20 -0
  16. data/docs/ReplaceCampaignNegativeKeywords200Response.md +22 -0
  17. data/docs/ReplaceCampaignNegativeKeywordsRequest.md +20 -0
  18. data/docs/UpdateAdKeyword200Response.md +18 -0
  19. data/docs/{UpdateAdStatusRequest.md → UpdateAdKeywordRequest.md} +2 -2
  20. data/lib/zernio-sdk/api/ad_campaigns_api.rb +358 -9
  21. data/lib/zernio-sdk/models/{list_ad_keywords200_response_keywords_inner.rb → ad_keyword.rb} +28 -8
  22. data/lib/zernio-sdk/models/ad_keyword_metrics.rb +207 -0
  23. data/lib/zernio-sdk/models/add_ad_keywords201_response.rb +149 -0
  24. data/lib/zernio-sdk/models/add_ad_keywords_request.rb +250 -0
  25. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner.rb +103 -0
  26. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner_any_of.rb +225 -0
  27. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +55 -5
  28. data/lib/zernio-sdk/models/keyword_entry.rb +105 -0
  29. data/lib/zernio-sdk/models/list_ad_keywords200_response.rb +1 -1
  30. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response.rb +149 -0
  31. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response_keywords_inner.rb +199 -0
  32. data/lib/zernio-sdk/models/remove_ad_keyword200_response.rb +157 -0
  33. data/lib/zernio-sdk/models/replace_campaign_negative_keywords200_response.rb +170 -0
  34. data/lib/zernio-sdk/models/replace_campaign_negative_keywords_request.rb +219 -0
  35. data/lib/zernio-sdk/models/update_ad_keyword200_response.rb +147 -0
  36. data/lib/zernio-sdk/models/{update_ad_status_request.rb → update_ad_keyword_request.rb} +3 -3
  37. data/lib/zernio-sdk/version.rb +1 -1
  38. data/lib/zernio-sdk.rb +14 -2
  39. data/openapi.yaml +257 -21
  40. data/spec/api/ad_campaigns_api_spec.rb +64 -1
  41. data/spec/models/ad_keyword_metrics_spec.rb +72 -0
  42. data/spec/models/{list_ad_keywords200_response_keywords_inner_spec.rb → ad_keyword_spec.rb} +18 -6
  43. data/spec/models/add_ad_keywords201_response_spec.rb +36 -0
  44. data/spec/models/add_ad_keywords_request_keywords_inner_any_of_spec.rb +46 -0
  45. data/spec/models/add_ad_keywords_request_keywords_inner_spec.rb +21 -0
  46. data/spec/models/add_ad_keywords_request_spec.rb +54 -0
  47. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  48. data/spec/models/keyword_entry_spec.rb +32 -0
  49. data/spec/models/list_campaign_negative_keywords200_response_keywords_inner_spec.rb +52 -0
  50. data/spec/models/list_campaign_negative_keywords200_response_spec.rb +36 -0
  51. data/spec/models/remove_ad_keyword200_response_spec.rb +42 -0
  52. data/spec/models/replace_campaign_negative_keywords200_response_spec.rb +48 -0
  53. data/spec/models/replace_campaign_negative_keywords_request_spec.rb +46 -0
  54. data/spec/models/update_ad_keyword200_response_spec.rb +36 -0
  55. data/spec/models/{update_ad_status_request_spec.rb → update_ad_keyword_request_spec.rb} +6 -6
  56. data/zernio-sdk-0.0.857.gem +0 -0
  57. metadata +58 -10
  58. data/zernio-sdk-0.0.856.gem +0 -0
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
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
+ module AddAdKeywordsRequestKeywordsInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'AddAdKeywordsRequestKeywordsInnerAnyOf',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = Zernio.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
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 AddAdKeywordsRequestKeywordsInnerAnyOf < ApiModelBase
18
+ attr_accessor :text
19
+
20
+ attr_accessor :match_type
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'text' => :'text',
48
+ :'match_type' => :'matchType'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'text' => :'String',
66
+ :'match_type' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AddAdKeywordsRequestKeywordsInnerAnyOf` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AddAdKeywordsRequestKeywordsInnerAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'text')
93
+ self.text = attributes[:'text']
94
+ else
95
+ self.text = nil
96
+ end
97
+
98
+ if attributes.key?(:'match_type')
99
+ self.match_type = attributes[:'match_type']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ if @text.nil?
109
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
110
+ end
111
+
112
+ if @text.to_s.length > 80
113
+ invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 80.')
114
+ end
115
+
116
+ if @text.to_s.length < 1
117
+ invalid_properties.push('invalid value for "text", the character length must be greater than or equal to 1.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @text.nil?
128
+ return false if @text.to_s.length > 80
129
+ return false if @text.to_s.length < 1
130
+ match_type_validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
131
+ return false unless match_type_validator.valid?(@match_type)
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] text Value to be assigned
137
+ def text=(text)
138
+ if text.nil?
139
+ fail ArgumentError, 'text cannot be nil'
140
+ end
141
+
142
+ if text.to_s.length > 80
143
+ fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 80.'
144
+ end
145
+
146
+ if text.to_s.length < 1
147
+ fail ArgumentError, 'invalid value for "text", the character length must be greater than or equal to 1.'
148
+ end
149
+
150
+ @text = text
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] match_type Object to be assigned
155
+ def match_type=(match_type)
156
+ validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
157
+ unless validator.valid?(match_type)
158
+ fail ArgumentError, "invalid value for \"match_type\", must be one of #{validator.allowable_values}."
159
+ end
160
+ @match_type = match_type
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ text == o.text &&
169
+ match_type == o.match_type
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [text, match_type].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -226,12 +226,15 @@ module Zernio
226
226
  # Google only
227
227
  attr_accessor :campaign_type
228
228
 
229
- # Google Search only. BROAD-match keywords on the new ad group. Editable later via PUT /v1/ads/{adId} targeting.keywords, which also sets match types.
229
+ # Google Search only. Keywords on the new ad group; entries are strings (BROAD) or { text, matchType }. Editable later via PUT /v1/ads/{adId} targeting.keywords.
230
230
  attr_accessor :keywords
231
231
 
232
- # Google Search only; other platforms return 400. BROAD-match negative keywords on the new ad group. Editable later via PUT /v1/ads/{adId} targeting.negativeKeywords.
232
+ # Google Search only; other platforms return 400. Ad-group-level negative keywords on the new ad group. Editable later via PUT /v1/ads/{adId} targeting.negativeKeywords.
233
233
  attr_accessor :negative_keywords
234
234
 
235
+ # Google Search only; other platforms return 400. Campaign-level negative keywords (campaign_criterion.negative), created alongside the ad group. Editable later via PUT /v1/ads/campaigns/{campaignId}/negative-keywords.
236
+ attr_accessor :campaign_negative_keywords
237
+
235
238
  # Google Search RSA only. Extra headlines.
236
239
  attr_accessor :additional_headlines
237
240
 
@@ -390,6 +393,7 @@ module Zernio
390
393
  :'campaign_type' => :'campaignType',
391
394
  :'keywords' => :'keywords',
392
395
  :'negative_keywords' => :'negativeKeywords',
396
+ :'campaign_negative_keywords' => :'campaignNegativeKeywords',
393
397
  :'additional_headlines' => :'additionalHeadlines',
394
398
  :'additional_descriptions' => :'additionalDescriptions',
395
399
  :'sitelinks' => :'sitelinks',
@@ -500,8 +504,9 @@ module Zernio
500
504
  :'placement_assets' => :'CreateStandaloneAdRequestPlacementAssets',
501
505
  :'audience_id' => :'String',
502
506
  :'campaign_type' => :'String',
503
- :'keywords' => :'Array<String>',
504
- :'negative_keywords' => :'Array<String>',
507
+ :'keywords' => :'Array<KeywordEntry>',
508
+ :'negative_keywords' => :'Array<KeywordEntry>',
509
+ :'campaign_negative_keywords' => :'Array<KeywordEntry>',
505
510
  :'additional_headlines' => :'Array<String>',
506
511
  :'additional_descriptions' => :'Array<String>',
507
512
  :'sitelinks' => :'Array<CreateStandaloneAdRequestSitelinksInner>',
@@ -913,6 +918,12 @@ module Zernio
913
918
  end
914
919
  end
915
920
 
921
+ if attributes.key?(:'campaign_negative_keywords')
922
+ if (value = attributes[:'campaign_negative_keywords']).is_a?(Array)
923
+ self.campaign_negative_keywords = value
924
+ end
925
+ end
926
+
916
927
  if attributes.key?(:'additional_headlines')
917
928
  if (value = attributes[:'additional_headlines']).is_a?(Array)
918
929
  self.additional_headlines = value
@@ -1125,6 +1136,14 @@ module Zernio
1125
1136
  invalid_properties.push('invalid value for "keywords", number of items must be less than or equal to 1000.')
1126
1137
  end
1127
1138
 
1139
+ if !@negative_keywords.nil? && @negative_keywords.length > 1000
1140
+ invalid_properties.push('invalid value for "negative_keywords", number of items must be less than or equal to 1000.')
1141
+ end
1142
+
1143
+ if !@campaign_negative_keywords.nil? && @campaign_negative_keywords.length > 1000
1144
+ invalid_properties.push('invalid value for "campaign_negative_keywords", number of items must be less than or equal to 1000.')
1145
+ end
1146
+
1128
1147
  if !@sitelinks.nil? && @sitelinks.length > 20
1129
1148
  invalid_properties.push('invalid value for "sitelinks", number of items must be less than or equal to 20.')
1130
1149
  end
@@ -1225,6 +1244,8 @@ module Zernio
1225
1244
  campaign_type_validator = EnumAttributeValidator.new('String', ["display", "search"])
1226
1245
  return false unless campaign_type_validator.valid?(@campaign_type)
1227
1246
  return false if !@keywords.nil? && @keywords.length > 1000
1247
+ return false if !@negative_keywords.nil? && @negative_keywords.length > 1000
1248
+ return false if !@campaign_negative_keywords.nil? && @campaign_negative_keywords.length > 1000
1228
1249
  return false if !@sitelinks.nil? && @sitelinks.length > 20
1229
1250
  return false if !@sitelinks.nil? && @sitelinks.length < 2
1230
1251
  return false if !@callouts.nil? && @callouts.length > 20
@@ -1635,6 +1656,34 @@ module Zernio
1635
1656
  @keywords = keywords
1636
1657
  end
1637
1658
 
1659
+ # Custom attribute writer method with validation
1660
+ # @param [Object] negative_keywords Value to be assigned
1661
+ def negative_keywords=(negative_keywords)
1662
+ if negative_keywords.nil?
1663
+ fail ArgumentError, 'negative_keywords cannot be nil'
1664
+ end
1665
+
1666
+ if negative_keywords.length > 1000
1667
+ fail ArgumentError, 'invalid value for "negative_keywords", number of items must be less than or equal to 1000.'
1668
+ end
1669
+
1670
+ @negative_keywords = negative_keywords
1671
+ end
1672
+
1673
+ # Custom attribute writer method with validation
1674
+ # @param [Object] campaign_negative_keywords Value to be assigned
1675
+ def campaign_negative_keywords=(campaign_negative_keywords)
1676
+ if campaign_negative_keywords.nil?
1677
+ fail ArgumentError, 'campaign_negative_keywords cannot be nil'
1678
+ end
1679
+
1680
+ if campaign_negative_keywords.length > 1000
1681
+ fail ArgumentError, 'invalid value for "campaign_negative_keywords", number of items must be less than or equal to 1000.'
1682
+ end
1683
+
1684
+ @campaign_negative_keywords = campaign_negative_keywords
1685
+ end
1686
+
1638
1687
  # Custom attribute writer method with validation
1639
1688
  # @param [Object] sitelinks Value to be assigned
1640
1689
  def sitelinks=(sitelinks)
@@ -1861,6 +1910,7 @@ module Zernio
1861
1910
  campaign_type == o.campaign_type &&
1862
1911
  keywords == o.keywords &&
1863
1912
  negative_keywords == o.negative_keywords &&
1913
+ campaign_negative_keywords == o.campaign_negative_keywords &&
1864
1914
  additional_headlines == o.additional_headlines &&
1865
1915
  additional_descriptions == o.additional_descriptions &&
1866
1916
  sitelinks == o.sitelinks &&
@@ -1892,7 +1942,7 @@ module Zernio
1892
1942
  # Calculates hash code according to all attributes.
1893
1943
  # @return [Integer] Hash code
1894
1944
  def hash
1895
- [account_id, ad_account_id, name, campaign_name, ad_set_name, ad_name, tracking, goal, optimization_goal, billing_event, buying_type, rf_prediction_id, creative_features, multi_advertiser, validate_only, budget_amount, budget_type, status, campaign_status, budget_level, currency, headline, long_headline, body, description, bodies, headlines, descriptions, call_to_action, link_url, lead_gen_form_id, image_url, images, video, creatives, ad_set_id, existing_campaign_id, existing_creative_id, business_name, board_id, organization_id, targeting, countries, cities, regions, age_min, age_max, interests, zips, metros, custom_locations, behaviors, work_positions, work_employers, work_industries, income_tier, languages, placements, saved_targeting_id, raw_targeting, special_ad_categories, special_ad_category_country, regional_regulated_categories, regional_regulation_identities, end_date, start_date, instagram_account_id, dynamic_creative, carousel_cards, default_locale, translations, placement_assets, audience_id, campaign_type, keywords, negative_keywords, additional_headlines, additional_descriptions, sitelinks, callouts, structured_snippets, advantage_audience, attribution_spec, gender, bid_strategy, bid_amount, roas_average_floor, value_rule_set_id, value_rules_applied, platform_specific_data, dsa_beneficiary, dsa_payor, brand_identity, identity_type, smart_plus, promoted_object].hash
1945
+ [account_id, ad_account_id, name, campaign_name, ad_set_name, ad_name, tracking, goal, optimization_goal, billing_event, buying_type, rf_prediction_id, creative_features, multi_advertiser, validate_only, budget_amount, budget_type, status, campaign_status, budget_level, currency, headline, long_headline, body, description, bodies, headlines, descriptions, call_to_action, link_url, lead_gen_form_id, image_url, images, video, creatives, ad_set_id, existing_campaign_id, existing_creative_id, business_name, board_id, organization_id, targeting, countries, cities, regions, age_min, age_max, interests, zips, metros, custom_locations, behaviors, work_positions, work_employers, work_industries, income_tier, languages, placements, saved_targeting_id, raw_targeting, special_ad_categories, special_ad_category_country, regional_regulated_categories, regional_regulation_identities, end_date, start_date, instagram_account_id, dynamic_creative, carousel_cards, default_locale, translations, placement_assets, audience_id, campaign_type, keywords, negative_keywords, campaign_negative_keywords, additional_headlines, additional_descriptions, sitelinks, callouts, structured_snippets, advantage_audience, attribution_spec, gender, bid_strategy, bid_amount, roas_average_floor, value_rule_set_id, value_rules_applied, platform_specific_data, dsa_beneficiary, dsa_payor, brand_identity, identity_type, smart_plus, promoted_object].hash
1896
1946
  end
1897
1947
 
1898
1948
  # Builds the object from hash
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
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
+ # A Google Search keyword: a bare string (BROAD match), or an object naming the match type.
18
+ module KeywordEntry
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'AddAdKeywordsRequestKeywordsInnerAnyOf',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = Zernio.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -40,7 +40,7 @@ module Zernio
40
40
  # Attribute type mapping.
41
41
  def self.openapi_types
42
42
  {
43
- :'keywords' => :'Array<ListAdKeywords200ResponseKeywordsInner>',
43
+ :'keywords' => :'Array<AdKeyword>',
44
44
  :'pagination' => :'Pagination'
45
45
  }
46
46
  end