late-sdk 0.0.896 → 0.0.898

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/docs/AdCampaignsApi.md +12 -8
  4. data/docs/AdCreative.md +6 -0
  5. data/docs/AdCreativesApi.md +2 -2
  6. data/docs/BoostPostRequest.md +5 -3
  7. data/docs/CreateAdCreative201Response.md +5 -1
  8. data/docs/CreateAdCreativeRequest.md +4 -2
  9. data/docs/CreateCallAdRequest.md +3 -1
  10. data/docs/CreateMessagingAdRequest.md +3 -1
  11. data/docs/CreateStandaloneAdRequest.md +5 -3
  12. data/docs/CreateStandaloneAdRequestCreativesInner.md +4 -0
  13. data/docs/CreateStandaloneAdRequestPromotedObject.md +2 -2
  14. data/docs/CtwaAdRequestBody.md +3 -1
  15. data/docs/CtwaAdRequestBodyCreativesInner.md +2 -0
  16. data/docs/MetaPromotion.md +26 -0
  17. data/docs/MetaPromotionStatus.md +15 -0
  18. data/docs/UpdateAdRequestCreative.md +4 -0
  19. data/lib/zernio-sdk/api/ad_campaigns_api.rb +11 -8
  20. data/lib/zernio-sdk/api/ad_creatives_api.rb +4 -4
  21. data/lib/zernio-sdk/models/ad_creative.rb +52 -1
  22. data/lib/zernio-sdk/models/boost_post_request.rb +16 -4
  23. data/lib/zernio-sdk/models/create_ad_creative201_response.rb +44 -4
  24. data/lib/zernio-sdk/models/create_ad_creative_request.rb +11 -2
  25. data/lib/zernio-sdk/models/create_call_ad_request.rb +14 -2
  26. data/lib/zernio-sdk/models/create_messaging_ad_request.rb +14 -2
  27. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +12 -3
  28. data/lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb +23 -1
  29. data/lib/zernio-sdk/models/create_standalone_ad_request_dynamic_creative.rb +1 -1
  30. data/lib/zernio-sdk/models/create_standalone_ad_request_promoted_object.rb +2 -2
  31. data/lib/zernio-sdk/models/ctwa_ad_request_body.rb +14 -2
  32. data/lib/zernio-sdk/models/ctwa_ad_request_body_creatives_inner.rb +35 -1
  33. data/lib/zernio-sdk/models/meta_promotion.rb +275 -0
  34. data/lib/zernio-sdk/models/meta_promotion_status.rb +41 -0
  35. data/lib/zernio-sdk/models/update_ad_request_creative.rb +45 -2
  36. data/lib/zernio-sdk/version.rb +1 -1
  37. data/lib/zernio-sdk.rb +2 -0
  38. data/openapi.yaml +141 -18
  39. data/spec/api/ad_campaigns_api_spec.rb +5 -4
  40. data/spec/api/ad_creatives_api_spec.rb +2 -2
  41. data/spec/models/ad_creative_spec.rb +18 -0
  42. data/spec/models/boost_post_request_spec.rb +10 -0
  43. data/spec/models/create_ad_creative201_response_spec.rb +12 -0
  44. data/spec/models/create_ad_creative_request_spec.rb +6 -0
  45. data/spec/models/create_call_ad_request_spec.rb +10 -0
  46. data/spec/models/create_messaging_ad_request_spec.rb +10 -0
  47. data/spec/models/create_standalone_ad_request_creatives_inner_spec.rb +16 -0
  48. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  49. data/spec/models/ctwa_ad_request_body_creatives_inner_spec.rb +10 -0
  50. data/spec/models/ctwa_ad_request_body_spec.rb +10 -0
  51. data/spec/models/meta_promotion_spec.rb +64 -0
  52. data/spec/models/meta_promotion_status_spec.rb +30 -0
  53. data/spec/models/update_ad_request_creative_spec.rb +16 -0
  54. data/zernio-sdk-0.0.898.gem +0 -0
  55. metadata +10 -2
  56. data/zernio-sdk-0.0.896.gem +0 -0
