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

#create_value_rule_set(create_value_rule_set_request, opts = {}) ⇒ CreateValueRuleSet201Response

Create a value rule set Creates a value rule set on the ad account (Meta's POST /act_X/value_rule_set). Attach the returned id to an ad set with valueRuleSetId on POST /v1/ads/create or PUT /v1/ads/ad-sets/{adSetId}. Rule order is semantic: rules are evaluated in array order and only the first matching rule adjusts the bid for an overlapping audience. adjustValue is an unsigned magnitude in percent; the direction lives in adjustSign. INCREASE accepts 1-1000, DECREASE accepts 1-90. There is no signed field and 0 is out of range. criteriaValueTypes is positionally paired with criteriaValues (same length, same order). Every type is the literal \"NONE\" except on LOCATION, which uses LOCATION_COUNTRY / LOCATION_REGION / LOCATION_CITY / LOCATION_COMSCORE_MARKET and may mix them within one criterion. Location values are Targeting-Search keys: a two-letter country code for LOCATION_COUNTRY, a numeric key for the rest. LOCATION_DMA was replaced by LOCATION_COMSCORE_MARKET on 2026-06-22 and rules using DMAs are no longer active, so this API rejects it. AUDIENCE_LABEL values (e.g. HIGH_VALUE) are applied to a Custom Audience in Ads Manager. There is no API to provision them, so label strings are passed through unvalidated and a typo produces a rule that never fires. Ads Manager turns a rule set read-only (this API stays editable) when a rule uses more than 2 criteria, a custom age range, or the placements FB_MARKETPLACE, FB_SEARCH, FB_VIDEO or IG_EXPLORE. Limits: 6 rule sets per ad account, 10 rules per set, 4 criteria per rule. The per-account cap is enforced by Meta, not here.

Parameters:

Returns:



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

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

#create_value_rule_set_with_http_info(create_value_rule_set_request, opts = {}) ⇒ Array<(CreateValueRuleSet201Response, Integer, Hash)>

Create a value rule set Creates a value rule set on the ad account (Meta's `POST /act_X/value_rule_set`). Attach the returned id to an ad set with `valueRuleSetId` on `POST /v1/ads/create` or `PUT /v1/ads/ad-sets/adSetId`. Rule order is semantic: rules are evaluated in array order and only the first matching rule adjusts the bid for an overlapping audience. `adjustValue` is an unsigned magnitude in percent; the direction lives in `adjustSign`. `INCREASE` accepts 1-1000, `DECREASE` accepts 1-90. There is no signed field and 0 is out of range. `criteriaValueTypes` is positionally paired with `criteriaValues` (same length, same order). Every type is the literal `&quot;NONE&quot;` except on `LOCATION`, which uses `LOCATION_COUNTRY` / `LOCATION_REGION` / `LOCATION_CITY` / `LOCATION_COMSCORE_MARKET` and may mix them within one criterion. Location values are Targeting-Search keys: a two-letter country code for `LOCATION_COUNTRY`, a numeric key for the rest. `LOCATION_DMA` was replaced by `LOCATION_COMSCORE_MARKET` on 2026-06-22 and rules using DMAs are no longer active, so this API rejects it. `AUDIENCE_LABEL` values (e.g. `HIGH_VALUE`) are applied to a Custom Audience in Ads Manager. There is no API to provision them, so label strings are passed through unvalidated and a typo produces a rule that never fires. Ads Manager turns a rule set read-only (this API stays editable) when a rule uses more than 2 criteria, a custom age range, or the placements `FB_MARKETPLACE`, `FB_SEARCH`, `FB_VIDEO` or `IG_EXPLORE`. Limits: 6 rule sets per ad account, 10 rules per set, 4 criteria per rule. The per-account cap is enforced by Meta, not here.

Parameters:

Returns:



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_accounts_api.rb', line 37

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

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

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

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

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

#delete_value_rule_set(value_rule_set_id, account_id, opts = {}) ⇒ DeleteValueRuleSet200Response

Delete a value rule set Deletes the rule set (Meta's POST /{value-rule-set-id}/delete_rule_set, a custom action edge rather than an HTTP DELETE on its side). Ad sets pointing at it are not modified here; detach them first with valueRulesApplied: false on PUT /v1/ads/ad-sets/{adSetId}.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set 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_accounts_api.rb', line 96

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

#delete_value_rule_set_with_http_info(value_rule_set_id, account_id, opts = {}) ⇒ Array<(DeleteValueRuleSet200Response, Integer, Hash)>

Delete a value rule set Deletes the rule set (Meta's `POST /value-rule-set-id/delete_rule_set`, a custom action edge rather than an HTTP DELETE on its side). Ad sets pointing at it are not modified here; detach them first with `valueRulesApplied: false` on `PUT /v1/ads/ad-sets/adSetId`.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set 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:



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_accounts_api.rb', line 107

def delete_value_rule_set_with_http_info(value_rule_set_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.delete_value_rule_set ...'
  end
  # verify the required parameter 'value_rule_set_id' is set
  if @api_client.config.client_side_validation && value_rule_set_id.nil?
    fail ArgumentError, "Missing the required parameter 'value_rule_set_id' when calling AdAccountsApi.delete_value_rule_set"
  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.delete_value_rule_set"
  end
  # resource path
  local_var_path = '/v1/ads/value-rule-sets/{valueRuleSetId}'.sub('{' + 'valueRuleSetId' + '}', CGI.escape(value_rule_set_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] || 'DeleteValueRuleSet200Response'

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

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

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



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

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:



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
227
228
229
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 177

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:



239
240
241
242
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 239

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



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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 252

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:



326
327
328
329
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 326

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:



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 342

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:



415
416
417
418
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 415

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



426
427
428
429
430
431
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 426

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:



486
487
488
489
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 486

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:



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 497

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

#get_value_rule_set(value_rule_set_id, account_id, opts = {}) ⇒ GetValueRuleSet200Response

Read a value rule set Reads one value rule set including every nested rule id and criterion id. This is step one of any edit: PUT is a full replace, so you need the ids before you can keep the objects you are not changing. Meta's own read returns GENDER values lowercase (\"male\") while writes require \"MALE\". Values are passed through untouched, so never case-compare a stored rule against a fetched one.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set 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:



557
558
559
560
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 557

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

#get_value_rule_set_with_http_info(value_rule_set_id, account_id, opts = {}) ⇒ Array<(GetValueRuleSet200Response, Integer, Hash)>

Read a value rule set Reads one value rule set including every nested rule id and criterion id. This is step one of any edit: `PUT` is a full replace, so you need the ids before you can keep the objects you are not changing. Meta's own read returns `GENDER` values lowercase (`&quot;male&quot;`) while writes require `&quot;MALE&quot;`. Values are passed through untouched, so never case-compare a stored rule against a fetched one.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set 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<(GetValueRuleSet200Response, Integer, Hash)>)

    GetValueRuleSet200Response data, response status code and response headers



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

def get_value_rule_set_with_http_info(value_rule_set_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_value_rule_set ...'
  end
  # verify the required parameter 'value_rule_set_id' is set
  if @api_client.config.client_side_validation && value_rule_set_id.nil?
    fail ArgumentError, "Missing the required parameter 'value_rule_set_id' when calling AdAccountsApi.get_value_rule_set"
  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_value_rule_set"
  end
  # resource path
  local_var_path = '/v1/ads/value-rule-sets/{valueRuleSetId}'.sub('{' + 'valueRuleSetId' + '}', CGI.escape(value_rule_set_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] || 'GetValueRuleSet200Response'

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.get_value_rule_set",
    :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_value_rule_set\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. For Google Ads: responds 429 when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.

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:



628
629
630
631
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 628

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. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.

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



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

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:



707
708
709
710
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 707

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



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

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:



793
794
795
796
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 793

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



807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 807

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:



877
878
879
880
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 877

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:



887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
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
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 887

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:



945
946
947
948
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 945

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:



959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 959

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:



1027
1028
1029
1030
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1027

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:



1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1039

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

#list_value_rule_sets(account_id, ad_account_id, opts = {}) ⇒ ListValueRuleSets200Response

List value rule sets Lists the ad account's value rule sets (Meta's /act_X/value_rule_set). A value rule set adjusts the auction bid up or down for audience segments you value differently; attach one to an ad set with valueRuleSetId on POST /v1/ads/create or PUT /v1/ads/ad-sets/{adSetId}. Rows are returned in the same camelCase shape the PUT body takes, ids included, so a set round-trips 1:1: the update is a full replace, not a patch, so you GET, mutate and send the whole thing back. Limits: 6 rule sets per ad account, 10 rules per set, 4 criteria per rule. Rule order is semantic. Rules are evaluated in array order and only the FIRST matching rule adjusts the bid for an overlapping audience. The order you send is the order that is stored and returned. Eligibility: value rule sets apply only to ad sets on the LOWEST_COST_WITHOUT_CAP (auto-bid) or COST_CAP bid strategies. Meta rejects the rest server-side.

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. Meta does not document paging on this edge; `after` comes back null when it omits cursors.

Returns:



1106
1107
1108
1109
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1106

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

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

List value rule sets Lists the ad account's value rule sets (Meta's `/act_X/value_rule_set`). A value rule set adjusts the auction bid up or down for audience segments you value differently; attach one to an ad set with `valueRuleSetId` on `POST /v1/ads/create` or `PUT /v1/ads/ad-sets/adSetId`. Rows are returned in the same camelCase shape the `PUT` body takes, ids included, so a set round-trips 1:1: the update is a full replace, not a patch, so you GET, mutate and send the whole thing back. Limits: 6 rule sets per ad account, 10 rules per set, 4 criteria per rule. Rule order is semantic. Rules are evaluated in array order and only the FIRST matching rule adjusts the bid for an overlapping audience. The order you send is the order that is stored and returned. Eligibility: value rule sets apply only to ad sets on the `LOWEST_COST_WITHOUT_CAP` (auto-bid) or `COST_CAP` bid strategies. Meta rejects the rest server-side.

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. Meta does not document paging on this edge; `after` comes back null when it omits cursors.

Returns:



1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1119

def list_value_rule_sets_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_value_rule_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 AdAccountsApi.list_value_rule_sets"
  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_value_rule_sets"
  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_value_rule_sets, 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_value_rule_sets, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/value-rule-sets'

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

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

  new_options = opts.merge(
    :operation => :"AdAccountsApi.list_value_rule_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: AdAccountsApi#list_value_rule_sets\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:



1188
1189
1190
1191
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1188

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



1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1198

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

#update_value_rule_set(value_rule_set_id, update_value_rule_set_request, opts = {}) ⇒ UpdateValueRuleSet200Response

Replace a value rule set THIS IS A FULL REPLACE, NOT A PATCH. Meta's update is declarative: the body you send becomes the rule set. - GET /v1/ads/value-rule-sets/{valueRuleSetId} FIRST. - Keep a rule or criterion by echoing its id. - Create one by including the object WITHOUT an id. - Delete one by OMITTING it from the array. There is no warning and no undo. name and rules are both required for exactly this reason: a partial body would silently destroy every rule left out. Rule order is semantic: the array order you send is the evaluation order, and only the first matching rule adjusts the bid for an overlapping audience. Existing rule sets created elsewhere may contain LOCATION_DMA criteria. Those went inert on 2026-06-22 and are rejected here; migrate them to LOCATION_COMSCORE_MARKET.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set id.

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

    the optional parameters

Returns:



1257
1258
1259
1260
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1257

def update_value_rule_set(value_rule_set_id, update_value_rule_set_request, opts = {})
  data, _status_code, _headers = update_value_rule_set_with_http_info(value_rule_set_id, update_value_rule_set_request, opts)
  data
end

#update_value_rule_set_with_http_info(value_rule_set_id, update_value_rule_set_request, opts = {}) ⇒ Array<(UpdateValueRuleSet200Response, Integer, Hash)>

Replace a value rule set THIS IS A FULL REPLACE, NOT A PATCH. Meta's update is declarative: the body you send becomes the rule set. - `GET /v1/ads/value-rule-sets/valueRuleSetId` FIRST. - Keep a rule or criterion by echoing its `id`. - Create one by including the object WITHOUT an `id`. - Delete one by OMITTING it from the array. There is no warning and no undo. `name` and `rules` are both required for exactly this reason: a partial body would silently destroy every rule left out. Rule order is semantic: the array order you send is the evaluation order, and only the first matching rule adjusts the bid for an overlapping audience. Existing rule sets created elsewhere may contain `LOCATION_DMA` criteria. Those went inert on 2026-06-22 and are rejected here; migrate them to `LOCATION_COMSCORE_MARKET`.

Parameters:

  • value_rule_set_id (String)

    Platform value rule set id.

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

    the optional parameters

Returns:



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1268

def update_value_rule_set_with_http_info(value_rule_set_id, update_value_rule_set_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.update_value_rule_set ...'
  end
  # verify the required parameter 'value_rule_set_id' is set
  if @api_client.config.client_side_validation && value_rule_set_id.nil?
    fail ArgumentError, "Missing the required parameter 'value_rule_set_id' when calling AdAccountsApi.update_value_rule_set"
  end
  # verify the required parameter 'update_value_rule_set_request' is set
  if @api_client.config.client_side_validation && update_value_rule_set_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_value_rule_set_request' when calling AdAccountsApi.update_value_rule_set"
  end
  # resource path
  local_var_path = '/v1/ads/value-rule-sets/{valueRuleSetId}'.sub('{' + 'valueRuleSetId' + '}', CGI.escape(value_rule_set_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_value_rule_set_request)

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

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

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