Class: WhopSDK::Resources::AdGroups

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/ad_groups.rb

Overview

Ad groups

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AdGroups

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 AdGroups.

Parameters:



201
202
203
# File 'lib/whop_sdk/resources/ad_groups.rb', line 201

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(id, request_options: {}) ⇒ Boolean

Soft-deletes an ad group.

Required permissions:

  • ‘ad_campaign:update`

Parameters:

  • id (String)

    The unique identifier of the ad group to delete.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Boolean)

See Also:



139
140
141
142
143
144
145
146
# File 'lib/whop_sdk/resources/ad_groups.rb', line 139

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["ad_groups/%1$s", id],
    model: WhopSDK::Internal::Type::Boolean,
    options: params[:request_options]
  )
end

#list(after: nil, before: nil, campaign_id: nil, company_id: nil, created_after: nil, created_before: nil, first: nil, include_paused: nil, last: nil, query: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AdGroupListResponse>

Some parameter documentations has been truncated, see Models::AdGroupListParams for more details.

Returns a paginated list of ad groups scoped by campaign or company, with optional filtering by status and creation date.

Required permissions:

  • ‘ad_campaign:basic:read`

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • campaign_id (String, nil)

    Filter by campaign. Provide exactly one of campaign_id or company_id.

  • company_id (String, nil)

    Filter by company. Provide exactly one of campaign_id or company_id.

  • created_after (Time, nil)

    Only return ad groups created after this timestamp.

  • created_before (Time, nil)

    Only return ad groups created before this timestamp.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • include_paused (Boolean, nil)

    When false, excludes paused ad groups so pagination matches the dashboard’s hide

  • last (Integer, nil)

    Returns the last n elements from the list.

  • query (String, nil)

    Case-insensitive substring match against the ad group name.

  • status (Symbol, WhopSDK::Models::AdGroupStatus, nil)

    The status of an external ad group.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/whop_sdk/resources/ad_groups.rb', line 111

def list(params = {})
  parsed, options = WhopSDK::AdGroupListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "ad_groups",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::AdGroupListResponse,
    options: options
  )
end

#pause(id, request_options: {}) ⇒ WhopSDK::Models::AdGroup

Pauses an ad group.

Required permissions:

  • ‘ad_campaign:update`

  • ‘ad_campaign:basic:read`

Parameters:

  • id (String)

    The unique identifier of the ad group to pause.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



164
165
166
167
168
169
170
171
# File 'lib/whop_sdk/resources/ad_groups.rb', line 164

def pause(id, params = {})
  @client.request(
    method: :post,
    path: ["ad_groups/%1$s/pause", id],
    model: WhopSDK::AdGroup,
    options: params[:request_options]
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::AdGroup

Retrieves a single ad group by its unique identifier.

Required permissions:

  • ‘ad_campaign:basic:read`

Parameters:

  • id (String)

    The unique identifier of the ad group.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
# File 'lib/whop_sdk/resources/ad_groups.rb', line 22

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["ad_groups/%1$s", id],
    model: WhopSDK::AdGroup,
    options: params[:request_options]
  )
end

#unpause(id, request_options: {}) ⇒ WhopSDK::Models::AdGroup

Resumes a paused ad group.

Required permissions:

  • ‘ad_campaign:update`

  • ‘ad_campaign:basic:read`

Parameters:

  • id (String)

    The unique identifier of the ad group to unpause.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



189
190
191
192
193
194
195
196
# File 'lib/whop_sdk/resources/ad_groups.rb', line 189

def unpause(id, params = {})
  @client.request(
    method: :post,
    path: ["ad_groups/%1$s/unpause", id],
    model: WhopSDK::AdGroup,
    options: params[:request_options]
  )
end

#update(id, budget: nil, budget_type: nil, config: nil, daily_budget: nil, name: nil, platform_config: nil, status: nil, request_options: {}) ⇒ WhopSDK::Models::AdGroup

Updates an existing ad group.

Required permissions:

  • ‘ad_campaign:update`

  • ‘ad_campaign:basic:read`

Parameters:

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/whop_sdk/resources/ad_groups.rb', line 61

def update(id, params = {})
  parsed, options = WhopSDK::AdGroupUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["ad_groups/%1$s", id],
    body: parsed,
    model: WhopSDK::AdGroup,
    options: options
  )
end