Class: Zernio::AdTargetingApi
- Inherits:
-
Object
- Object
- Zernio::AdTargetingApi
- Defined in:
- lib/zernio-sdk/api/ad_targeting_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#estimate_ad_reach(estimate_ad_reach_request, opts = {}) ⇒ EstimateAdReach200Response
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created.
-
#estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) ⇒ Array<(EstimateAdReach200Response, Integer, Hash)>
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created.
-
#get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) ⇒ GetLinkedInBidPricing200Response
Suggested bid and budget bounds LinkedIn-only.
-
#get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) ⇒ Array<(GetLinkedInBidPricing200Response, Integer, Hash)>
Suggested bid and budget bounds LinkedIn-only.
-
#get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) ⇒ GetLinkedInSupplyForecast200Response
Impressions, clicks and spend forecast LinkedIn-only.
-
#get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) ⇒ Array<(GetLinkedInSupplyForecast200Response, Integer, Hash)>
Impressions, clicks and spend forecast LinkedIn-only.
-
#initialize(api_client = ApiClient.default) ⇒ AdTargetingApi
constructor
A new instance of AdTargetingApi.
-
#search_ad_interests(q, account_id, opts = {}) ⇒ SearchAdInterests200Response
Search targeting interests Deprecated alias for
GET /v1/ads/targeting/search?dimension=interest. -
#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>
Search targeting interests Deprecated alias for `GET /v1/ads/targeting/search?dimension=interest`.
-
#search_ad_targeting(account_id, q, opts = {}) ⇒ SearchAdTargeting200Response
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the
TargetingSpec(countries/regions/cities/zips/metrosgeo keys, andinterests/behaviorsentity ids) onPOST /v1/ads/create,POST /v1/ads/targeting/reach-estimate, andsaved_targetingaudiences. -
#search_ad_targeting_with_http_info(account_id, q, opts = {}) ⇒ Array<(SearchAdTargeting200Response, Integer, Hash)>
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the `TargetingSpec` (`countries`/`regions`/`cities`/`zips`/`metros` geo keys, and `interests`/`behaviors` entity ids) on `POST /v1/ads/create`, `POST /v1/ads/targeting/reach-estimate`, and `saved_targeting` audiences.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AdTargetingApi
Returns a new instance of AdTargetingApi.
19 20 21 |
# File 'lib/zernio-sdk/api/ad_targeting_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_targeting_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#estimate_ad_reach(estimate_ad_reach_request, opts = {}) ⇒ EstimateAdReach200Response
Estimate audience reach
Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta delivery_estimate, LinkedIn audienceCounts, X audience_summary, Pinterest audience_sizing). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return available: false with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.
27 28 29 30 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 27 def estimate_ad_reach(estimate_ad_reach_request, opts = {}) data, _status_code, _headers = estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts) data end |
#estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) ⇒ Array<(EstimateAdReach200Response, Integer, Hash)>
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta `delivery_estimate`, LinkedIn `audienceCounts`, X `audience_summary`, Pinterest `audience_sizing`). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return `available: false` with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 37 def estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdTargetingApi.estimate_ad_reach ...' end # verify the required parameter 'estimate_ad_reach_request' is set if @api_client.config.client_side_validation && estimate_ad_reach_request.nil? fail ArgumentError, "Missing the required parameter 'estimate_ad_reach_request' when calling AdTargetingApi.estimate_ad_reach" end # resource path local_var_path = '/v1/ads/targeting/reach-estimate' # 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(estimate_ad_reach_request) # return_type return_type = opts[:debug_return_type] || 'EstimateAdReach200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdTargetingApi.estimate_ad_reach", :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: AdTargetingApi#estimate_ad_reach\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) ⇒ GetLinkedInBidPricing200Response
Suggested bid and budget bounds
LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's adBudgetPricing finder. Non-LinkedIn accounts return available: false so clients can hide the pricing UI without treating it as a failure.
95 96 97 98 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 95 def get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) data, _status_code, _headers = get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts) data end |
#get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) ⇒ Array<(GetLinkedInBidPricing200Response, Integer, Hash)>
Suggested bid and budget bounds LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's `adBudgetPricing` finder. Non-LinkedIn accounts return `available: false` so clients can hide the pricing UI without treating it as a failure.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 105 def get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdTargetingApi.get_linked_in_bid_pricing ...' end # verify the required parameter 'get_linked_in_bid_pricing_request' is set if @api_client.config.client_side_validation && get_linked_in_bid_pricing_request.nil? fail ArgumentError, "Missing the required parameter 'get_linked_in_bid_pricing_request' when calling AdTargetingApi.get_linked_in_bid_pricing" end # resource path local_var_path = '/v1/ads/targeting/bid-pricing' # 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(get_linked_in_bid_pricing_request) # return_type return_type = opts[:debug_return_type] || 'GetLinkedInBidPricing200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdTargetingApi.get_linked_in_bid_pricing", :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: AdTargetingApi#get_linked_in_bid_pricing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) ⇒ GetLinkedInSupplyForecast200Response
Impressions, clicks and spend forecast
LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's adSupplyForecasts finder. Each returned series carries a metricType (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a granularity (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return available: false.
163 164 165 166 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 163 def get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) data, _status_code, _headers = get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts) data end |
#get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) ⇒ Array<(GetLinkedInSupplyForecast200Response, Integer, Hash)>
Impressions, clicks and spend forecast LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's `adSupplyForecasts` finder. Each returned series carries a `metricType` (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a `granularity` (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return `available: false`.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 173 def get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdTargetingApi.get_linked_in_supply_forecast ...' end # verify the required parameter 'get_linked_in_supply_forecast_request' is set if @api_client.config.client_side_validation && get_linked_in_supply_forecast_request.nil? fail ArgumentError, "Missing the required parameter 'get_linked_in_supply_forecast_request' when calling AdTargetingApi.get_linked_in_supply_forecast" end # resource path local_var_path = '/v1/ads/targeting/supply-forecast' # 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(get_linked_in_supply_forecast_request) # return_type return_type = opts[:debug_return_type] || 'GetLinkedInSupplyForecast200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdTargetingApi.get_linked_in_supply_forecast", :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: AdTargetingApi#get_linked_in_supply_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_ad_interests(q, account_id, opts = {}) ⇒ SearchAdInterests200Response
Search targeting interests
Deprecated alias for GET /v1/ads/targeting/search?dimension=interest. Kept for backward compatibility, it returns the legacy { interests: [...] } shape rather than the normalized { results: [...] }. New integrations should use GET /v1/ads/targeting/search with dimension=interest.
232 233 234 235 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 232 def search_ad_interests(q, account_id, opts = {}) data, _status_code, _headers = search_ad_interests_with_http_info(q, account_id, opts) data end |
#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>
Search targeting interests Deprecated alias for `GET /v1/ads/targeting/search?dimension=interest`. Kept for backward compatibility, it returns the legacy `{ interests: [...] }` shape rather than the normalized `{ results: [...] }`. New integrations should use `GET /v1/ads/targeting/search` with `dimension=interest`.
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 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 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 243 def search_ad_interests_with_http_info(q, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdTargetingApi.search_ad_interests ...' end # verify the required parameter 'q' is set if @api_client.config.client_side_validation && q.nil? fail ArgumentError, "Missing the required parameter 'q' when calling AdTargetingApi.search_ad_interests" 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 AdTargetingApi.search_ad_interests" end # resource path local_var_path = '/v1/ads/interests' # query parameters query_params = opts[:query_params] || {} query_params[:'q'] = q 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] || 'SearchAdInterests200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdTargetingApi.search_ad_interests", :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: AdTargetingApi#search_ad_interests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_ad_targeting(account_id, q, opts = {}) ⇒ SearchAdTargeting200Response
Search targeting options
Resolve a human-readable query into the platform's opaque targeting ids used in the TargetingSpec (countries/regions/cities/zips/metros geo keys, and interests/behaviors entity ids) on POST /v1/ads/create, POST /v1/ads/targeting/reach-estimate, and saved_targeting audiences. The dimension param selects what is searched, geo (locations, further scoped by geoType), interest, behavior, or income. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. TikTok geo searches return every matching level in one list (type is country, region, city, district, or metro for DMA areas) — geoType is not applied. Results are scoped to the advertiser's targetable markets, and every id is usable in regions/cities/metros keys on POST /v1/ads/create. For geo queries, q should contain only the locality name (e.g. \"Amsterdam\", not \"Amsterdam, NL\"). Use countryCode to disambiguate.
307 308 309 310 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 307 def search_ad_targeting(account_id, q, opts = {}) data, _status_code, _headers = search_ad_targeting_with_http_info(account_id, q, opts) data end |
#search_ad_targeting_with_http_info(account_id, q, opts = {}) ⇒ Array<(SearchAdTargeting200Response, Integer, Hash)>
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the `TargetingSpec` (`countries`/`regions`/`cities`/`zips`/`metros` geo keys, and `interests`/`behaviors` entity ids) on `POST /v1/ads/create`, `POST /v1/ads/targeting/reach-estimate`, and `saved_targeting` audiences. The `dimension` param selects what is searched, `geo` (locations, further scoped by `geoType`), `interest`, `behavior`, or `income`. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. TikTok geo searches return every matching level in one list (`type` is `country`, `region`, `city`, `district`, or `metro` for DMA areas) — `geoType` is not applied. Results are scoped to the advertiser's targetable markets, and every id is usable in `regions`/`cities`/`metros` keys on `POST /v1/ads/create`. For geo queries, `q` should contain only the locality name (e.g. `"Amsterdam"`, not `"Amsterdam, NL"`). Use `countryCode` to disambiguate.
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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/zernio-sdk/api/ad_targeting_api.rb', line 322 def search_ad_targeting_with_http_info(account_id, q, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdTargetingApi.search_ad_targeting ...' 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 AdTargetingApi.search_ad_targeting" end # verify the required parameter 'q' is set if @api_client.config.client_side_validation && q.nil? fail ArgumentError, "Missing the required parameter 'q' when calling AdTargetingApi.search_ad_targeting" end allowable_values = ["geo", "interest", "behavior", "income"] if @api_client.config.client_side_validation && opts[:'dimension'] && !allowable_values.include?(opts[:'dimension']) fail ArgumentError, "invalid value for \"dimension\", must be one of #{allowable_values}" end allowable_values = ["country", "region", "city", "zip", "metro"] if @api_client.config.client_side_validation && opts[:'geo_type'] && !allowable_values.include?(opts[:'geo_type']) fail ArgumentError, "invalid value for \"geo_type\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length > 2 fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdTargetingApi.search_ad_targeting, the character length must be smaller than or equal to 2.' end if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length < 2 fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdTargetingApi.search_ad_targeting, the character length must be greater than or equal to 2.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdTargetingApi.search_ad_targeting, 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 AdTargetingApi.search_ad_targeting, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/targeting/search' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'q'] = q query_params[:'dimension'] = opts[:'dimension'] if !opts[:'dimension'].nil? query_params[:'geoType'] = opts[:'geo_type'] if !opts[:'geo_type'].nil? query_params[:'countryCode'] = opts[:'country_code'] if !opts[:'country_code'].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] || 'SearchAdTargeting200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdTargetingApi.search_ad_targeting", :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: AdTargetingApi#search_ad_targeting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |