Class: WhopSDK::Resources::Ads
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Ads
- Defined in:
- lib/whop_sdk/resources/ads.rb
Overview
Ads
Instance Method Summary collapse
-
#initialize(client:) ⇒ Ads
constructor
private
A new instance of Ads.
-
#list(ad_group_id: nil, after: nil, before: nil, campaign_id: nil, company_id: nil, created_after: nil, created_before: nil, first: nil, include_paused: nil, last: nil, order_by: nil, order_direction: nil, query: nil, stats_from: nil, stats_to: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AdListResponse>
Some parameter documentations has been truncated, see Models::AdListParams for more details.
-
#pause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Pauses an ad.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Retrieve an ad by its unique identifier.
-
#unpause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Resumes a paused ad.
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.
145 146 147 |
# File 'lib/whop_sdk/resources/ads.rb', line 145 def initialize(client:) @client = client end |
Instance Method Details
#list(ad_group_id: nil, after: nil, before: nil, campaign_id: nil, company_id: nil, created_after: nil, created_before: nil, first: nil, include_paused: nil, last: nil, order_by: nil, order_direction: nil, query: nil, stats_from: nil, stats_to: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AdListResponse>
Some parameter documentations has been truncated, see Models::AdListParams for more details.
List ads scoped by ad group, campaign, or company.
Required permissions:
-
‘ad_campaign:basic:read`
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/whop_sdk/resources/ads.rb', line 79 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::Models::AdListResponse, options: ) end |
#pause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Pauses an ad.
Required permissions:
-
‘ad_campaign:update`
-
‘ad_campaign:basic:read`
108 109 110 111 112 113 114 115 |
# File 'lib/whop_sdk/resources/ads.rb', line 108 def pause(id, params = {}) @client.request( method: :post, path: ["ads/%1$s/pause", id], model: WhopSDK::Ad, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Retrieve an ad by its unique identifier.
Required permissions:
-
‘ad_campaign:basic:read`
22 23 24 25 26 27 28 29 |
# File 'lib/whop_sdk/resources/ads.rb', line 22 def retrieve(id, params = {}) @client.request( method: :get, path: ["ads/%1$s", id], model: WhopSDK::Ad, options: params[:request_options] ) end |
#unpause(id, request_options: {}) ⇒ WhopSDK::Models::Ad
Resumes a paused ad.
Required permissions:
-
‘ad_campaign:update`
-
‘ad_campaign:basic:read`
133 134 135 136 137 138 139 140 |
# File 'lib/whop_sdk/resources/ads.rb', line 133 def unpause(id, params = {}) @client.request( method: :post, path: ["ads/%1$s/unpause", id], model: WhopSDK::Ad, options: params[:request_options] ) end |