Class: Zernio::AdAccountsApi
- Inherits:
-
Object
- Object
- Zernio::AdAccountsApi
- Defined in:
- lib/zernio-sdk/api/ad_accounts_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_custom_conversion(account_id, create_custom_conversion_request, opts = {}) ⇒ CustomConversionResult
Create or reuse a custom conversion Provision the Meta custom conversion an ads flow optimises toward, and hand back the
customConversionIdforpromotedObject.customConversionIdon POST /v1/ads/create. -
#create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts = {}) ⇒ Array<(CustomConversionResult, Integer, Hash)>
Create or reuse a custom conversion Provision the Meta custom conversion an ads flow optimises toward, and hand back the `customConversionId` for `promotedObject.customConversionId` on POST /v1/ads/create.
-
#create_high_demand_period(create_high_demand_period_request, opts = {}) ⇒ CreateHighDemandPeriod201Response
Schedule a budget increase Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day.
-
#create_high_demand_period_with_http_info(create_high_demand_period_request, opts = {}) ⇒ Array<(CreateHighDemandPeriod201Response, Integer, Hash)>
Schedule a budget increase Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day.
-
#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). -
#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`).
-
#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). -
#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).
-
#get_ad_account_finance(account_id, ad_account_id, opts = {}) ⇒ GetAdAccountFinance200Response
Ad account finances Finances of one Meta ad account: prepaid
balance, lifetimeamountSpent, accountspendCap(null = no cap) and thefundingSource. -
#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`.
-
#get_ad_comments(ad_id, opts = {}) ⇒ GetAdComments200Response
List comments on an ad Returns comments on an ad's underlying creative post.
-
#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.
-
#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 inextra_data. -
#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`.
-
#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/accountsor in Meta Ads Manager. -
#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.
-
#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.
-
#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.
-
#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.
-
#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.
-
#initialize(api_client = ApiClient.default) ⇒ AdAccountsApi
constructor
A new instance of AdAccountsApi.
-
#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).
-
#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).
-
#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). -
#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).
-
#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. -
#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.
-
#list_ads_business_centers(account_id, opts = {}) ⇒ ListAdsBusinessCenters200Response
List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected
tiktokadsaccount can read. -
#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.
-
#list_custom_conversions(account_id, ad_account_id, opts = {}) ⇒ ListCustomConversions200Response
List custom conversions The ad account's Meta custom conversions, including archived ones (
isArchived). -
#list_custom_conversions_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListCustomConversions200Response, Integer, Hash)>
List custom conversions The ad account's Meta custom conversions, including archived ones (`isArchived`).
-
#list_high_demand_periods(account_id, opts = {}) ⇒ ListHighDemandPeriods200Response
High demand periods / budget schedules Scheduled budget increases (Meta's budget-scheduling API).
-
#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).
-
#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). -
#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).
-
#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). -
#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`).
-
#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).
-
#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).
-
#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.
-
#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.
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_client ⇒ Object
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_custom_conversion(account_id, create_custom_conversion_request, opts = {}) ⇒ CustomConversionResult
Create or reuse a custom conversion
Provision the Meta custom conversion an ads flow optimises toward, and hand back the customConversionId for promotedObject.customConversionId on POST /v1/ads/create. Removes the manual "create it in Ads Manager first" step. Reuse is ours, not Meta's. Meta's create is not idempotent, so a retried request would otherwise mint a duplicate carrying none of the original's optimisation history. A non-archived conversion with the same name on the same pixelId is returned instead of created, with reused: true and a 200 rather than a 201. rule is forwarded verbatim in Meta's own grammar (e.g. {\"url\": {\"i_contains\": \"thank-you\"}}); Meta validates it and rejects a malformed one with "A conversion rule is required at creation time".
28 29 30 31 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 28 def create_custom_conversion(account_id, create_custom_conversion_request, opts = {}) data, _status_code, _headers = create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts) data end |
#create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts = {}) ⇒ Array<(CustomConversionResult, Integer, Hash)>
Create or reuse a custom conversion Provision the Meta custom conversion an ads flow optimises toward, and hand back the `customConversionId` for `promotedObject.customConversionId` on POST /v1/ads/create. Removes the manual "create it in Ads Manager first" step. Reuse is ours, not Meta's. Meta's create is not idempotent, so a retried request would otherwise mint a duplicate carrying none of the original's optimisation history. A non-archived conversion with the same `name` on the same `pixelId` is returned instead of created, with `reused: true` and a 200 rather than a 201. `rule` is forwarded verbatim in Meta's own grammar (e.g. `{\"i_contains\": \"thank-you\"}`); Meta validates it and rejects a malformed one with "A conversion rule is required at creation time".
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 92 93 94 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 39 def create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdAccountsApi.create_custom_conversion ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.create_custom_conversion" end # verify the required parameter 'create_custom_conversion_request' is set if @api_client.config.client_side_validation && create_custom_conversion_request.nil? fail ArgumentError, "Missing the required parameter 'create_custom_conversion_request' when calling AdAccountsApi.create_custom_conversion" end # resource path local_var_path = '/v1/accounts/{accountId}/custom-conversions'.sub('{' + 'accountId' + '}', CGI.escape(account_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(create_custom_conversion_request) # return_type return_type = opts[:debug_return_type] || 'CustomConversionResult' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdAccountsApi.create_custom_conversion", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdAccountsApi#create_custom_conversion\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_high_demand_period(create_high_demand_period_request, opts = {}) ⇒ CreateHighDemandPeriod201Response
Schedule a budget increase
Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day. Same target rule as the GET: exactly one of campaignId / adSetId. Two Meta constraints worth knowing before you call it. timeStart / timeEnd must fall on a 15-minute boundary, and a campaign cannot mix ABSOLUTE and MULTIPLIER across its schedules — the second type is rejected with "Can't mix your budget scaling selection". Window rules (must sit inside the campaign's run dates, minimum lead time, no overlap) are Meta's and its message is forwarded verbatim.
101 102 103 104 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 101 def create_high_demand_period(create_high_demand_period_request, opts = {}) data, _status_code, _headers = create_high_demand_period_with_http_info(create_high_demand_period_request, opts) data end |
#create_high_demand_period_with_http_info(create_high_demand_period_request, opts = {}) ⇒ Array<(CreateHighDemandPeriod201Response, Integer, Hash)>
Schedule a budget increase Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day. Same target rule as the GET: exactly one of `campaignId` / `adSetId`. Two Meta constraints worth knowing before you call it. `timeStart` / `timeEnd` must fall on a 15-minute boundary, and a campaign cannot mix `ABSOLUTE` and `MULTIPLIER` across its schedules — the second type is rejected with "Can't mix your budget scaling selection". Window rules (must sit inside the campaign's run dates, minimum lead time, no overlap) are Meta's and its message is forwarded verbatim.
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 159 160 161 162 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 111 def create_high_demand_period_with_http_info(create_high_demand_period_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdAccountsApi.create_high_demand_period ...' end # verify the required parameter 'create_high_demand_period_request' is set if @api_client.config.client_side_validation && create_high_demand_period_request.nil? fail ArgumentError, "Missing the required parameter 'create_high_demand_period_request' when calling AdAccountsApi.create_high_demand_period" end # resource path local_var_path = '/v1/ads/high-demand-periods' # 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_high_demand_period_request) # return_type return_type = opts[:debug_return_type] || 'CreateHighDemandPeriod201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdAccountsApi.create_high_demand_period", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdAccountsApi#create_high_demand_period\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#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.
169 170 171 172 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 169 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 `"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.
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 230 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 179 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'] = 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, ) 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}.
238 239 240 241 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 238 def delete_value_rule_set(value_rule_set_id, account_id, opts = {}) data, _status_code, _headers = delete_value_rule_set_with_http_info(value_rule_set_id, account_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`.
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 249 def delete_value_rule_set_with_http_info(value_rule_set_id, account_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 && account_id.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'] = account_id # 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'] = 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, ) 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.
308 309 310 311 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 308 def get_ad_account_finance(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_ad_account_finance_with_http_info(account_id, ad_account_id, 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`.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 319 def get_ad_account_finance_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id # 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'] = 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, ) 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.
381 382 383 384 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 381 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.
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 394 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'] = 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, ) 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).
468 469 470 471 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 468 def get_ads_activity_log(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_ads_activity_log_with_http_info(account_id, ad_account_id, 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).
484 485 486 487 488 489 490 491 492 493 494 495 496 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 484 def get_ads_activity_log_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id 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'] = 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, ) 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.
557 558 559 560 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 557 def get_dsa_defaults(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_dsa_defaults_with_http_info(account_id, ad_account_id, 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.
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 620 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 568 def get_dsa_defaults_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id # 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'] = 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, ) 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.
628 629 630 631 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 628 def get_dsa_recommendations(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_dsa_recommendations_with_http_info(account_id, ad_account_id, 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.
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 639 def get_dsa_recommendations_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id # 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'] = 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, ) 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.
699 700 701 702 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 699 def get_value_rule_set(value_rule_set_id, account_id, opts = {}) data, _status_code, _headers = get_value_rule_set_with_http_info(value_rule_set_id, account_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 (`"male"`) while writes require `"MALE"`. Values are passed through untouched, so never case-compare a stored rule against a fetched one.
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 710 def get_value_rule_set_with_http_info(value_rule_set_id, account_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 && account_id.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'] = account_id # 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'] = 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, ) 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.
770 771 772 773 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 770 def list_ad_accounts(account_id, opts = {}) data, _status_code, _headers = list_ad_accounts_with_http_info(account_id, 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.
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 782 def list_ad_accounts_with_http_info(account_id, 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 && account_id.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'] = account_id 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'] = 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, ) 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).
849 850 851 852 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 849 def list_ad_labels(account_id, ad_account_id, opts = {}) data, _status_code, _headers = list_ad_labels_with_http_info(account_id, ad_account_id, 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).
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 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 862 def list_ad_labels_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id 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'] = 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, ) 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.
935 936 937 938 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 935 def list_ad_studies(account_id, ad_account_id, opts = {}) data, _status_code, _headers = list_ad_studies_with_http_info(account_id, ad_account_id, 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.
949 950 951 952 953 954 955 956 957 958 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 949 def list_ad_studies_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id 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'] = 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, ) 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.
1019 1020 1021 1022 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1019 def list_ads_business_centers(account_id, opts = {}) data, _status_code, _headers = list_ads_business_centers_with_http_info(account_id, 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.
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1029 def list_ads_business_centers_with_http_info(account_id, 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 && account_id.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'] = account_id # 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'] = 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, ) 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_custom_conversions(account_id, ad_account_id, opts = {}) ⇒ ListCustomConversions200Response
List custom conversions
The ad account's Meta custom conversions, including archived ones (isArchived).
1084 1085 1086 1087 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1084 def list_custom_conversions(account_id, ad_account_id, opts = {}) data, _status_code, _headers = list_custom_conversions_with_http_info(account_id, ad_account_id, opts) data end |
#list_custom_conversions_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListCustomConversions200Response, Integer, Hash)>
List custom conversions The ad account's Meta custom conversions, including archived ones (`isArchived`).
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1095 def list_custom_conversions_with_http_info(account_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_custom_conversions ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_custom_conversions" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.list_custom_conversions" end # resource path local_var_path = '/v1/accounts/{accountId}/custom-conversions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = ad_account_id # 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] || 'ListCustomConversions200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdAccountsApi.list_custom_conversions", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdAccountsApi#list_custom_conversions\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).
1157 1158 1159 1160 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1157 def list_high_demand_periods(account_id, opts = {}) data, _status_code, _headers = list_high_demand_periods_with_http_info(account_id, 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).
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1171 def list_high_demand_periods_with_http_info(account_id, 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 && account_id.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'] = account_id 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'] = 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, ) 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.
1239 1240 1241 1242 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1239 def (account_id, opts = {}) data, _status_code, _headers = (account_id, 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`.
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 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 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1251 def (account_id, 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 && account_id.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'] = account_id 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'] = 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, ) 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.
1318 1319 1320 1321 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1318 def list_value_rule_sets(account_id, ad_account_id, opts = {}) data, _status_code, _headers = list_value_rule_sets_with_http_info(account_id, ad_account_id, 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.
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1331 def list_value_rule_sets_with_http_info(account_id, ad_account_id, 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 && account_id.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 && ad_account_id.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'] = account_id query_params[:'adAccountId'] = ad_account_id 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'] = 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, ) 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.
1400 1401 1402 1403 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1400 def update_ad_account(update_ad_account_request, opts = {}) data, _status_code, _headers = update_ad_account_with_http_info(update_ad_account_request, 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.
1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1410 def update_ad_account_with_http_info(update_ad_account_request, 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 && update_ad_account_request.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(update_ad_account_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = 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, ) 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.
1469 1470 1471 1472 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1469 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`.
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 |
# File 'lib/zernio-sdk/api/ad_accounts_api.rb', line 1480 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'] = 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, ) 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 |