Class: WhopSDK::Resources::Plans
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Plans
- Defined in:
- lib/whop_sdk/resources/plans.rb
Overview
Plans
Instance Method Summary collapse
-
#create(company_id:, product_id:, adaptive_pricing_enabled: nil, billing_period: nil, checkout_styling: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, legacy_payment_method_controls: nil, metadata: nil, override_tax_type: nil, payment_method_configuration: nil, plan_type: nil, release_method: nil, renewal_price: nil, split_pay_required_payments: nil, stock: nil, three_ds_level: nil, title: nil, trial_period_days: nil, unlimited_stock: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Plan
Some parameter documentations has been truncated, see Models::PlanCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a plan from a product.
-
#initialize(client:) ⇒ Plans
constructor
private
A new instance of Plans.
-
#list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, plan_types: nil, product_ids: nil, release_methods: nil, visibilities: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PlanListResponse>
Returns a paginated list of plans belonging to a company, with optional filtering by visibility, type, release method, and product.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Plan
Retrieves the details of an existing plan.
-
#update(id, adaptive_pricing_enabled: nil, billing_period: nil, checkout_styling: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, legacy_payment_method_controls: nil, metadata: nil, offer_cancel_discount: nil, override_tax_type: nil, payment_method_configuration: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: nil, three_ds_level: nil, title: nil, trial_period_days: nil, unlimited_stock: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Plan
Some parameter documentations has been truncated, see Models::PlanUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Plans
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 Plans.
268 269 270 |
# File 'lib/whop_sdk/resources/plans.rb', line 268 def initialize(client:) @client = client end |
Instance Method Details
#create(company_id:, product_id:, adaptive_pricing_enabled: nil, billing_period: nil, checkout_styling: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, legacy_payment_method_controls: nil, metadata: nil, override_tax_type: nil, payment_method_configuration: nil, plan_type: nil, release_method: nil, renewal_price: nil, split_pay_required_payments: nil, stock: nil, three_ds_level: nil, title: nil, trial_period_days: nil, unlimited_stock: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Plan
Some parameter documentations has been truncated, see Models::PlanCreateParams for more details.
Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers.
Required permissions:
-
‘plan:create`
-
‘access_pass:basic:read`
-
‘plan:basic:read`
78 79 80 81 |
# File 'lib/whop_sdk/resources/plans.rb', line 78 def create(params) parsed, = WhopSDK::PlanCreateParams.dump_request(params) @client.request(method: :post, path: "plans", body: parsed, model: WhopSDK::Plan, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a plan from a product. Existing memberships on this plan will not be affected.
Required permissions:
-
‘plan:delete`
256 257 258 259 260 261 262 263 |
# File 'lib/whop_sdk/resources/plans.rb', line 256 def delete(id, params = {}) @client.request( method: :delete, path: ["plans/%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, plan_types: nil, product_ids: nil, release_methods: nil, visibilities: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PlanListResponse>
Returns a paginated list of plans belonging to a company, with optional filtering by visibility, type, release method, and product.
Required permissions:
-
‘plan:basic:read`
227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/whop_sdk/resources/plans.rb', line 227 def list(params) parsed, = WhopSDK::PlanListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "plans", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::PlanListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Plan
Retrieves the details of an existing plan.
Required permissions:
-
‘plan:basic:read`
98 99 100 101 102 103 104 105 |
# File 'lib/whop_sdk/resources/plans.rb', line 98 def retrieve(id, params = {}) @client.request( method: :get, path: ["plans/%1$s", id], model: WhopSDK::Plan, options: params[:request_options] ) end |
#update(id, adaptive_pricing_enabled: nil, billing_period: nil, checkout_styling: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, legacy_payment_method_controls: nil, metadata: nil, offer_cancel_discount: nil, override_tax_type: nil, payment_method_configuration: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: nil, three_ds_level: nil, title: nil, trial_period_days: nil, unlimited_stock: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Plan
Some parameter documentations has been truncated, see Models::PlanUpdateParams for more details.
Update a plan’s pricing, billing interval, visibility, stock, and other settings.
Required permissions:
-
‘plan:update`
-
‘access_pass:basic:read`
-
‘plan:basic:read`
176 177 178 179 180 181 182 183 184 185 |
# File 'lib/whop_sdk/resources/plans.rb', line 176 def update(id, params = {}) parsed, = WhopSDK::PlanUpdateParams.dump_request(params) @client.request( method: :patch, path: ["plans/%1$s", id], body: parsed, model: WhopSDK::Plan, options: ) end |