@@ -47,7 +47,9 @@ module Zernio
47
47
  # Meta only. The RESERVED prediction id the R&F ad set runs on (reserving mints a new id, so pass that one). Requires buyingType RESERVED.
48
48
  attr_accessor :rf_prediction_id
49
49
 
50
- # Meta only. Advantage+ creative enhancements: a partial map of Meta creative feature keys (snake_case, e.g. enhance_cta, image_brightness_and_contrast, text_optimizations) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Meta validates the keys; unspecified features default to OPT_OUT. The legacy standard_enhancements bundle is deprecated by Meta and rejected.
50
+ attr_accessor :promotion
51
+
52
+ # Meta only. Applied to each new creative, including standalone and attach shapes. With creatives[], these are defaults; an item replaces the whole feature map, including an empty map. auto_promotion_tag is an enhancement; an explicit offer uses promotion.
51
53
  attr_accessor :creative_features
52
54
 
53
55
  # Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key, and Meta rejects it there.
@@ -114,7 +116,7 @@ module Zernio
114
116
  # Meta-only. When present, switches to the multi-creative shape: creates 1 campaign + 1 ad set + N ads (one per entry here). Top-level `headline` / `body` / `imageUrl` / `linkUrl` / `callToAction` are ignored in this mode. Mutually exclusive with `adSetId`.
115
117
  attr_accessor :creatives
116
118
 
117
- # When present, switches to the attach shape: adds one new ad to this existing ad set without creating a new campaign. Budget, targeting, goal, schedule, AND bid strategy are inherited from the ad set on Meta, and passing `bidStrategy` in attach mode returns 400. To change an existing ad set's bid, use `PUT /v1/ads/ad-sets/{adSetId}`. Mutually exclusive with `creatives[]`. The attached ad takes the full single-creative surface: `headline`/`body`/`description`/`callToAction` plus either `imageUrl`/`video` OR `placementAssets` (its own per-placement Feed/Story assets) OR `translations`/`defaultLocale` (its own per-locale asset feed, Meta only), and `leadGenFormId` when the target is a lead ad set (the parent must be ON_AD, true for ad sets created via goal `lead_generation`; Meta rejects a formless ad there, so pass the form on EVERY attached ad). This is the way to build N full ads sharing one ad set: create the first ad via the normal shape, then attach the rest one call each. Supported on Meta (facebook, instagram), Google Ads, TikTok, and LinkedIn. On TikTok the `adSetId` is the ad group ID; the new ad inherits the ad group's bid + budget + targeting. On LinkedIn the `adSetId` is the LinkedIn Campaign ID (numeric); we attach a new Creative to that Campaign, so the Campaign's `platformSpecificData` bidding, targeting, budget and schedule are inherited (passing those fields returns 400). On Google Ads the `adSetId` is the AD GROUP id. `goal` is still REQUIRED even though budget and targeting are inherited from the ad group. Send `campaignType: \"search\"` to attach into a Search ad group, including one created by `POST /v1/ads/ad-sets` (always SEARCH_STANDARD): without it the request is treated as Display and requires `images.landscape` + `images.square` + `businessName`, and the resulting display creative does not match a Search ad group. `budgetAmount`/`budgetType` and bidding fields (`bidStrategy`, `bidAmount`, `portfolioBidStrategyId`) return 400 on this shape; the ad group already owns them.
119
+ # When present, switches to the attach shape: adds one new ad to this existing ad set without creating a new campaign. Budget, targeting, goal, schedule, AND bid strategy are inherited from the ad set on Meta, and passing `bidStrategy` in attach mode returns 400. To change an existing ad set's bid, use `PUT /v1/ads/ad-sets/{adSetId}`. Mutually exclusive with `creatives[]`. `dynamicCreative` returns 400 in attach mode: create a new dynamic ad set by omitting `adSetId` instead. The attached ad takes the full single-creative surface: `headline`/`body`/`description`/`callToAction` plus either `imageUrl`/`video` OR `placementAssets` (its own per-placement Feed/Story assets) OR `translations`/`defaultLocale` (its own per-locale asset feed, Meta only), and `leadGenFormId` when the target is a lead ad set (the parent must be ON_AD, true for ad sets created via goal `lead_generation`; Meta rejects a formless ad there, so pass the form on EVERY attached ad). This is the way to build N full ads sharing one ad set: create the first ad via the normal shape, then attach the rest one call each. Supported on Meta (facebook, instagram), Google Ads, TikTok, and LinkedIn. On TikTok the `adSetId` is the ad group ID; the new ad inherits the ad group's bid + budget + targeting. On LinkedIn the `adSetId` is the LinkedIn Campaign ID (numeric); we attach a new Creative to that Campaign, so the Campaign's `platformSpecificData` bidding, targeting, budget and schedule are inherited (passing those fields returns 400). On Google Ads the `adSetId` is the AD GROUP id. `goal` is still REQUIRED even though budget and targeting are inherited from the ad group. Send `campaignType: \"search\"` to attach into a Search ad group, including one created by `POST /v1/ads/ad-sets` (always SEARCH_STANDARD): without it the request is treated as Display and requires `images.landscape` + `images.square` + `businessName`, and the resulting display creative does not match a Search ad group. `budgetAmount`/`budgetType` and bidding fields (`bidStrategy`, `bidAmount`, `portfolioBidStrategyId`) return 400 on this shape; the ad group already owns them.
118
120
  attr_accessor :ad_set_id
