Class: Zernio::AdCreativesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/ad_creatives_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdCreativesApi

Returns a new instance of AdCreativesApi.



19
20
21
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_ad_creative(create_ad_creative_request, opts = {}) ⇒ CreateAdCreative201Response

Create a standalone creative Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via existingCreativeId. Provide exactly one of imageUrl (uploaded server-side), imageHash (from POST /v1/ads/images or the library list), or carouselCards (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from accountId as the story actor.

Parameters:

Returns:



27
28
29
30
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 27

def create_ad_creative(create_ad_creative_request, opts = {})
  data, _status_code, _headers = create_ad_creative_with_http_info(create_ad_creative_request, opts)
  data
end

#create_ad_creative_with_http_info(create_ad_creative_request, opts = {}) ⇒ Array<(CreateAdCreative201Response, Integer, Hash)>

Create a standalone creative Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via `existingCreativeId`. Provide exactly one of `imageUrl` (uploaded server-side), `imageHash` (from POST /v1/ads/images or the library list), or `carouselCards` (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from `accountId` as the story actor.

Parameters:

Returns:

  • (Array<(CreateAdCreative201Response, Integer, Hash)>)

    CreateAdCreative201Response data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 37

def create_ad_creative_with_http_info(create_ad_creative_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.create_ad_creative ...'
  end
  # verify the required parameter 'create_ad_creative_request' is set
  if @api_client.config.client_side_validation && create_ad_creative_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_ad_creative_request' when calling AdCreativesApi.create_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_creative_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateAdCreative201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.create_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#create_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_ad_creative(creative_id, account_id, opts = {}) ⇒ DeleteAdCreative200Response

Delete a creative Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



96
97
98
99
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 96

def delete_ad_creative(creative_id, , opts = {})
  data, _status_code, _headers = delete_ad_creative_with_http_info(creative_id, , opts)
  data
end

#delete_ad_creative_with_http_info(creative_id, account_id, opts = {}) ⇒ Array<(DeleteAdCreative200Response, Integer, Hash)>

Delete a creative Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteAdCreative200Response, Integer, Hash)>)

    DeleteAdCreative200Response data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 107

def delete_ad_creative_with_http_info(creative_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.delete_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.delete_ad_creative"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.delete_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.delete_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#delete_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_ad_previews(generate_ad_previews_request, opts = {}) ⇒ GenerateAdPreviews200Response

Render pre-create ad previews Renders how a creative would look per placement BEFORE any ad exists, via Meta's /generatepreviews. Provide exactly one creative source: existingCreativeId or creativeSpec. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim.

Parameters:

Returns:



165
166
167
168
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 165

def generate_ad_previews(generate_ad_previews_request, opts = {})
  data, _status_code, _headers = generate_ad_previews_with_http_info(generate_ad_previews_request, opts)
  data
end

#generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {}) ⇒ Array<(GenerateAdPreviews200Response, Integer, Hash)>

Render pre-create ad previews Renders how a creative would look per placement BEFORE any ad exists, via Meta's `/generatepreviews`. Provide exactly one creative source: `existingCreativeId` or `creativeSpec`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim.

Parameters:

Returns:



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 175

def generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.generate_ad_previews ...'
  end
  # verify the required parameter 'generate_ad_previews_request' is set
  if @api_client.config.client_side_validation && generate_ad_previews_request.nil?
    fail ArgumentError, "Missing the required parameter 'generate_ad_previews_request' when calling AdCreativesApi.generate_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/preview'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_ad_previews_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GenerateAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.generate_ad_previews",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#generate_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_creative(creative_id, account_id, opts = {}) ⇒ GetAdCreative200Response

Creative details One creative's details, verbatim from Meta. fields is a raw-passthrough override of the default projection.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

Returns:



235
236
237
238
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 235

def get_ad_creative(creative_id, , opts = {})
  data, _status_code, _headers = get_ad_creative_with_http_info(creative_id, , opts)
  data
end

#get_ad_creative_with_http_info(creative_id, account_id, opts = {}) ⇒ Array<(GetAdCreative200Response, Integer, Hash)>

Creative details One creative's details, verbatim from Meta. `fields` is a raw-passthrough override of the default projection.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

Returns:

  • (Array<(GetAdCreative200Response, Integer, Hash)>)

    GetAdCreative200Response data, response status code and response headers



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 247

def get_ad_creative_with_http_info(creative_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.get_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.get_ad_creative"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.get_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.get_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#get_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_previews(ad_id, opts = {}) ⇒ GetAdPreviews200Response

Render previews of an existing ad Renders an EXISTING ad per placement via Meta's /{ad_id}/previews. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:



307
308
309
310
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 307

def get_ad_previews(ad_id, opts = {})
  data, _status_code, _headers = get_ad_previews_with_http_info(ad_id, opts)
  data
end

#get_ad_previews_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdPreviews200Response, Integer, Hash)>

Render previews of an existing ad Renders an EXISTING ad per placement via Meta's `/ad_id/previews`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:

  • (Array<(GetAdPreviews200Response, Integer, Hash)>)

    GetAdPreviews200Response data, response status code and response headers



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 318

def get_ad_previews_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.get_ad_previews ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdCreativesApi.get_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/preview'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'formats'] = opts[:'formats'] if !opts[:'formats'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.get_ad_previews",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#get_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) ⇒ ListAdCatalogProductSets200Response

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as promotedObject.productSetId on POST /v1/ads/create with goal: catalog_sales.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



373
374
375
376
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 373

def list_ad_catalog_product_sets(catalog_id, , opts = {})
  data, _status_code, _headers = list_ad_catalog_product_sets_with_http_info(catalog_id, , opts)
  data
end

#list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) ⇒ Array<(ListAdCatalogProductSets200Response, Integer, Hash)>

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as `promotedObject.productSetId` on POST /v1/ads/create with `goal: catalog_sales`.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 384

def list_ad_catalog_product_sets_with_http_info(catalog_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_catalog_product_sets ...'
  end
  # verify the required parameter 'catalog_id' is set
  if @api_client.config.client_side_validation && catalog_id.nil?
    fail ArgumentError, "Missing the required parameter 'catalog_id' when calling AdCreativesApi.list_ad_catalog_product_sets"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_catalog_product_sets"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs/{catalogId}/product-sets'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogProductSets200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_catalog_product_sets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_catalog_product_sets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalogs(account_id, ad_account_id, opts = {}) ⇒ ListAdCatalogs200Response

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (goal: catalog_sales on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



443
444
445
446
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 443

def list_ad_catalogs(, , opts = {})
  data, _status_code, _headers = list_ad_catalogs_with_http_info(, , opts)
  data
end

#list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCatalogs200Response, Integer, Hash)>

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (`goal: catalog_sales` on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListAdCatalogs200Response, Integer, Hash)>)

    ListAdCatalogs200Response data, response status code and response headers



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 454

def list_ad_catalogs_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_catalogs ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_catalogs"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_catalogs"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogs200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_catalogs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_catalogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_creatives(account_id, ad_account_id, opts = {}) ⇒ ListAdCreatives200Response

Creative library Lists the ad account's creative library (Meta's /act_X/adcreatives), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; fields is a raw-passthrough override. Any creative id here is reusable on the create endpoints via existingCreativeId.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



517
518
519
520
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 517

def list_ad_creatives(, , opts = {})
  data, _status_code, _headers = list_ad_creatives_with_http_info(, , opts)
  data
end

#list_ad_creatives_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCreatives200Response, Integer, Hash)>

Creative library Lists the ad account's creative library (Meta's `/act_X/adcreatives`), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; `fields` is a raw-passthrough override. Any creative id here is reusable on the create endpoints via `existingCreativeId`.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

  • (Array<(ListAdCreatives200Response, Integer, Hash)>)

    ListAdCreatives200Response data, response status code and response headers



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 531

def list_ad_creatives_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_creatives ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_creatives"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_creatives"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_creatives, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_creatives, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/creatives'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCreatives200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_creatives",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_creatives\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_images(account_id, ad_account_id, opts = {}) ⇒ ListAdImages200Response

Ad image library Lists the ad account's image library (Meta's /act_X/adimages), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; fields is a raw-passthrough override. Any hash here is reusable wherever Meta accepts image_hash (e.g. imageHash on POST /v1/ads/creatives).

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



605
606
607
608
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 605

def list_ad_images(, , opts = {})
  data, _status_code, _headers = list_ad_images_with_http_info(, , opts)
  data
end

#list_ad_images_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdImages200Response, Integer, Hash)>

Ad image library Lists the ad account's image library (Meta's `/act_X/adimages`), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; `fields` is a raw-passthrough override. Any `hash` here is reusable wherever Meta accepts `image_hash` (e.g. `imageHash` on POST /v1/ads/creatives).

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

  • (Array<(ListAdImages200Response, Integer, Hash)>)

    ListAdImages200Response data, response status code and response headers



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 619

