Class: WhopSDK::Resources::Stats
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Stats
- Defined in:
- lib/whop_sdk/resources/stats.rb,
sig/whop_sdk/resources/stats.rbs
Overview
Stats represent aggregated activity for an account over time. They help you understand revenue, transactions, disputes, members, referrals, and advertising performance across reporting periods like days, weeks, or months.
Use the Stats API to list available metrics and their filterable properties, then retrieve time-series values for a date range.
Instance Method Summary collapse
-
#initialize(client:) ⇒ Stats
constructor
private
A new instance of Stats.
-
#list(request_options: {}) ⇒ WhopSDK::Models::StatListResponse
Lists every metric you can query, with its unit and the properties you can filter or break it down by.
-
#retrieve(metric, from:, to:, access_level: nil, account_id: nil, ad_campaign_ids: nil, ad_group_ids: nil, ad_ids: nil, breakdown_by: nil, card_network: nil, category: nil, convert_to: nil, currency: nil, fee_type: nil, interval: nil, most_recent_action: nil, payment_method: nil, product: nil, referred_user_id: nil, segment: nil, snapshot_window: nil, source: nil, status: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Models::StatRetrieveResponse
Some parameter documentations has been truncated, see Models::StatRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Stats
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 Stats.
108 109 110 |
# File 'lib/whop_sdk/resources/stats.rb', line 108 def initialize(client:) @client = client end |
Instance Method Details
#list(request_options: {}) ⇒ WhopSDK::Models::StatListResponse
Lists every metric you can query, with its unit and the properties you can filter or break it down by.
96 97 98 99 100 101 102 103 |
# File 'lib/whop_sdk/resources/stats.rb', line 96 def list(params = {}) @client.request( method: :get, path: "stats", model: WhopSDK::Models::StatListResponse, options: params[:request_options] ) end |
#retrieve(metric, from:, to:, access_level: nil, account_id: nil, ad_campaign_ids: nil, ad_group_ids: nil, ad_ids: nil, breakdown_by: nil, card_network: nil, category: nil, convert_to: nil, currency: nil, fee_type: nil, interval: nil, most_recent_action: nil, payment_method: nil, product: nil, referred_user_id: nil, segment: nil, snapshot_window: nil, source: nil, status: nil, time_zone: nil, request_options: {}) ⇒ WhopSDK::Models::StatRetrieveResponse
Some parameter documentations has been truncated, see Models::StatRetrieveParams for more details.
Retrieves a metric as a time series of points for an account over a date range.
the
A
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/whop_sdk/resources/stats.rb', line 74 def retrieve(metric, params) parsed, = WhopSDK::StatRetrieveParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["stats/%1$s", metric], query: query, model: WhopSDK::Models::StatRetrieveResponse, options: ) end |