Class: WhopSDK::Resources::Referrals::Businesses

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/referrals/businesses.rb,
lib/whop_sdk/resources/referrals/businesses/earnings.rb,
sig/whop_sdk/resources/referrals/businesses.rbs,
sig/whop_sdk/resources/referrals/businesses/earnings.rbs

Overview

The Referrals API covers your Whop partner activity: the users you referred onto Whop, the businesses you referred and the earnings generated from their processing volume, and the partner leaderboard.

Use it to enroll as a Whop partner, list the users you referred, list your referred businesses and review their earnings, and see the partner leaderboard.

Defined Under Namespace

Classes: Earnings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Businesses

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

Parameters:



125
126
127
128
# File 'lib/whop_sdk/resources/referrals/businesses.rb', line 125

def initialize(client:)
  @client = client
  @earnings = WhopSDK::Resources::Referrals::Businesses::Earnings.new(client: client)
end

Instance Attribute Details

#earningsWhopSDK::Resources::Referrals::Businesses::Earnings (readonly)

The Referrals API covers your Whop partner activity: the users you referred onto Whop, the businesses you referred and the earnings generated from their processing volume, and the partner leaderboard.

Use it to enroll as a Whop partner, list the users you referred, list your referred businesses and review their earnings, and see the partner leaderboard.



20
21
22
# File 'lib/whop_sdk/resources/referrals/businesses.rb', line 20

def earnings
  @earnings
end

Instance Method Details

#leaderboard(period: nil, request_options: {}) ⇒ WhopSDK::Models::Referrals::BusinessLeaderboardResponse

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

Ranks referrers by business referral earnings — all-time by default, or over the current day, month, year, or trailing 30 days — and includes the caller's own standing.

Parameters:

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/whop_sdk/resources/referrals/businesses.rb', line 110

def leaderboard(params = {})
  parsed, options = WhopSDK::Referrals::BusinessLeaderboardParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "partners/leaderboard",
    query: query,
    model: WhopSDK::Models::Referrals::BusinessLeaderboardResponse,
    options: options
  )
end

#list(after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, has_earnings: nil, last: nil, order: nil, referred_user_id: nil, referred_username: nil, status: nil, tier: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Referrals::BusinessListResponse>

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

Lists the businesses the authenticated user referred onto Whop, most recent first.

Parameters:

  • after (String)

    Cursor to fetch the page after (from page_info.end_cursor).

  • before (String)

    Cursor to fetch the page before (from page_info.start_cursor).

  • created_after (String)

    Only return business referrals created after this timestamp.

  • created_before (String)

    Only return business referrals created before this timestamp.

  • direction (Symbol, WhopSDK::Models::Referrals::BusinessListParams::Direction)

    Sort direction.

  • first (Integer)

    Number of business referrals to return from the start of the window.

  • has_earnings (Boolean)

    When true, only businesses with pending or completed earnings paid to the caller

  • last (Integer)

    Number of business referrals to return from the end of the window.

  • order (Symbol, WhopSDK::Models::Referrals::BusinessListParams::Order)

    The field to sort business referrals by.

  • referred_user_id (String)

    Filter to referrals attributed to this user. For first-tier referrals, this is t

  • referred_username (String)

    Filter by the referred user's exact username. Ignored when referred_user_id is

  • status (Symbol, WhopSDK::Models::Referrals::BusinessListParams::Status)

    Filter by referral status.

  • tier (Symbol, WhopSDK::Models::Referrals::BusinessListParams::Tier)

    Filter to only first-tier referrals or only second-tier referrals.

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

Returns:

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/whop_sdk/resources/referrals/businesses.rb', line 81

def list(params = {})
  parsed, options = WhopSDK::Referrals::BusinessListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "partners/businesses",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::Referrals::BusinessListResponse,
    options: options
  )
end

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

Retrieves a single referred business and its referral terms.

Parameters:

  • id (String)

    The business referral ID (a coma_ identifier).

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

Returns:

See Also:



33
34
35
36
37
38
39
40
# File 'lib/whop_sdk/resources/referrals/businesses.rb', line 33

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