Class: WhopSDK::Resources::Companies

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

Overview

Companies

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Companies

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

Parameters:



176
177
178
# File 'lib/whop_sdk/resources/companies.rb', line 176

def initialize(client:)
  @client = client
end

Instance Method Details

#create(title:, description: nil, email: nil, logo: nil, metadata: nil, parent_company_id: nil, send_customer_emails: nil, request_options: {}) ⇒ WhopSDK::Models::Company

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

Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user.

Required permissions:

  • ‘company:create`

  • ‘company:basic:read`

Parameters:

  • title (String)

    The display name of the company shown to customers.

  • description (String, nil)

    A promotional pitch displayed to potential customers on the company’s store page

  • email (String, nil)

    The email address of the user who will own the connected account. Required when

  • logo (WhopSDK::Models::CompanyCreateParams::Logo, nil)

    The company’s logo image. Accepts PNG, JPEG, or GIF format.

  • metadata (Hash{Symbol=>Object}, nil)

    A key-value JSON object of custom metadata to store on the company.

  • parent_company_id (String, nil)

    The unique identifier of the parent platform company. When provided, creates a c

  • send_customer_emails (Boolean, nil)

    Whether Whop sends transactional emails to customers on behalf of this company.

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

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
# File 'lib/whop_sdk/resources/companies.rb', line 39

def create(params)
  parsed, options = WhopSDK::CompanyCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "companies",
    body: parsed,
    model: WhopSDK::Company,
    options: options
  )
end

#list(after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, parent_company_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyListResponse>

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

Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to.

Required permissions:

  • ‘company: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.

  • created_after (Time, nil)

    Only return companies created after this timestamp.

  • created_before (Time, nil)

    Only return companies created before this timestamp.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • parent_company_id (String, nil)

    The unique identifier of the parent platform company. When provided, lists conne

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

Returns:

See Also:



160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/whop_sdk/resources/companies.rb', line 160

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

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

Retrieves the details of an existing company.

Required permissions:

  • ‘company:basic:read`

Parameters:

  • id (String)

    The unique identifier or route slug of the company.

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

Returns:

See Also:



65
66
67
68
69
70
71
72
# File 'lib/whop_sdk/resources/companies.rb', line 65

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

#update(id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, description: nil, featured_affiliate_product_id: nil, logo: nil, route: nil, send_customer_emails: nil, social_links: nil, target_audience: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Company

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

Update a company’s title, description, logo, and other settings.

Required permissions:

  • ‘company:update`

  • ‘company:basic:read`

Parameters:

  • id (String)

    The unique identifier of the company to update.

  • affiliate_application_required (Boolean, nil)

    Whether prospective affiliates must submit an application before they can promot

  • affiliate_instructions (String, nil)

    Guidelines and instructions shown to affiliates explaining how to promote this c

  • banner_image (WhopSDK::Models::CompanyUpdateParams::BannerImage, nil)

    The company’s banner image. Accepts PNG or JPEG format.

  • description (String, nil)

    A promotional pitch displayed to potential customers on the company’s store page

  • featured_affiliate_product_id (String, nil)

    The ID of the product to feature on this company’s affiliate page. Pass null to

  • logo (WhopSDK::Models::CompanyUpdateParams::Logo, nil)

    The company’s logo image. Accepts PNG, JPEG, or GIF format.

  • route (String, nil)

    The unique URL slug for the company’s store page. Must be lowercase and can incl

  • send_customer_emails (Boolean, nil)

    Whether Whop sends transactional emails (receipts, renewals, cancelations) to cu

  • social_links (Array<WhopSDK::Models::CompanyUpdateParams::SocialLink>, nil)

    The social media links to display on the company’s store page. Pass the full lis

  • target_audience (String, nil)

    The target audience for this company (e.g., ‘beginner day traders aged 18-25 loo

  • title (String, nil)

    The display name of the company shown to customers.

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

Returns:

See Also:



115
116
117
118
119
120
121
122
123
124
# File 'lib/whop_sdk/resources/companies.rb', line 115

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