Class: Late::AdsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/late-sdk/api/ads_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdsApi

Returns a new instance of AdsApi.



19
20
21
# File 'lib/late-sdk/api/ads_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/late-sdk/api/ads_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#boost_post(boost_post_request, opts = {}) ⇒ UpdateAd200Response

Boost an existing post as a paid ad Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).

Parameters:

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

    the optional parameters

Returns:



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

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

#boost_post_with_http_info(boost_post_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>

Boost an existing post as a paid ad Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).

Parameters:

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

    the optional parameters

Returns:

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

    UpdateAd200Response data, response status code and response headers



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

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

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

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

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

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

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

#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ UpdateAd200Response

Create a standalone ad with custom creative Creates a paid ad with custom creative (headline, body, image/video, link). Creates the full platform campaign hierarchy.

Parameters:

Returns:



95
96
97
98
# File 'lib/late-sdk/api/ads_api.rb', line 95

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

#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>

Create a standalone ad with custom creative Creates a paid ad with custom creative (headline, body, image/video, link). Creates the full platform campaign hierarchy.

Parameters:

Returns:

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

    UpdateAd200Response data, response status code and response headers



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/late-sdk/api/ads_api.rb', line 105

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

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

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

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

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

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

#delete_ad(ad_id, opts = {}) ⇒ DeleteAccountGroup200Response

Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.

Parameters:

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

    the optional parameters

Returns:



163
164
165
166
# File 'lib/late-sdk/api/ads_api.rb', line 163

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

#delete_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DeleteAccountGroup200Response, Integer, Hash)>

Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.

Parameters:

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

    the optional parameters

Returns:



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
# File 'lib/late-sdk/api/ads_api.rb', line 173

def delete_ad_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.delete_ad ...'
  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 AdsApi.delete_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_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']

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

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

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

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

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

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

#get_ad(ad_id, opts = {}) ⇒ GetAd200Response

Get ad details

Parameters:

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

    the optional parameters

Returns:



225
226
227
228
# File 'lib/late-sdk/api/ads_api.rb', line 225

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

#get_ad_analytics(ad_id, opts = {}) ⇒ GetAdAnalytics200Response

Get ad analytics with daily breakdown Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 90 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 90-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language.

Returns:



290
291
292
293
# File 'lib/late-sdk/api/ads_api.rb', line 290

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

#get_ad_analytics_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdAnalytics200Response, Integer, Hash)>

Get ad analytics with daily breakdown Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 90 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from_date (Date)

    Start of date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of date range (YYYY-MM-DD). Defaults to today. Max 90-day range.

  • :breakdowns (String)

    Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language.

Returns:

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

    GetAdAnalytics200Response data, response status code and response headers



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/late-sdk/api/ads_api.rb', line 303

def get_ad_analytics_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_analytics ...'
  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 AdsApi.get_ad_analytics"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/analytics'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].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] || 'GetAdAnalytics200Response'

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

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

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

#get_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAd200Response, Integer, Hash)>

Get ad details

Parameters:

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

    the optional parameters

Returns:

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

    GetAd200Response data, response status code and response headers



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/late-sdk/api/ads_api.rb', line 234

def get_ad_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.get_ad ...'
  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 AdsApi.get_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_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']

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

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

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

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

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

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdsApi#get_ad\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 for a social account Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



359
360
361
362
# File 'lib/late-sdk/api/ads_api.rb', line 359

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

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

List ad accounts for a social account Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).

Parameters:

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:

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

    ListAdAccounts200Response data, response status code and response headers



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/late-sdk/api/ads_api.rb', line 369

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

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

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

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

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

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

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

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

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

#list_ads(opts = {}) ⇒ ListAds200Response

List ads Returns a paginated list of ads with metrics computed over an optional date range. Use ‘source=all` to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 90 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based) (default to 1)

  • :limit (Integer) — default: default to 50
  • :source (String)

    zernio &#x3D; Zernio-created only, all &#x3D; include external ads (default to ‘zernio’)

  • :status (String)
  • :platform (String)
  • :account_id (String)

    Social account ID

  • :profile_id (String)

    Profile ID

  • :campaign_id (String)

    Platform campaign ID (filter ads within a campaign)

  • :from_date (Date)

    Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of metrics date range (YYYY-MM-DD). Defaults to today. Max 90-day range.

Returns:



432
433
434
435
# File 'lib/late-sdk/api/ads_api.rb', line 432

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

#list_ads_with_http_info(opts = {}) ⇒ Array<(ListAds200Response, Integer, Hash)>

List ads Returns a paginated list of ads with metrics computed over an optional date range. Use &#x60;source&#x3D;all&#x60; to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 90 days max.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based) (default to 1)

  • :limit (Integer) — default: default to 50
  • :source (String)

    zernio &#x3D; Zernio-created only, all &#x3D; include external ads (default to ‘zernio’)

  • :status (String)
  • :platform (String)
  • :account_id (String)

    Social account ID

  • :profile_id (String)

    Profile ID

  • :campaign_id (String)

    Platform campaign ID (filter ads within a campaign)

  • :from_date (Date)

    Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.

  • :to_date (Date)

    End of metrics date range (YYYY-MM-DD). Defaults to today. Max 90-day range.

Returns:

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

    ListAds200Response data, response status code and response headers



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
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
# File 'lib/late-sdk/api/ads_api.rb', line 451

def list_ads_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.list_ads ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdsApi.list_ads, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ads, must be smaller than or equal to 500.'
  end

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

  allowable_values = ["zernio", "all"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  allowable_values = ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/ads'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].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] || 'ListAds200Response'

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

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

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdsApi#list_ads\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 Search for interest-based targeting options available on the platform.

Parameters:

  • q (String)

    Search query

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



535
536
537
538
# File 'lib/late-sdk/api/ads_api.rb', line 535

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

#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>

Search targeting interests Search for interest-based targeting options available on the platform.

Parameters:

  • q (String)

    Search query

  • account_id (String)

    Social account ID

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

    the optional parameters

Returns:



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/late-sdk/api/ads_api.rb', line 546

def search_ad_interests_with_http_info(q, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.search_ad_interests"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.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'] = 

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

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

#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response

Update ad (pause/resume, budget, targeting, name) Update one or more fields on an ad. Status changes and budget updates are propagated to the platform. Targeting updates are Meta-only.

Parameters:

  • ad_id (String)
  • update_ad_request (UpdateAdRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



606
607
608
609
# File 'lib/late-sdk/api/ads_api.rb', line 606

def update_ad(ad_id, update_ad_request, opts = {})
  data, _status_code, _headers = update_ad_with_http_info(ad_id, update_ad_request, opts)
  data
end

#update_ad_with_http_info(ad_id, update_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>

Update ad (pause/resume, budget, targeting, name) Update one or more fields on an ad. Status changes and budget updates are propagated to the platform. Targeting updates are Meta-only.

Parameters:

  • ad_id (String)
  • update_ad_request (UpdateAdRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    UpdateAd200Response data, response status code and response headers



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

def update_ad_with_http_info(ad_id, update_ad_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdsApi.update_ad ...'
  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 AdsApi.update_ad"
  end
  # verify the required parameter 'update_ad_request' is set
  if @api_client.config.client_side_validation && update_ad_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_request' when calling AdsApi.update_ad"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

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

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

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

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

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

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

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

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