def list_ad_images_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_images ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_images"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_images"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_images, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_images, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/images'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdImages200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_images",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_creative(creative_id, update_ad_creative_request, opts = {}) ⇒ UpdateAdCreative200Response

Rename a creative Renames a creative. Creatives are immutable on Meta beyond name — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/adId with creative).

Parameters:

  • creative_id (String)

    Platform creative id

  • update_ad_creative_request (UpdateAdCreativeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



690
691
692
693
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 690

def update_ad_creative(creative_id, update_ad_creative_request, opts = {})
  data, _status_code, _headers = update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts)
  data
end

#update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts = {}) ⇒ Array<(UpdateAdCreative200Response, Integer, Hash)>

Rename a creative Renames a creative. Creatives are immutable on Meta beyond `name` — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/adId with `creative`).

Parameters:

  • creative_id (String)

    Platform creative id

  • update_ad_creative_request (UpdateAdCreativeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UpdateAdCreative200Response, Integer, Hash)>)

    UpdateAdCreative200Response data, response status code and response headers



701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 701

def update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.update_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.update_ad_creative"
  end
  # verify the required parameter 'update_ad_creative_request' is set
  if @api_client.config.client_side_validation && update_ad_creative_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_creative_request' when calling AdCreativesApi.update_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_creative_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.update_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#update_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_ad_image(upload_ad_image_request, opts = {}) ⇒ UploadAdImage201Response

