Class: Zernio::AdAccountsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdAccountsApi

Returns a new instance of AdAccountsApi.



19
20
21
# File 'lib/zernio-sdk/api/ad_accounts_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_accounts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_ad_account_finance(account_id, ad_account_id, opts = {}) ⇒ GetAdAccountFinance200Response

Ad account finances Finances of one Meta ad account: prepaid balance, lifetime amountSpent, account spendCap (null = no cap) and the fundingSource. Money values are converted from Meta's minor units to whole units of currency.

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

Returns:



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

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

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

Ad account finances Finances of one Meta ad account: prepaid `balance`, lifetime `amountSpent`, account `spendCap` (null = no cap) and the `fundingSource`. Money values are converted from Meta's minor units to whole units of `currency`.

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

Returns:



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
89
90
91
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 39

def (, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ad_account_finance ...'
  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 AdAccountsApi.get_ad_account_finance"
  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 AdAccountsApi.get_ad_account_finance"
  end
  # resource path
  local_var_path = '/v1/ads/accounts/finance'

  # 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] || 'GetAdAccountFinance200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_ad_account_finance",
    :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: AdAccountsApi#get_ad_account_finance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_comments(ad_id, opts = {}) ⇒ GetAdComments200Response

List comments on an ad Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the placement query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal _id (24-char hex), Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id), or the creative's effective_object_story_id / effective_instagram_media_id. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Internal Zernio ad ID (ObjectId).

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

    the optional parameters

Options Hash (opts):

  • :placement (String)

    Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Pagination cursor from a previous response.

Returns:



101
102
103
104
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 101

def get_ad_comments(ad_id, opts = {})
  data, _status_code, _headers = get_ad_comments_with_http_info(ad_id, opts)
  data
end

#get_ad_comments_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdComments200Response, Integer, Hash)>

