Class: WhopSDK::Resources::Products
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Products
- Defined in:
- lib/whop_sdk/resources/products.rb
Overview
Products
Instance Method Summary collapse
-
#create(company_id:, title:, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, experience_ids: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, plan_options: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: nil, send_welcome_message: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Product
Some parameter documentations has been truncated, see Models::ProductCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a product and remove it from the company’s catalog.
-
#initialize(client:) ⇒ Products
constructor
private
A new instance of Products.
-
#list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_types: nil, visibilities: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ProductListItem>
Returns a paginated list of products belonging to a company, with optional filtering by type, visibility, and creation date.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Product
Retrieves the details of an existing product.
-
#update(id, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, gallery_images: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: nil, send_welcome_message: nil, store_page_config: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Product
Some parameter documentations has been truncated, see Models::ProductUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Products
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 Products.
240 241 242 |
# File 'lib/whop_sdk/resources/products.rb', line 240 def initialize(client:) @client = client end |
Instance Method Details
#create(company_id:, title:, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, experience_ids: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, plan_options: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: nil, send_welcome_message: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Product
Some parameter documentations has been truncated, see Models::ProductCreateParams for more details.
Create a new product for a company. The product serves as the top-level container for plans and experiences.
Required permissions:
-
‘access_pass:create`
-
‘access_pass:basic:read`
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/whop_sdk/resources/products.rb', line 63 def create(params) parsed, = WhopSDK::ProductCreateParams.dump_request(params) @client.request( method: :post, path: "products", body: parsed, model: WhopSDK::Product, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a product and remove it from the company’s catalog.
Required permissions:
-
‘access_pass:delete`
228 229 230 231 232 233 234 235 |
# File 'lib/whop_sdk/resources/products.rb', line 228 def delete(id, params = {}) @client.request( method: :delete, path: ["products/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_types: nil, visibilities: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ProductListItem>
Returns a paginated list of products belonging to a company, with optional filtering by type, visibility, and creation date.
Required permissions:
-
‘access_pass:basic:read`
200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/whop_sdk/resources/products.rb', line 200 def list(params) parsed, = WhopSDK::ProductListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "products", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::ProductListItem, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Product
Retrieves the details of an existing product.
Required permissions:
-
‘access_pass:basic:read`
89 90 91 92 93 94 95 96 |
# File 'lib/whop_sdk/resources/products.rb', line 89 def retrieve(id, params = {}) @client.request( method: :get, path: ["products/%1$s", id], model: WhopSDK::Product, options: params[:request_options] ) end |
#update(id, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, gallery_images: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: nil, send_welcome_message: nil, store_page_config: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Product
Some parameter documentations has been truncated, see Models::ProductUpdateParams for more details.
Update a product’s title, description, visibility, and other settings.
Required permissions:
-
‘access_pass:update`
-
‘access_pass:basic:read`
153 154 155 156 157 158 159 160 161 162 |
# File 'lib/whop_sdk/resources/products.rb', line 153 def update(id, params = {}) parsed, = WhopSDK::ProductUpdateParams.dump_request(params) @client.request( method: :patch, path: ["products/%1$s", id], body: parsed, model: WhopSDK::Product, options: ) end |