Upload an ad image from base64 Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image hash (Meta's identifier for the asset) and the Meta-hosted url, which can be used directly as imageUrl on the create endpoints. Max 30 MB decoded.

Parameters:

  • upload_ad_image_request (UploadAdImageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



763
764
765
766
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 763

def upload_ad_image(upload_ad_image_request, opts = {})
  data, _status_code, _headers = upload_ad_image_with_http_info(upload_ad_image_request, opts)
  data
end

#upload_ad_image_with_http_info(upload_ad_image_request, opts = {}) ⇒ Array<(UploadAdImage201Response, Integer, Hash)>

Upload an ad image from base64 Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image `hash` (Meta's identifier for the asset) and the Meta-hosted `url`, which can be used directly as `imageUrl` on the create endpoints. Max 30 MB decoded.

Parameters:

  • upload_ad_image_request (UploadAdImageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UploadAdImage201Response, Integer, Hash)>)

    UploadAdImage201Response data, response status code and response headers



773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 773

def upload_ad_image_with_http_info(upload_ad_image_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.upload_ad_image ...'
  end
  # verify the required parameter 'upload_ad_image_request' is set
  if @api_client.config.client_side_validation && upload_ad_image_request.nil?
    fail ArgumentError, "Missing the required parameter 'upload_ad_image_request' when calling AdCreativesApi.upload_ad_image"
  end
  # resource path
  local_var_path = '/v1/ads/images'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_ad_image_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UploadAdImage201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.upload_ad_image",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#upload_ad_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end