Class: WhopSDK::Resources::Companies
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Companies
- Defined in:
- lib/whop_sdk/resources/companies.rb
Instance Method Summary collapse
-
#create(email: , parent_company_id: , title: , metadata: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Create a new sub company for your platform.
-
#initialize(client:) ⇒ Companies
constructor
private
A new instance of Companies.
-
#list(parent_company_id: , after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyListResponse>
Lists companies the current user has access to.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves an company by ID or its url route.
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.
107 108 109 |
# File 'lib/whop_sdk/resources/companies.rb', line 107 def initialize(client:) @client = client end |
Instance Method Details
#create(email: , parent_company_id: , title: , metadata: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Create a new sub company for your platform
Required permissions:
-
‘company:create_child`
-
‘company:basic:read`
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/whop_sdk/resources/companies.rb', line 28 def create(params) parsed, = WhopSDK::CompanyCreateParams.dump_request(params) @client.request( method: :post, path: "companies", body: parsed, model: WhopSDK::Company, options: ) end |
#list(parent_company_id: , after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyListResponse>
Lists companies the current user has access to
Required permissions:
-
‘company:basic:read`
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/whop_sdk/resources/companies.rb', line 92 def list(params) parsed, = WhopSDK::CompanyListParams.dump_request(params) @client.request( method: :get, path: "companies", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::CompanyListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves an company by ID or its url route
Required permissions:
-
‘company:basic:read`
54 55 56 57 58 59 60 61 |
# File 'lib/whop_sdk/resources/companies.rb', line 54 def retrieve(id, params = {}) @client.request( method: :get, path: ["companies/%1$s", id], model: WhopSDK::Company, options: params[:request_options] ) end |