Class: Stigg::Resources::V1::Plans
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Plans
- Defined in:
- lib/stigg/resources/v1/plans.rb,
lib/stigg/resources/v1/plans/entitlements.rb
Overview
Operations related to plans
Defined Under Namespace
Classes: Entitlements
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#archive(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Archives a plan, preventing it from being used in new subscriptions.
-
#create(id:, display_name:, product_id:, billing_id: nil, default_trial_config: nil, description: nil, metadata: nil, parent_plan_id: nil, pricing_type: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Creates a new plan in draft status.
-
#create_draft(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Creates a draft version of an existing plan for modification before publishing.
-
#initialize(client:) ⇒ Plans
constructor
private
A new instance of Plans.
-
#list(after: nil, before: nil, created_at: nil, limit: nil, product_id: nil, status: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListResponse>
Retrieves a paginated list of plans in the environment.
-
#publish(id, migration_type:, request_options: {}) ⇒ Stigg::Models::V1::PlanPublishResponse
Publishes a draft plan, making it available for use in subscriptions.
-
#remove_draft(id, request_options: {}) ⇒ Stigg::Models::V1::PlanRemoveDraftResponse
Removes a draft version of a plan.
-
#retrieve(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Retrieves a plan by its unique identifier, including entitlements and pricing details.
-
#update(id, billing_id: nil, charges: nil, compatible_addon_ids: nil, default_trial_config: nil, description: nil, display_name: nil, metadata: nil, parent_plan_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Updates an existing plan’s properties such as display name, description, and metadata.
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.
232 233 234 235 |
# File 'lib/stigg/resources/v1/plans.rb', line 232 def initialize(client:) @client = client @entitlements = Stigg::Resources::V1::Plans::Entitlements.new(client: client) end |
Instance Attribute Details
#entitlements ⇒ Stigg::Resources::V1::Plans::Entitlements (readonly)
9 10 11 |
# File 'lib/stigg/resources/v1/plans.rb', line 9 def entitlements @entitlements end |
Instance Method Details
#archive(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Archives a plan, preventing it from being used in new subscriptions.
156 157 158 159 160 161 162 163 |
# File 'lib/stigg/resources/v1/plans.rb', line 156 def archive(id, params = {}) @client.request( method: :post, path: ["api/v1/plans/%1$s/archive", id], model: Stigg::V1::Plan, options: params[:request_options] ) end |
#create(id:, display_name:, product_id:, billing_id: nil, default_trial_config: nil, description: nil, metadata: nil, parent_plan_id: nil, pricing_type: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Creates a new plan in draft status.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/stigg/resources/v1/plans.rb', line 40 def create(params) parsed, = Stigg::V1::PlanCreateParams.dump_request(params) @client.request( method: :post, path: "api/v1/plans", body: parsed, model: Stigg::V1::Plan, options: ) end |
#create_draft(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Creates a draft version of an existing plan for modification before publishing.
176 177 178 179 180 181 182 183 |
# File 'lib/stigg/resources/v1/plans.rb', line 176 def create_draft(id, params = {}) @client.request( method: :post, path: ["api/v1/plans/%1$s/draft", id], model: Stigg::V1::Plan, options: params[:request_options] ) end |
#list(after: nil, before: nil, created_at: nil, limit: nil, product_id: nil, status: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListResponse>
Retrieves a paginated list of plans in the environment.
132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/stigg/resources/v1/plans.rb', line 132 def list(params = {}) parsed, = Stigg::V1::PlanListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/plans", query: query.transform_keys(created_at: "createdAt", product_id: "productId"), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::PlanListResponse, options: ) end |
#publish(id, migration_type:, request_options: {}) ⇒ Stigg::Models::V1::PlanPublishResponse
Publishes a draft plan, making it available for use in subscriptions.
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/stigg/resources/v1/plans.rb', line 198 def publish(id, params) parsed, = Stigg::V1::PlanPublishParams.dump_request(params) @client.request( method: :post, path: ["api/v1/plans/%1$s/publish", id], body: parsed, model: Stigg::Models::V1::PlanPublishResponse, options: ) end |
#remove_draft(id, request_options: {}) ⇒ Stigg::Models::V1::PlanRemoveDraftResponse
Removes a draft version of a plan.
220 221 222 223 224 225 226 227 |
# File 'lib/stigg/resources/v1/plans.rb', line 220 def remove_draft(id, params = {}) @client.request( method: :delete, path: ["api/v1/plans/%1$s/draft", id], model: Stigg::Models::V1::PlanRemoveDraftResponse, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ Stigg::Models::V1::Plan
Retrieves a plan by its unique identifier, including entitlements and pricing details.
63 64 65 66 67 68 69 70 |
# File 'lib/stigg/resources/v1/plans.rb', line 63 def retrieve(id, params = {}) @client.request( method: :get, path: ["api/v1/plans/%1$s", id], model: Stigg::V1::Plan, options: params[:request_options] ) end |
#update(id, billing_id: nil, charges: nil, compatible_addon_ids: nil, default_trial_config: nil, description: nil, display_name: nil, metadata: nil, parent_plan_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Updates an existing plan’s properties such as display name, description, and metadata.
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/stigg/resources/v1/plans.rb', line 100 def update(id, params = {}) parsed, = Stigg::V1::PlanUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/v1/plans/%1$s", id], body: parsed, model: Stigg::V1::Plan, options: ) end |