Class: WhopSDK::Resources::Products
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Products
- Defined in:
- lib/whop_sdk/resources/products.rb
Instance Method Summary collapse
-
#create(company_id: , title: , business_type: nil, 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, industry_type: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, plan_options: nil, product_highlights: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: 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
Deletes an existing Product.
-
#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>
Lists products for a company.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Product
Retrieves a product by ID or route.
-
#update(id, business_type: nil, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, industry_type: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: 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.
242 243 244 |
# File 'lib/whop_sdk/resources/products.rb', line 242 def initialize(client:) @client = client end |
Instance Method Details
#create(company_id: , title: , business_type: nil, 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, industry_type: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, plan_options: nil, product_highlights: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Product
Some parameter documentations has been truncated, see Models::ProductCreateParams for more details.
Creates a new Product
Required permissions:
-
‘access_pass:create`
-
‘access_pass:basic:read`
betwee
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/whop_sdk/resources/products.rb', line 66 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
Deletes an existing Product
Required permissions:
-
‘access_pass:delete`
230 231 232 233 234 235 236 237 |
# File 'lib/whop_sdk/resources/products.rb', line 230 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>
Lists products for a company
Required permissions:
-
‘access_pass:basic:read`
203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/whop_sdk/resources/products.rb', line 203 def list(params) parsed, = WhopSDK::ProductListParams.dump_request(params) @client.request( method: :get, path: "products", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::ProductListItem, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Product
Retrieves a product by ID or route
Required permissions:
-
‘access_pass:basic:read`
92 93 94 95 96 97 98 99 |
# File 'lib/whop_sdk/resources/products.rb', line 92 def retrieve(id, params = {}) @client.request( method: :get, path: ["products/%1$s", id], model: WhopSDK::Product, options: params[:request_options] ) end |
#update(id, business_type: nil, collect_shipping_address: nil, custom_cta: nil, custom_cta_url: nil, custom_statement_descriptor: nil, description: nil, global_affiliate_percentage: nil, global_affiliate_status: nil, headline: nil, industry_type: nil, member_affiliate_percentage: nil, member_affiliate_status: nil, product_tax_code_id: nil, redirect_purchase_url: nil, route: 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.
Updates an existing Product
Required permissions:
-
‘access_pass:update`
-
‘access_pass:basic:read`
betwee
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/whop_sdk/resources/products.rb', line 157 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 |