119
121
 
120
122
  # Meta, Google Ads, and LinkedIn. On Meta: add the new ad set under this EXISTING campaign instead of creating a new one (multi-ad-set audience testing). The new ad set's budget is matched to the campaign's mode automatically: for a CBO campaign (campaign-level budget) omit `budgetAmount`/`budgetType`, since the campaign owns the budget; for an ABO campaign pass them (they go on the new ad set). On LinkedIn: create a new Campaign (and its Creative) under this EXISTING CampaignGroup. On Google Ads: create a new ad group under this EXISTING campaign; the new ad group inherits the campaign's budget, so omit `budgetAmount`/`budgetType` (and any bidding field), or the request returns 400. On failure only the entities we authored are cleaned up; the pre-existing parent is left untouched and is never (re)activated. Mutually exclusive with `adSetId` and `creatives[]`.
@@ -332,6 +334,7 @@ module Zernio
332
334
  :'billing_event' => :'billingEvent',
333
335
  :'buying_type' => :'buyingType',
334
336
  :'rf_prediction_id' => :'rfPredictionId',
337
+ :'promotion' => :'promotion',
335
338
  :'creative_features' => :'creativeFeatures',
336
339
  :'multi_advertiser' => :'multiAdvertiser',
337
340
  :'validate_only' => :'validateOnly',
@@ -446,6 +449,7 @@ module Zernio
446
449
  :'billing_event' => :'String',
447
450
  :'buying_type' => :'String',
448
451
  :'rf_prediction_id' => :'String',
452
+ :'promotion' => :'MetaPromotion',
449
453
  :'creative_features' => :'Hash<String, String>',
450
454
  :'multi_advertiser' => :'String',
451
455
  :'validate_only' => :'Boolean',
@@ -611,6 +615,10 @@ module Zernio
611
615
  self.rf_prediction_id = attributes[:'rf_prediction_id']
612
616
  end
613
617
 
618
+ if attributes.key?(:'promotion')
619
+ self.promotion = attributes[:'promotion']
620
+ end
621
+
614
622
  if attributes.key?(:'creative_features')
615
623
  if (value = attributes[:'creative_features']).is_a?(Hash)
616
624
  self.creative_features = value
@@ -1876,6 +1884,7 @@ module Zernio
1876
1884
  billing_event == o.billing_event &&
1877
1885
  buying_type == o.buying_type &&
1878
1886
  rf_prediction_id == o.rf_prediction_id &&
1887
+ promotion == o.promotion &&
1879
1888
  creative_features == o.creative_features &&
1880
1889
  multi_advertiser == o.multi_advertiser &&
