Class: WhopSDK::Resources::Ads
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Ads
- Defined in:
- lib/whop_sdk/resources/ads.rb,
sig/whop_sdk/resources/ads.rbs
Overview
An Ad is the individual creative unit delivered by an ad group. It holds the copy, creative assets, and destination URL for one ad.
Use the Ads API to list ads for an account, create ads inside ad groups, retrieve or update creative details, delete ads that should stop running, and pause or resume delivery.
Instance Method Summary collapse
-
#create(ad_group: nil, ad_group_id: nil, call_to_action: nil, creatives: nil, descriptions: nil, headlines: nil, lead_form: nil, lead_form_id: nil, messaging_config: nil, multi_advertiser_ads: nil, post_id: nil, post_source: nil, primary_texts: nil, social_accounts: nil, title: nil, url: nil, url_parameters: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Some parameter documentations has been truncated, see Models::AdCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Deletes an ad.
-
#initialize(client:) ⇒ Ads
constructor
private
A new instance of Ads.
-
#list(account_id: nil, ad_campaign_id: nil, ad_group_id: nil, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, query: nil, stats_from: nil, stats_to: nil, status: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Ad>
Some parameter documentations has been truncated, see Models::AdListParams for more details.
-
#pause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Pauses an active ad.
-
#retrieve(id, stats_from: nil, stats_to: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Retrieves a single ad with stats over the requested window.
-
#unpause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Resumes a paused ad.
-
#update(id, call_to_action: nil, creatives: nil, descriptions: nil, headlines: nil, lead_form: nil, lead_form_id: nil, messaging_config: nil, multi_advertiser_ads: nil, post_id: nil, post_source: nil, primary_texts: nil, social_accounts: nil, title: nil, url: nil, url_parameters: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Some parameter documentations has been truncated, see Models::AdUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Ads
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Ads.
268 269 270 |
# File 'lib/whop_sdk/resources/ads.rb', line 268 def initialize(client:) @client = client end |
Instance Method Details
#create(ad_group: nil, ad_group_id: nil, call_to_action: nil, creatives: nil, descriptions: nil, headlines: nil, lead_form: nil, lead_form_id: nil, messaging_config: nil, multi_advertiser_ads: nil, post_id: nil, post_source: nil, primary_texts: nil, social_accounts: nil, title: nil, url: nil, url_parameters: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Some parameter documentations has been truncated, see Models::AdCreateParams for more details.
Creates an ad in an ad group.
59 60 61 62 |
# File 'lib/whop_sdk/resources/ads.rb', line 59 def create(params = {}) parsed, = WhopSDK::AdCreateParams.dump_request(params) @client.request(method: :post, path: "ads", body: parsed, model: WhopSDK::Ad, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Deletes an ad. Returns true on success.
216 217 218 219 220 221 222 223 |
# File 'lib/whop_sdk/resources/ads.rb', line 216 def delete(id, params = {}) @client.request( method: :delete, path: ["ads/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(account_id: nil, ad_campaign_id: nil, ad_group_id: nil, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, query: nil, stats_from: nil, stats_to: nil, status: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Ad>
Some parameter documentations has been truncated, see Models::AdListParams for more details.
Lists the ads for an account, with stats over the requested window.
192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/whop_sdk/resources/ads.rb', line 192 def list(params = {}) parsed, = WhopSDK::AdListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "ads", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Ad, options: ) end |
#pause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Pauses an active ad.
236 237 238 239 240 241 242 243 |
# File 'lib/whop_sdk/resources/ads.rb', line 236 def pause(id, params = {}) @client.request( method: :post, path: ["ads/%1$s/pause", id], model: WhopSDK::Ad, options: params[:request_options] ) end |
#retrieve(id, stats_from: nil, stats_to: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Retrieves a single ad with stats over the requested window.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/whop_sdk/resources/ads.rb', line 81 def retrieve(id, params = {}) parsed, = WhopSDK::AdRetrieveParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["ads/%1$s", id], query: query, model: WhopSDK::Ad, options: ) end |
#unpause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Resumes a paused ad.
256 257 258 259 260 261 262 263 |
# File 'lib/whop_sdk/resources/ads.rb', line 256 def unpause(id, params = {}) @client.request( method: :post, path: ["ads/%1$s/unpause", id], model: WhopSDK::Ad, options: params[:request_options] ) end |
#update(id, call_to_action: nil, creatives: nil, descriptions: nil, headlines: nil, lead_form: nil, lead_form_id: nil, messaging_config: nil, multi_advertiser_ads: nil, post_id: nil, post_source: nil, primary_texts: nil, social_accounts: nil, title: nil, url: nil, url_parameters: nil, request_options: {}) ⇒ WhopSDK::Models::Ad
Some parameter documentations has been truncated, see Models::AdUpdateParams for more details.
Updates an ad's editable fields.
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/whop_sdk/resources/ads.rb', line 137 def update(id, params = {}) parsed, = WhopSDK::AdUpdateParams.dump_request(params) @client.request( method: :patch, path: ["ads/%1$s", id], body: parsed, model: WhopSDK::Ad, options: ) end |