List comments on an ad Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the `placement` query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal `_id` (24-char hex), Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`), or the creative's `effective_object_story_id` / `effective_instagram_media_id`. Caller doesn't need a translation step.

Parameters:

  • ad_id (String)

    Internal Zernio ad ID (ObjectId).

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

    the optional parameters

Options Hash (opts):

  • :placement (String)

    Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Pagination cursor from a previous response.

Returns:

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

    GetAdComments200Response data, response status code and response headers



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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 114

def get_ad_comments_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ad_comments ...'
  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 AdAccountsApi.get_ad_comments"
  end
  allowable_values = ["facebook", "instagram"]
  if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])
    fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ad_comments, 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 AdAccountsApi.get_ad_comments, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/{adId}/comments'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'placement'] = opts[:'placement'] if !opts[:'placement'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'GetAdComments200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_ad_comments",
    :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: AdAccountsApi#get_ad_comments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ads_activity_log(account_id, ad_account_id, opts = {}) ⇒ GetAdsActivityLog200Response

Ad account change / audit log Account-level audit log from Meta's /act_X/activities: who changed what and when (creates, edits, status flips, budget changes...) with Meta's translated event names and the structured before/after in extra_data. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so objectId filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad).

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):

  • :since (Date)

    Start of range (YYYY-MM-DD).

  • :_until (Date)

    End of range (YYYY-MM-DD).

  • :object_id (String)

    Client-side filter to one Meta object id (campaign, ad set or ad).

  • :limit (Integer)

    Rows per page (default to 50)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



188
189
190
191
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 188

def get_ads_activity_log(, , opts = {})
  data, _status_code, _headers = get_ads_activity_log_with_http_info(, , opts)
  data
end

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

Ad account change / audit log Account-level audit log from Meta's `/act_X/activities`: who changed what and when (creates, edits, status flips, budget changes...) with Meta's translated event names and the structured before/after in `extra_data`. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so `objectId` filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad).

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):

  • :since (Date)

    Start of range (YYYY-MM-DD).

  • :_until (Date)

    End of range (YYYY-MM-DD).

  • :object_id (String)

    Client-side filter to one Meta object id (campaign, ad set or ad).

  • :limit (Integer)

    Rows per page (default to 50)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 204

def get_ads_activity_log_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ads_activity_log ...'
  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 AdAccountsApi.get_ads_activity_log"
  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 AdAccountsApi.get_ads_activity_log"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ads_activity_log, must be smaller than or equal to 200.'
  end

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

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
  query_params[:'objectId'] = opts[:'object_id'] if !opts[:'object_id'].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] || 'GetAdsActivityLog200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_ads_activity_log",
    :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: AdAccountsApi#get_ads_activity_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dsa_defaults(account_id, ad_account_id, opts = {}) ⇒ UpdateAdAccount200Response

Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via PATCH /v1/ads/accounts or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



277
278
279
280
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 277

def get_dsa_defaults(, , opts = {})
  data, _status_code, _headers = get_dsa_defaults_with_http_info(, , opts)
  data
end

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

Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via `PATCH /v1/ads/accounts` or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:

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

    UpdateAdAccount200Response data, response status code and response headers



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 288

def get_dsa_defaults_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_dsa_defaults ...'
  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 AdAccountsApi.get_dsa_defaults"
  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 AdAccountsApi.get_dsa_defaults"
  end
  # resource path
  local_var_path = '/v1/ads/dsa-defaults'

  # 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] || 'UpdateAdAccount200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_dsa_defaults",
    :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: AdAccountsApi#get_dsa_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dsa_recommendations(account_id, ad_account_id, opts = {}) ⇒ GetDsaRecommendations200Response

List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling dsaBeneficiary/dsaPayor inputs, or the defaults sent to PATCH /v1/ads/accounts, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



348
349
350
351
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 348

def get_dsa_recommendations(, , opts = {})
  data, _status_code, _headers = get_dsa_recommendations_with_http_info(, , opts)
  data
end

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

List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling `dsaBeneficiary`/`dsaPayor` inputs, or the defaults sent to `PATCH /v1/ads/accounts`, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.

Parameters:

  • account_id (String)

    Social account ID (metaads, or a facebook/instagram posting account)

  • ad_account_id (String)

    Meta ad account ID (act_...)

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

    the optional parameters

Returns:



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 359

def get_dsa_recommendations_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_dsa_recommendations ...'
  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 AdAccountsApi.get_dsa_recommendations"
  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 AdAccountsApi.get_dsa_recommendations"
  end
  # resource path
  local_var_path = '/v1/ads/dsa-recommendations'

  # 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] || 'GetDsaRecommendations200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_dsa_recommendations",
    :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: AdAccountsApi#get_dsa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_accounts(account_id, opts = {}) ⇒ ListAdAccounts200Response

List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's /advertiser/info/ endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time advertiser_ids list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.

  • :limit (Integer)

    Clamp the returned `accounts` length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.

Returns:



420
421
422
423
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 420

def list_ad_accounts(, opts = {})
  data, _status_code, _headers = list_ad_accounts_with_http_info(, opts)
  data
end

#list_ad_accounts_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdAccounts200Response, Integer, Hash)>

List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.

  • :limit (Integer)

    Clamp the returned `accounts` length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.

Returns:

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

    ListAdAccounts200Response data, response status code and response headers



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 432

def list_ad_accounts_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_accounts ...'
  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 AdAccountsApi.list_ad_accounts"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_accounts, must be smaller than or equal to 1000.'
  end

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

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'ListAdAccounts200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_ad_accounts",
    :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: AdAccountsApi#list_ad_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_labels(account_id, ad_account_id, opts = {}) ⇒ ListAdLabels200Response

Ad labels Lists the ad account's organizational labels (Meta's /act_X/adlabels), rows returned verbatim (id, name, created/updated time).

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):

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



499
500
501
502
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 499

def list_ad_labels(, , opts = {})
  data, _status_code, _headers = list_ad_labels_with_http_info(, , opts)
  data
end

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

Ad labels Lists the ad account's organizational labels (Meta's `/act_X/adlabels`), rows returned verbatim (id, name, created/updated time).

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):

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

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

    ListAdLabels200Response data, response status code and response headers



512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 512

def list_ad_labels_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_labels ...'
  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 AdAccountsApi.list_ad_labels"
  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 AdAccountsApi.list_ad_labels"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_labels, 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 AdAccountsApi.list_ad_labels, must be greater than or equal to 1.'
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  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] || 'ListAdLabels200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_ad_labels",
    :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: AdAccountsApi#list_ad_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_studies(account_id, ad_account_id, opts = {}) ⇒ ListAdStudies200Response

A/B tests and lift studies Lists the ad account's A/B tests and lift studies (Meta's /act_X/ad_studies), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; fields is a raw-passthrough override.

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:



585
586
587
588
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 585

def list_ad_studies(, , opts = {})
  data, _status_code, _headers = list_ad_studies_with_http_info(, , opts)
  data
end

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

A/B tests and lift studies Lists the ad account's A/B tests and lift studies (Meta's `/act_X/ad_studies`), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; `fields` is a raw-passthrough override.

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<(ListAdStudies200Response, Integer, Hash)>)

    ListAdStudies200Response data, response status code and response headers



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 599

def list_ad_studies_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_studies ...'
  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 AdAccountsApi.list_ad_studies"
  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 AdAccountsApi.list_ad_studies"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_studies, 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 AdAccountsApi.list_ad_studies, must be greater than or equal to 1.'
  end

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

  # 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] || 'ListAdStudies200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_ad_studies",
    :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: AdAccountsApi#list_ad_studies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ads_business_centers(account_id, opts = {}) ⇒ ListAdsBusinessCenters200Response

List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected tiktokads account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking /v1/ads/accounts per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.

Parameters:

  • account_id (String)

    ID of the `tiktokads` (or parent `tiktok` posting) SocialAccount

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

    the optional parameters

Returns:



669
670
671
672
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 669

def list_ads_business_centers(, opts = {})
  data, _status_code, _headers = list_ads_business_centers_with_http_info(, opts)
  data
end

#list_ads_business_centers_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdsBusinessCenters200Response, Integer, Hash)>

List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected `tiktokads` account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking `/v1/ads/accounts` per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.

Parameters:

  • account_id (String)

    ID of the `tiktokads` (or parent `tiktok` posting) SocialAccount

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

    the optional parameters

Returns:



679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 679

def list_ads_business_centers_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ads_business_centers ...'
  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 AdAccountsApi.list_ads_business_centers"
  end
  # resource path
  local_var_path = '/v1/ads/business-centers'

  # 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] || 'ListAdsBusinessCenters200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_ads_business_centers",
    :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: AdAccountsApi#list_ads_business_centers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_high_demand_periods(account_id, opts = {}) ⇒ ListHighDemandPeriods200Response

High demand periods / budget schedules Scheduled budget increases (Meta's budget-scheduling API). The Graph edge lives on the campaign and ad-set nodes only, so exactly one of campaignId / adSetId (platform ids) is required. Rows returned verbatim (budget_value, budget_value_type, time window, recurrence).

Parameters:

  • 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):

  • :campaign_id (String)

    Platform campaign id. Exactly one of campaignId / adSetId.

  • :ad_set_id (String)

    Platform ad set id. Exactly one of campaignId / adSetId.

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



737
738
739
740
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 737

def list_high_demand_periods(, opts = {})
  data, _status_code, _headers = list_high_demand_periods_with_http_info(, opts)
  data
end

#list_high_demand_periods_with_http_info(account_id, opts = {}) ⇒ Array<(ListHighDemandPeriods200Response, Integer, Hash)>

High demand periods / budget schedules Scheduled budget increases (Meta's budget-scheduling API). The Graph edge lives on the campaign and ad-set nodes only, so exactly one of `campaignId` / `adSetId` (platform ids) is required. Rows returned verbatim (budget_value, budget_value_type, time window, recurrence).

Parameters:

  • 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):

  • :campaign_id (String)

    Platform campaign id. Exactly one of campaignId / adSetId.

  • :ad_set_id (String)

    Platform ad set id. Exactly one of campaignId / adSetId.

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 751

def list_high_demand_periods_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_high_demand_periods ...'
  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 AdAccountsApi.list_high_demand_periods"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_high_demand_periods, 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 AdAccountsApi.list_high_demand_periods, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/high-demand-periods'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
  query_params[:'adSetId'] = opts[:'ad_set_id'] if !opts[:'ad_set_id'].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] || 'ListHighDemandPeriods200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_high_demand_periods",
    :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: AdAccountsApi#list_high_demand_periods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_meta_businesses(account_id, opts = {}) ⇒ ListMetaBusinesses200Response

Businesses list Business Manager portfolios the connected Meta user belongs to (Meta's /me/businesses), rows returned verbatim (id, name, verification_status, created_time). Token-scoped, so no adAccountId is needed. For TikTok Business Centers use GET /v1/ads/business-centers.

Parameters:

  • 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):

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



819
820
821
822
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 819

def list_meta_businesses(, opts = {})
  data, _status_code, _headers = list_meta_businesses_with_http_info(, opts)
  data
end

#list_meta_businesses_with_http_info(account_id, opts = {}) ⇒ Array<(ListMetaBusinesses200Response, Integer, Hash)>

Businesses list Business Manager portfolios the connected Meta user belongs to (Meta's `/me/businesses`), rows returned verbatim (id, name, verification_status, created_time). Token-scoped, so no `adAccountId` is needed. For TikTok Business Centers use `GET /v1/ads/business-centers`.

Parameters:

  • 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):

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 831

def list_meta_businesses_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_meta_businesses ...'
  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 AdAccountsApi.list_meta_businesses"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_meta_businesses, 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 AdAccountsApi.list_meta_businesses, must be greater than or equal to 1.'
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  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] || 'ListMetaBusinesses200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_meta_businesses",
    :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: AdAccountsApi#list_meta_businesses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_account(update_ad_account_request, opts = {}) ⇒ UpdateAdAccount200Response

Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to /v1/ads/create, /v1/ads/boost and /v1/ads/ctwa on that ad account can omit dsaBeneficiary/dsaPayor: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use GET /v1/ads/dsa-recommendations to offer suggestions in your UI. If defaultDsaPayor is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with GET /v1/ads/dsa-defaults. Currently supported for Meta accounts only; other platforms return 400.

Parameters:

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

    the optional parameters

Returns:



895
896
897
898
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 895

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

#update_ad_account_with_http_info(update_ad_account_request, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>

Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to `/v1/ads/create`, `/v1/ads/boost` and `/v1/ads/ctwa` on that ad account can omit `dsaBeneficiary`/`dsaPayor`: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use `GET /v1/ads/dsa-recommendations` to offer suggestions in your UI. If `defaultDsaPayor` is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with `GET /v1/ads/dsa-defaults`. Currently supported for Meta accounts only; other platforms return 400.

Parameters:

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

    the optional parameters

Returns:

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

    UpdateAdAccount200Response data, response status code and response headers



905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 905

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

  # 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()

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

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.update_ad_account",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#update_ad_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end