1881
1890
  validate_only == o.validate_only &&
@@ -1973,7 +1982,7 @@ module Zernio
1973
1982
  # Calculates hash code according to all attributes.
1974
1983
  # @return [Integer] Hash code
1975
1984
  def hash
1976
- [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, portfolio_bid_strategy_id, value_rule_set_id, value_rules_applied, platform_specific_data, dsa_beneficiary, dsa_payor, brand_identity, identity_type, smart_plus, promoted_object].hash
1985
+ [account_id, ad_account_id, name, campaign_name, ad_set_name, ad_name, tracking, goal, optimization_goal, billing_event, buying_type, rf_prediction_id, promotion, 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, portfolio_bid_strategy_id, value_rule_set_id, value_rules_applied, platform_specific_data, dsa_beneficiary, dsa_payor, brand_identity, identity_type, smart_plus, promoted_object].hash
1977
1986
  end
1978
1987
 
1979
1988
  # Builds the object from hash
@@ -16,6 +16,12 @@ require 'time'
16
16
  module Zernio
17
17
  # Each creative must supply EXACTLY ONE of `imageUrl` (image creative) or `video` (video creative).
18
18
  class CreateStandaloneAdRequestCreativesInner < ApiModelBase
19
+ # Overrides the top-level offer for this item. Omit to inherit; null disables the inherited offer.
20
+ attr_accessor :promotion
21
+
22
+ # Replaces the entire top-level creativeFeatures map for this item. Omit to inherit; an empty map clears these defaults.
23
+ attr_accessor :creative_features
24
+
19
25
  # Exact name for this ad. Falls back to `<name> #N` (N = 1-based position).
20
26
  attr_accessor :name
21
27
 
@@ -60,6 +66,8 @@ module Zernio
60
66
  # Attribute mapping from ruby-style variable name to JSON key.
61
67
  def self.attribute_map
