late-sdk 0.0.855 → 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.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/docs/AdCampaignsApi.md +364 -6
- data/docs/{ListAdKeywords200ResponseKeywordsInner.md → AdKeyword.md} +7 -3
- data/docs/AdKeywordMetrics.md +30 -0
- data/docs/AddAdKeywords201Response.md +18 -0
- data/docs/AddAdKeywordsRequest.md +24 -0
- data/docs/AddAdKeywordsRequestKeywordsInner.md +20 -0
- data/docs/AddAdKeywordsRequestKeywordsInnerAnyOf.md +20 -0
- data/docs/ConnectApi.md +2 -2
- data/docs/CreatePostRequest.md +6 -6
- data/docs/CreateStandaloneAdRequest.md +4 -2
- data/docs/CreateTrackingTagRequest.md +3 -1
- data/docs/KeywordEntry.md +49 -0
- data/docs/ListAdKeywords200Response.md +1 -1
- data/docs/ListCampaignNegativeKeywords200Response.md +18 -0
- data/docs/ListCampaignNegativeKeywords200ResponseKeywordsInner.md +22 -0
- data/docs/PostsApi.md +1 -1
- data/docs/RemoveAdKeyword200Response.md +20 -0
- data/docs/ReplaceCampaignNegativeKeywords200Response.md +22 -0
- data/docs/ReplaceCampaignNegativeKeywordsRequest.md +20 -0
- data/docs/TrackingTagsApi.md +1 -1
- data/docs/UpdateAdKeyword200Response.md +18 -0
- data/docs/{UpdateAdStatusRequest.md → UpdateAdKeywordRequest.md} +2 -2
- data/docs/WebhooksApi.md +2 -2
- data/lib/zernio-sdk/api/ad_campaigns_api.rb +358 -9
- data/lib/zernio-sdk/api/connect_api.rb +2 -2
- data/lib/zernio-sdk/api/posts_api.rb +2 -2
- data/lib/zernio-sdk/api/tracking_tags_api.rb +2 -2
- data/lib/zernio-sdk/api/webhooks_api.rb +4 -4
- data/lib/zernio-sdk/models/{list_ad_keywords200_response_keywords_inner.rb → ad_keyword.rb} +28 -8
- data/lib/zernio-sdk/models/ad_keyword_metrics.rb +207 -0
- data/lib/zernio-sdk/models/add_ad_keywords201_response.rb +149 -0
- data/lib/zernio-sdk/models/add_ad_keywords_request.rb +250 -0
- data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner.rb +103 -0
- data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner_any_of.rb +225 -0
- data/lib/zernio-sdk/models/create_post_request.rb +6 -0
- data/lib/zernio-sdk/models/create_standalone_ad_request.rb +55 -5
- data/lib/zernio-sdk/models/create_tracking_tag_request.rb +48 -4
- data/lib/zernio-sdk/models/keyword_entry.rb +105 -0
- data/lib/zernio-sdk/models/list_ad_keywords200_response.rb +1 -1
- data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response.rb +149 -0
- data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response_keywords_inner.rb +199 -0
- data/lib/zernio-sdk/models/remove_ad_keyword200_response.rb +157 -0
- data/lib/zernio-sdk/models/replace_campaign_negative_keywords200_response.rb +170 -0
- data/lib/zernio-sdk/models/replace_campaign_negative_keywords_request.rb +219 -0
- data/lib/zernio-sdk/models/update_ad_keyword200_response.rb +147 -0
- data/lib/zernio-sdk/models/{update_ad_status_request.rb → update_ad_keyword_request.rb} +3 -3
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +14 -2
- data/openapi.yaml +299 -32
- data/spec/api/ad_campaigns_api_spec.rb +64 -1
- data/spec/api/connect_api_spec.rb +1 -1
- data/spec/api/posts_api_spec.rb +1 -1
- data/spec/api/tracking_tags_api_spec.rb +1 -1
- data/spec/api/webhooks_api_spec.rb +2 -2
- data/spec/models/ad_keyword_metrics_spec.rb +72 -0
- data/spec/models/{list_ad_keywords200_response_keywords_inner_spec.rb → ad_keyword_spec.rb} +18 -6
- data/spec/models/add_ad_keywords201_response_spec.rb +36 -0
- data/spec/models/add_ad_keywords_request_keywords_inner_any_of_spec.rb +46 -0
- data/spec/models/add_ad_keywords_request_keywords_inner_spec.rb +21 -0
- data/spec/models/add_ad_keywords_request_spec.rb +54 -0
- data/spec/models/create_standalone_ad_request_spec.rb +6 -0
- data/spec/models/create_tracking_tag_request_spec.rb +10 -0
- data/spec/models/keyword_entry_spec.rb +32 -0
- data/spec/models/list_campaign_negative_keywords200_response_keywords_inner_spec.rb +52 -0
- data/spec/models/list_campaign_negative_keywords200_response_spec.rb +36 -0
- data/spec/models/remove_ad_keyword200_response_spec.rb +42 -0
- data/spec/models/replace_campaign_negative_keywords200_response_spec.rb +48 -0
- data/spec/models/replace_campaign_negative_keywords_request_spec.rb +46 -0
- data/spec/models/update_ad_keyword200_response_spec.rb +36 -0
- data/spec/models/{update_ad_status_request_spec.rb → update_ad_keyword_request_spec.rb} +6 -6
- data/zernio-sdk-0.0.857.gem +0 -0
- metadata +58 -10
- data/zernio-sdk-0.0.855.gem +0 -0
|
@@ -226,12 +226,15 @@ module Zernio
|
|
|
226
226
|
# Google only
|
|
227
227
|
attr_accessor :campaign_type
|
|
228
228
|
|
|
229
|
-
# Google Search only.
|
|
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.
|
|
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<
|
|
504
|
-
:'negative_keywords' => :'Array<
|
|
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
|
|
@@ -20,11 +20,37 @@ module Zernio
|
|
|
20
20
|
|
|
21
21
|
attr_accessor :name
|
|
22
22
|
|
|
23
|
+
# OpenAI Ads only (ignored by Meta). When set, also provisions a standard conversion event setting wired to the new pixel, so `goal: conversions` ad creates on `POST /v1/ads/create` have an event to reference immediately.
|
|
24
|
+
attr_accessor :default_event_type
|
|
25
|
+
|
|
26
|
+
class EnumAttributeValidator
|
|
27
|
+
attr_reader :datatype
|
|
28
|
+
attr_reader :allowable_values
|
|
29
|
+
|
|
30
|
+
def initialize(datatype, allowable_values)
|
|
31
|
+
@allowable_values = allowable_values.map do |value|
|
|
32
|
+
case datatype.to_s
|
|
33
|
+
when /Integer/i
|
|
34
|
+
value.to_i
|
|
35
|
+
when /Float/i
|
|
36
|
+
value.to_f
|
|
37
|
+
else
|
|
38
|
+
value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def valid?(value)
|
|
44
|
+
!value || allowable_values.include?(value)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
23
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
49
|
def self.attribute_map
|
|
25
50
|
{
|
|
26
51
|
:'ad_account_id' => :'adAccountId',
|
|
27
|
-
:'name' => :'name'
|
|
52
|
+
:'name' => :'name',
|
|
53
|
+
:'default_event_type' => :'defaultEventType'
|
|
28
54
|
}
|
|
29
55
|
end
|
|
30
56
|
|
|
@@ -42,7 +68,8 @@ module Zernio
|
|
|
42
68
|
def self.openapi_types
|
|
43
69
|
{
|
|
44
70
|
:'ad_account_id' => :'String',
|
|
45
|
-
:'name' => :'String'
|
|
71
|
+
:'name' => :'String',
|
|
72
|
+
:'default_event_type' => :'String'
|
|
46
73
|
}
|
|
47
74
|
end
|
|
48
75
|
|
|
@@ -79,6 +106,10 @@ module Zernio
|
|
|
79
106
|
else
|
|
80
107
|
self.name = nil
|
|
81
108
|
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'default_event_type')
|
|
111
|
+
self.default_event_type = attributes[:'default_event_type']
|
|
112
|
+
end
|
|
82
113
|
end
|
|
83
114
|
|
|
84
115
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -113,6 +144,8 @@ module Zernio
|
|
|
113
144
|
return false if @name.nil?
|
|
114
145
|
return false if @name.to_s.length > 200
|
|
115
146
|
return false if @name.to_s.length < 1
|
|
147
|
+
default_event_type_validator = EnumAttributeValidator.new('String', ["order_created", "lead_created", "items_added", "contents_viewed", "checkout_started", "registration_completed", "subscription_created", "trial_started", "appointment_scheduled", "page_viewed", "app_installed", "app_opened"])
|
|
148
|
+
return false unless default_event_type_validator.valid?(@default_event_type)
|
|
116
149
|
true
|
|
117
150
|
end
|
|
118
151
|
|
|
@@ -144,13 +177,24 @@ module Zernio
|
|
|
144
177
|
@name = name
|
|
145
178
|
end
|
|
146
179
|
|
|
180
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
181
|
+
# @param [Object] default_event_type Object to be assigned
|
|
182
|
+
def default_event_type=(default_event_type)
|
|
183
|
+
validator = EnumAttributeValidator.new('String', ["order_created", "lead_created", "items_added", "contents_viewed", "checkout_started", "registration_completed", "subscription_created", "trial_started", "appointment_scheduled", "page_viewed", "app_installed", "app_opened"])
|
|
184
|
+
unless validator.valid?(default_event_type)
|
|
185
|
+
fail ArgumentError, "invalid value for \"default_event_type\", must be one of #{validator.allowable_values}."
|
|
186
|
+
end
|
|
187
|
+
@default_event_type = default_event_type
|
|
188
|
+
end
|
|
189
|
+
|
|
147
190
|
# Checks equality by comparing each attribute.
|
|
148
191
|
# @param [Object] Object to be compared
|
|
149
192
|
def ==(o)
|
|
150
193
|
return true if self.equal?(o)
|
|
151
194
|
self.class == o.class &&
|
|
152
195
|
ad_account_id == o.ad_account_id &&
|
|
153
|
-
name == o.name
|
|
196
|
+
name == o.name &&
|
|
197
|
+
default_event_type == o.default_event_type
|
|
154
198
|
end
|
|
155
199
|
|
|
156
200
|
# @see the `==` method
|
|
@@ -162,7 +206,7 @@ module Zernio
|
|
|
162
206
|
# Calculates hash code according to all attributes.
|
|
163
207
|
# @return [Integer] Hash code
|
|
164
208
|
def hash
|
|
165
|
-
[ad_account_id, name].hash
|
|
209
|
+
[ad_account_id, name, default_event_type].hash
|
|
166
210
|
end
|
|
167
211
|
|
|
168
212
|
# 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
|
|
@@ -0,0 +1,149 @@
|
|
|
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 ListCampaignNegativeKeywords200Response < ApiModelBase
|
|
18
|
+
attr_accessor :keywords
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'keywords' => :'keywords'
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Returns attribute mapping this model knows about
|
|
28
|
+
def self.acceptable_attribute_map
|
|
29
|
+
attribute_map
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns all the JSON keys this model knows about
|
|
33
|
+
def self.acceptable_attributes
|
|
34
|
+
acceptable_attribute_map.values
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Attribute type mapping.
|
|
38
|
+
def self.openapi_types
|
|
39
|
+
{
|
|
40
|
+
:'keywords' => :'Array<ListCampaignNegativeKeywords200ResponseKeywordsInner>'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# List of attributes with nullable: true
|
|
45
|
+
def self.openapi_nullable
|
|
46
|
+
Set.new([
|
|
47
|
+
])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Initializes the object
|
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
|
+
def initialize(attributes = {})
|
|
53
|
+
if (!attributes.is_a?(Hash))
|
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ListCampaignNegativeKeywords200Response` initialize method"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
58
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::ListCampaignNegativeKeywords200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
62
|
+
end
|
|
63
|
+
h[k.to_sym] = v
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'keywords')
|
|
67
|
+
if (value = attributes[:'keywords']).is_a?(Array)
|
|
68
|
+
self.keywords = value
|
|
69
|
+
end
|
|
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
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
77
|
+
invalid_properties = Array.new
|
|
78
|
+
invalid_properties
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Check to see if the all the properties in the model are valid
|
|
82
|
+
# @return true if the model is valid
|
|
83
|
+
def valid?
|
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
85
|
+
true
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Checks equality by comparing each attribute.
|
|
89
|
+
# @param [Object] Object to be compared
|
|
90
|
+
def ==(o)
|
|
91
|
+
return true if self.equal?(o)
|
|
92
|
+
self.class == o.class &&
|
|
93
|
+
keywords == o.keywords
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @see the `==` method
|
|
97
|
+
# @param [Object] Object to be compared
|
|
98
|
+
def eql?(o)
|
|
99
|
+
self == o
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Calculates hash code according to all attributes.
|
|
103
|
+
# @return [Integer] Hash code
|
|
104
|
+
def hash
|
|
105
|
+
[keywords].hash
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
111
|
+
def self.build_from_hash(attributes)
|
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
|
113
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
114
|
+
transformed_hash = {}
|
|
115
|
+
openapi_types.each_pair do |key, type|
|
|
116
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
117
|
+
transformed_hash["#{key}"] = nil
|
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
119
|
+
# check to ensure the input is an array given that the attribute
|
|
120
|
+
# is documented as an array but the input is not
|
|
121
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
122
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
123
|
+
end
|
|
124
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
125
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
new(transformed_hash)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Returns the object in the form of hash
|
|
132
|
+
# @return [Hash] Returns the object in the form of hash
|
|
133
|
+
def to_hash
|
|
134
|
+
hash = {}
|
|
135
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
136
|
+
value = self.send(attr)
|
|
137
|
+
if value.nil?
|
|
138
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
139
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
hash[param] = _to_hash(value)
|
|
143
|
+
end
|
|
144
|
+
hash
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
end
|