Class: WhopSDK::Resources::AdReports

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

Overview

Ad reports

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AdReports

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

Parameters:



60
61
62
# File 'lib/whop_sdk/resources/ad_reports.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(from:, to:, ad_campaign_id: nil, ad_group_id: nil, ad_id: nil, breakdown: nil, company_id: nil, currency: nil, granularity: nil, request_options: {}) ⇒ WhopSDK::Models::AdReportRetrieveResponse

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

Performance report for a company, ad campaign, ad group, or ad. Always returns aggregate ‘summary` totals. Set `granularity` (`daily`/`hourly`) to additionally get a time series, or set `breakdown` (`campaign`/`ad_group`/`ad`) to additionally get per-entity rows inside the requested scope. Exactly one of `companyId`, `adCampaignId`, `adGroupId`, or `adId` must be provided.

Required permissions:

  • ‘ad_campaign:stats:read`

Parameters:

  • from (Time)

    Inclusive start of the reporting window.

  • to (Time)

    Inclusive end of the reporting window.

  • ad_campaign_id (String, nil)

    The unique identifier of an ad campaign. Mutually exclusive with ‘companyId`, `a

  • ad_group_id (String, nil)

    The unique identifier of an ad group. Mutually exclusive with ‘companyId`, `adCa

  • ad_id (String, nil)

    The unique identifier of an ad. Mutually exclusive with ‘companyId`, `adCampaign

  • breakdown (Symbol, WhopSDK::Models::AdReportRetrieveParams::Breakdown, nil)

    Entity level to group an ad report by.

  • company_id (String, nil)

    The unique identifier of a company. Mutually exclusive with ‘adCampaignId`, `adG

  • currency (String, nil)

    ISO 4217 currency code to report ‘spend` in. Defaults to the company’s ads repor

  • granularity (Symbol, WhopSDK::Models::Granularities, nil)

    Bucket size for external ad stat rows.

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

Returns:

See Also:



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/whop_sdk/resources/ad_reports.rb', line 45

def retrieve(params)
  parsed, options = WhopSDK::AdReportRetrieveParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "ad_reports",
    query: query,
    model: WhopSDK::Models::AdReportRetrieveResponse,
    options: options
  )
end