62
68
  {
69
+ :'promotion' => :'promotion',
70
+ :'creative_features' => :'creativeFeatures',
63
71
  :'name' => :'name',
64
72
  :'headline' => :'headline',
65
73
  :'body' => :'body',
@@ -84,6 +92,8 @@ module Zernio
84
92
  # Attribute type mapping.
85
93
  def self.openapi_types
86
94
  {
95
+ :'promotion' => :'MetaPromotion',
96
+ :'creative_features' => :'Hash<String, String>',
87
97
  :'name' => :'String',
88
98
  :'headline' => :'String',
89
99
  :'body' => :'String',
@@ -117,6 +127,16 @@ module Zernio
117
127
  h[k.to_sym] = v
118
128
  }
119
129
 
130
+ if attributes.key?(:'promotion')
131
+ self.promotion = attributes[:'promotion']
132
+ end
133
+
134
+ if attributes.key?(:'creative_features')
135
+ if (value = attributes[:'creative_features']).is_a?(Hash)
136
+ self.creative_features = value
137
+ end
138
+ end
139
+
120
140
  if attributes.key?(:'name')
121
141
  self.name = attributes[:'name']
122
142
  end
@@ -287,6 +307,8 @@ module Zernio
287
307
  def ==(o)
288
308
  return true if self.equal?(o)
289
309
  self.class == o.class &&
310
+ promotion == o.promotion &&
311
+ creative_features == o.creative_features &&
290
312
  name == o.name &&
291
313
  headline == o.headline &&
292
314
  body == o.body &&
@@ -306,7 +328,7 @@ module Zernio
306
328
  # Calculates hash code according to all attributes.
307
329
  # @return [Integer] Hash code
308
330
  def hash
309
- [name, headline, body, description, image_url, video, link_url, call_to_action].hash
331
+ [promotion, creative_features, name, headline, body, description, image_url, video, link_url, call_to_action].hash
310
332
  end
311
333
 
312
334
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- # Meta only. Dynamic Creative: supply a POOL of assets and Meta auto-combines and optimises them into the best-performing variations within a single ad (mapped to the creative's `asset_feed_spec`). When set, the top-level single-creative fields (`imageUrl`, `headline`, `body`, `linkUrl`, `callToAction`) are ignored. Mutually exclusive with the `creatives[]` multi-creative shape. Exactly ONE of `imageUrls` / `videoUrls` is required (Meta allows one ad format per asset feed; sending both → 400). Meta limits: ≤10 images or ≤10 videos, ≤5 bodies / titles / descriptions.
17
+ # Meta only. Dynamic Creative: supply a POOL of assets and Meta auto-combines and optimises them into the best-performing variations within a single ad (mapped to the creative's `asset_feed_spec`). When set, the top-level single-creative fields (`imageUrl`, `headline`, `body`, `linkUrl`, `callToAction`) are ignored. Mutually exclusive with the `creatives[]` multi-creative shape. Exactly ONE of `imageUrls` / `videoUrls` is required (Meta allows one ad format per asset feed; sending both → 400). Limits remain 10 images or videos and 5 bodies, titles or descriptions. The ad set is created with `is_dynamic_creative: true`. Combining this field with `adSetId` returns 400: omit `adSetId` to create a new dynamic ad set. Multiple headlines go in `titles`; multiple primary texts go in `bodies`.
18
18
  class CreateStandaloneAdRequestDynamicCreative < ApiModelBase
19
19
  # Pool of image URLs (1-10). Uploaded to the ad account and referenced by hash in the asset feed. Mutually exclusive with `videoUrls`.
20
20
  attr_accessor :image_urls
@@ -37,10 +37,10 @@ module Zernio
37
37
  # Custom Conversion ID, when optimising against one instead of a standard event. Accepted alone by this API, without `pixelId` or `customEventType`. If `pixelId` is also sent, `customEventType` is still required on the promoted_object (Meta rejects `pixel_id` without `custom_event_type`, error_subcode 1885014).
38
38
  attr_accessor :custom_conversion_id
39
39
 
40
- # Catalog ID for catalog/Advantage+ Shopping campaigns.
40
+ # Optional catalog ID. If supplied with productSetId, the set must belong to this catalog. A catalog ID cannot replace productSetId.
41
41
  attr_accessor :product_catalog_id
42
42
 
43
- # Product Set ID inside the catalog.
43
+ # Meta product SET ID from GET /v1/ads/catalogs/{catalogId}/product-sets. Zernio checks that the token can read the set and its product_catalog before creation. A catalog ID or inaccessible set returns a precise 400 naming promotedObject.productSetId. A mismatch with productCatalogId names promotedObject.productCatalogId.
44
44
  attr_accessor :product_set_id
45
45
 
46
46
  # Meta only. Offline event set (dataset) to optimise toward. Post-merger these are datasets: the id is the dataset id (for pixel-backed datasets, the pixel id).
@@ -16,6 +16,9 @@ require 'time'
16
16
  module Zernio
17
17
  # In addition to the `required` list, the request must use EXACTLY ONE of the two shapes: - Single-creative: `headline`, `body`, and one of `imageUrl` / `video`, OR `existingPostId` / `objectStoryId` to reuse an organic post. - Multi-creative: a non-empty `creatives[]` array. Top-level creative fields must NOT be set on this shape. Existing post references work on messaging and CTWA only (not call ads). They cannot be combined with each other or with headline, body, imageUrl, video, or welcomeMessage. No media is uploaded and the organic post is retained. Fresh creatives still require headline, body, and image or video. The route enforces this at the Zod boundary; OpenAPI's `required` cannot express the OR cleanly.
18
18
  class CtwaAdRequestBody < ApiModelBase
19
+ # Meta enhancement settings for single or attached ads, and defaults for creatives[]. An item replaces the entire map, including with an empty object.
20
+ attr_accessor :creative_features
21
+
19
22
  # Facebook or Instagram SocialAccount ID.
20
23
  attr_accessor :account_id
21
24
 
@@ -31,7 +34,7 @@ module Zernio
31
34
  # Messaging and CTWA only. Raw Facebook pageId_postId reference, used as object_story_id even with an Instagram account. Mutually exclusive with existingPostId and fresh creative fields.
32
35
  attr_accessor :object_story_id
33
36
 
34
- # WhatsApp only. Optional E.164 number already paired with the Facebook Page. Omit to let Meta select the paired number. Sent to the creative CTA and, when creating a new ad set, its promoted_object. Attach requests do not change the existing ad set.
37
+ # WhatsApp only. Optional E.164 number already paired with the Facebook Page. Omit to let Meta select the paired number. Sent to the creative CTA and, when creating a new ad set, its promoted_object. Attach requests do not change the existing ad set. Stored as creative.whatsappPhoneNumber on every created ad.
35
38
  attr_accessor :whatsapp_phone_number
36
39
 
37
40
  # Single-creative shape only. Mutually exclusive with `creatives[]`.
@@ -152,6 +155,7 @@ module Zernio
152
155
  # Attribute mapping from ruby-style variable name to JSON key.
153
156
  def self.attribute_map
154
157
  {
158
+ :'creative_features' => :'creativeFeatures',
155
159
  :'account_id' => :'accountId',
156
160
  :'ad_account_id' => :'adAccountId',
157
161
  :'name' => :'name',
@@ -207,6 +211,7 @@ module Zernio
207
211
  # Attribute type mapping.
208
212
  def self.openapi_types
209
213
  {
214
+ :'creative_features' => :'Hash<String, String>',
210
215
  :'account_id' => :'String',
211
216
  :'ad_account_id' => :'String',
212
217
  :'name' => :'String',
@@ -271,6 +276,12 @@ module Zernio
271
276
  h[k.to_sym] = v
272
277
  }
273
278
 
279
+ if attributes.key?(:'creative_features')
280
+ if (value = attributes[:'creative_features']).is_a?(Hash)
281
+ self.creative_features = value
282
+ end
283
+ end
284
+
274
285
  if attributes.key?(:'account_id')
275
286
  self.account_id = attributes[:'account_id']
276
287
  else
@@ -867,6 +878,7 @@ module Zernio
867
878
  def ==(o)
868
879
  return true if self.equal?(o)
869
880
  self.class == o.class &&
881
+ creative_features == o.creative_features &&
870
882
  account_id == o.account_id &&
871
883
  ad_account_id == o.ad_account_id &&
872
884
  name == o.name &&
@@ -917,7 +929,7 @@ module Zernio
917
929
  # Calculates hash code according to all attributes.
918
930
  # @return [Integer] Hash code
919
931
  def hash
920
- [account_id, ad_account_id, name, existing_post_id, object_story_id, whatsapp_phone_number, headline, body, image_url, video, welcome_message, creatives, ad_set_id, budget_amount, budget_type, currency, end_date, countries, cities, regions, zips, metros, custom_locations, age_min, age_max, interests, audience_id, placements, advantage_audience, objective, status, campaign_status, bid_strategy, bid_amount, roas_average_floor, dsa_beneficiary, dsa_payor, regional_regulated_categories, regional_regulation_identities].hash
932
+ [creative_features, account_id, ad_account_id, name, existing_post_id, object_story_id, whatsapp_phone_number, headline, body, image_url, video, welcome_message, creatives, ad_set_id, budget_amount, budget_type, currency, end_date, countries, cities, regions, zips, metros, custom_locations, age_min, age_max, interests, audience_id, placements, advantage_audience, objective, status, campaign_status, bid_strategy, bid_amount, roas_average_floor, dsa_beneficiary, dsa_payor, regional_regulated_categories, regional_regulation_identities].hash
921
933
  end
922
934
 
923
935
  # Builds the object from hash
@@ -22,6 +22,9 @@ module Zernio
22
22
  # Messaging and CTWA only. Raw Facebook pageId_postId reference, used as object_story_id even with an Instagram account. Mutually exclusive with existingPostId and fresh creative fields.
23
23
  attr_accessor :object_story_id
24
24
 
25
+ # Replaces the top-level creativeFeatures map for this item. Omit to inherit; an empty object clears inherited enrollment choices.
26
+ attr_accessor :creative_features
27
+
25
28
  attr_accessor :headline
26
29
 
27
30
  # Primary text shown above the image / video.
@@ -34,11 +37,34 @@ module Zernio
34
37
 
35
38
  attr_accessor :welcome_message
36
39
 
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
37
62
  # Attribute mapping from ruby-style variable name to JSON key.
38
63
  def self.attribute_map
39
64
  {
40
65
  :'existing_post_id' => :'existingPostId',
41
66
  :'object_story_id' => :'objectStoryId',
67
+ :'creative_features' => :'creativeFeatures',
42
68
  :'headline' => :'headline',
43
69
  :'body' => :'body',
44
70
  :'image_url' => :'imageUrl',
@@ -62,6 +88,7 @@ module Zernio
62
88
  {
63
89
  :'existing_post_id' => :'String',
64
90
  :'object_story_id' => :'String',
91
+ :'creative_features' => :'Hash<String, String>',
65
92
  :'headline' => :'String',
66
93
  :'body' => :'String',
67
94
  :'image_url' => :'String',
@@ -100,6 +127,12 @@ module Zernio
100
127
  self.object_story_id = attributes[:'object_story_id']
101
128
  end
102
129
 
130
+ if attributes.key?(:'creative_features')
131
+ if (value = attributes[:'creative_features']).is_a?(Hash)
132
+ self.creative_features = value
133
+ end
134
+ end
135
+
103
136
  if attributes.key?(:'headline')
104
137
  self.headline = attributes[:'headline']
105
138
  end
@@ -230,6 +263,7 @@ module Zernio
230
263
  self.class == o.class &&
231
264
  existing_post_id == o.existing_post_id &&
232
265
  object_story_id == o.object_story_id &&
266
+ creative_features == o.creative_features &&
233
267
  headline == o.headline &&
234
268
  body == o.body &&
235
269
  image_url == o.image_url &&
@@ -246,7 +280,7 @@ module Zernio
246
280
  # Calculates hash code according to all attributes.
247
281
  # @return [Integer] Hash code
248
282
  def hash
249
- [existing_post_id, object_story_id, headline, body, image_url, video, welcome_message].hash
283
+ [existing_post_id, object_story_id, creative_features, headline, body, image_url, video, welcome_message].hash
250
284
  end
251
285
 
252
286
  # Builds the object from hash
@@ -0,0 +1,275 @@
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
+ # Meta explicit Promotion offer. Maps to creative_sourcing_spec.promotion_metadata_spec with promotion_source ADVERTISER_INPUT. Dates become Unix seconds. Send null to omit an explicit offer on a new creative or remove it when rebuilding. Creation success alone does not confirm application: inspect promotionStatus in the response.
18
+ class MetaPromotion < ApiModelBase
19
+ # Promotion type accepted by Meta. PERCENTAGE_OFF values cannot exceed 100.
20
+ attr_accessor :type
21
+
22
+ # Nonnegative promotion value passed to Meta unchanged. AMOUNT_OFF units are not confirmed, including major versus minor currency units. For PERCENTAGE_OFF this is the percentage discount, at most 100.
23
+ attr_accessor :value
24
+
25
+ # Optional promotion code.
26
+ attr_accessor :code
27
+
28
+ # Optional ISO 8601 start timestamp with a timezone offset or Z.
29
+ attr_accessor :start_date
30
+
31
+ # Optional ISO 8601 end timestamp with a timezone offset or Z. Must be after startDate when both are set.
32
+ attr_accessor :end_date
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'type' => :'type',
60
+ :'value' => :'value',
61
+ :'code' => :'code',
62
+ :'start_date' => :'startDate',
63
+ :'end_date' => :'endDate'
64
+ }
65
+ end
66
+
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ acceptable_attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'type' => :'String',
81
+ :'value' => :'Float',
82
+ :'code' => :'String',
83
+ :'start_date' => :'Time',
84
+ :'end_date' => :'Time'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::MetaPromotion` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::MetaPromotion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'type')
111
+ self.type = attributes[:'type']
112
+ else
113
+ self.type = nil
114
+ end
115
+
116
+ if attributes.key?(:'value')
117
+ self.value = attributes[:'value']
118
+ else
119
+ self.value = nil
120
+ end
121
+
122
+ if attributes.key?(:'code')
123
+ self.code = attributes[:'code']
124
+ end
125
+
126
+ if attributes.key?(:'start_date')
127
+ self.start_date = attributes[:'start_date']
128
+ end
129
+
130
+ if attributes.key?(:'end_date')
131
+ self.end_date = attributes[:'end_date']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ if @type.nil?
141
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
142
+ end
143
+
144
+ if @value.nil?
145
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
146
+ end
147
+
148
+ if @value < 0
149
+ invalid_properties.push('invalid value for "value", must be greater than or equal to 0.')
150
+ end
151
+
152
+ if !@code.nil? && @code.to_s.length < 1
153
+ invalid_properties.push('invalid value for "code", the character length must be greater than or equal to 1.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ return false if @type.nil?
164
+ type_validator = EnumAttributeValidator.new('String', ["AMOUNT_OFF", "FREE_RETURN", "FREE_SHIPPING", "PERCENTAGE_OFF", "PROMO_CODE"])
165
+ return false unless type_validator.valid?(@type)
166
+ return false if @value.nil?
167
+ return false if @value < 0
168
+ return false if !@code.nil? && @code.to_s.length < 1
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] type Object to be assigned
174
+ def type=(type)
175
+ validator = EnumAttributeValidator.new('String', ["AMOUNT_OFF", "FREE_RETURN", "FREE_SHIPPING", "PERCENTAGE_OFF", "PROMO_CODE"])
176
+ unless validator.valid?(type)
177
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @type = type
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] value Value to be assigned
184
+ def value=(value)
185
+ if value.nil?
186
+ fail ArgumentError, 'value cannot be nil'
187
+ end
188
+
189
+ if value < 0
190
+ fail ArgumentError, 'invalid value for "value", must be greater than or equal to 0.'
191
+ end
192
+
193
+ @value = value
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] code Value to be assigned
198
+ def code=(code)
199
+ if code.nil?
200
+ fail ArgumentError, 'code cannot be nil'
201
+ end
202
+
203
+ if code.to_s.length < 1
204
+ fail ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 1.'
205
+ end
206
+
207
+ @code = code
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ type == o.type &&
216
+ value == o.value &&
217
+ code == o.code &&
218
+ start_date == o.start_date &&
219
+ end_date == o.end_date
220
+ end
221
+
222
+ # @see the `==` method
223
+ # @param [Object] Object to be compared
224
+ def eql?(o)
225
+ self == o
226
+ end
227
+
228
+ # Calculates hash code according to all attributes.
229
+ # @return [Integer] Hash code
230
+ def hash
231
+ [type, value, code, start_date, end_date].hash
232
+ end
233
+
234
+ # Builds the object from hash
235
+ # @param [Hash] attributes Model attributes in the form of hash
236
+ # @return [Object] Returns the model itself
237
+ def self.build_from_hash(attributes)
238
+ return nil unless attributes.is_a?(Hash)
239
+ attributes = attributes.transform_keys(&:to_sym)
240
+ transformed_hash = {}
241
+ openapi_types.each_pair do |key, type|
242
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = nil
244
+ elsif type =~ /\AArray<(.*)>/i
245
+ # check to ensure the input is an array given that the attribute
246
+ # is documented as an array but the input is not
247
+ if attributes[attribute_map[key]].is_a?(Array)
248
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
249
+ end
250
+ elsif !attributes[attribute_map[key]].nil?
251
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
252
+ end
253
+ end
254
+ new(transformed_hash)
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -0,0 +1,41 @@
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 MetaPromotionStatus
18
+ APPLIED = "applied".freeze
19
+ NOT_RETURNED = "not_returned".freeze
20
+ UNAVAILABLE = "unavailable".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [APPLIED, NOT_RETURNED, UNAVAILABLE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if MetaPromotionStatus.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #MetaPromotionStatus"
39
+ end
40
+ end
41
+ end