Class: WhopSDK::Resources::Plans
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Plans
- Defined in:
- lib/whop_sdk/resources/plans.rb
Instance Method Summary collapse
-
#create(company_id: , product_id: , billing_period: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, override_tax_type: nil, plan_type: nil, release_method: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: 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
Delete an existing Plan.
-
#initialize(client:) ⇒ Plans
constructor
private
A new instance of Plans.
-
#list(company_id: , after: nil, 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>
Lists plans for a company.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Plan
Retrieves a plan by ID.
-
#update(id, billing_period: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, offer_cancel_discount: nil, override_tax_type: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: 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.
234 235 236 |
# File 'lib/whop_sdk/resources/plans.rb', line 234 def initialize(client:) @client = client end |
Instance Method Details
#create(company_id: , product_id: , billing_period: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, override_tax_type: nil, plan_type: nil, release_method: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: 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 Plan
Required permissions:
-
‘plan:create`
-
‘access_pass:basic:read`
-
‘plan:basic:read`
66 67 68 69 |
# File 'lib/whop_sdk/resources/plans.rb', line 66 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
Delete an existing Plan
Required permissions:
-
‘plan:delete`
222 223 224 225 226 227 228 229 |
# File 'lib/whop_sdk/resources/plans.rb', line 222 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, 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>
Lists plans for a company
Required permissions:
-
‘plan:basic:read`
196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/whop_sdk/resources/plans.rb', line 196 def list(params) parsed, = WhopSDK::PlanListParams.dump_request(params) @client.request( method: :get, path: "plans", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::PlanListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Plan
Retrieves a plan by ID
Required permissions:
-
‘plan:basic:read`
85 86 87 88 89 90 91 92 |
# File 'lib/whop_sdk/resources/plans.rb', line 85 def retrieve(id, params = {}) @client.request( method: :get, path: ["plans/%1$s", id], model: WhopSDK::Plan, options: params[:request_options] ) end |
#update(id, billing_period: nil, currency: nil, custom_fields: nil, description: nil, expiration_days: nil, image: nil, initial_price: nil, internal_notes: nil, offer_cancel_discount: nil, override_tax_type: nil, renewal_price: nil, stock: nil, strike_through_initial_price: nil, strike_through_renewal_price: 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 an existing Plan
Required permissions:
-
‘plan:update`
-
‘access_pass:basic:read`
-
‘plan:basic:read`
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/whop_sdk/resources/plans.rb', line 150 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 |