Class: WhopSDK::Resources::Companies
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Companies
- Defined in:
- lib/whop_sdk/resources/companies.rb
Overview
Companies
Instance Method Summary collapse
-
#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.
-
#initialize(client:) ⇒ Companies
constructor
private
A new instance of Companies.
-
#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.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves the details of an existing company.
-
#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.
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.
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`
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/whop_sdk/resources/companies.rb', line 39 def create(params) parsed, = WhopSDK::CompanyCreateParams.dump_request(params) @client.request( method: :post, path: "companies", body: parsed, model: WhopSDK::Company, 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`
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, = 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: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves the details of an existing company.
Required permissions:
-
‘company:basic:read`
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`
115 116 117 118 119 120 121 122 123 124 |
# File 'lib/whop_sdk/resources/companies.rb', line 115 def update(id, params = {}) parsed, = WhopSDK::CompanyUpdateParams.dump_request(params) @client.request( method: :patch, path: ["companies/%1$s", id], body: parsed, model: WhopSDK::Company, options: ) end |