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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanArchiveParams for more details.
-
#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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanCreateParams for more details.
-
#create_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanCreateDraftParams for more details.
-
#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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListParams for more details.
-
#list_charges(id, after: nil, before: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListChargesResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListChargesParams for more details.
-
#list_overage_charges(id, after: nil, before: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListOverageChargesResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListOverageChargesParams for more details.
-
#publish(id, migration_type:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::PlanPublishResponse
Some parameter documentations has been truncated, see Models::V1::PlanPublishParams for more details.
-
#remove_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::PlanRemoveDraftResponse
Some parameter documentations has been truncated, see Models::V1::PlanRemoveDraftParams for more details.
-
#retrieve(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanRetrieveParams for more 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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::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.
403 404 405 406 |
# File 'lib/stigg/resources/v1/plans.rb', line 403 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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanArchiveParams for more details.
Archives a plan, preventing it from being used in new subscriptions.
205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/stigg/resources/v1/plans.rb', line 205 def archive(id, params = {}) parsed, = Stigg::V1::PlanArchiveParams.dump_request(params) @client.request( method: :post, path: ["api/v1/plans/%1$s/archive", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Plan, 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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanCreateParams for more details.
Creates a new plan in draft status.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/stigg/resources/v1/plans.rb', line 47 def create(params) parsed, = Stigg::V1::PlanCreateParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/plans", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Plan, options: ) end |
#create_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanCreateDraftParams for more details.
Creates a draft version of an existing plan for modification before publishing.
237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/stigg/resources/v1/plans.rb', line 237 def create_draft(id, params = {}) parsed, = Stigg::V1::PlanCreateDraftParams.dump_request(params) @client.request( method: :post, path: ["api/v1/plans/%1$s/draft", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Plan, options: ) end |
#list(after: nil, before: nil, created_at: nil, limit: nil, product_id: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListParams for more details.
Retrieves a paginated list of plans in the environment.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/stigg/resources/v1/plans.rb', line 169 def list(params = {}) query_params = [:after, :before, :created_at, :limit, :product_id, :status] parsed, = Stigg::V1::PlanListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "api/v1/plans", query: query.transform_keys(created_at: "createdAt", product_id: "productId"), headers: parsed.except(*query_params).transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::PlanListResponse, options: ) end |
#list_charges(id, after: nil, before: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListChargesResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListChargesParams for more details.
Retrieves the list of charges configured on a plan.
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/stigg/resources/v1/plans.rb', line 275 def list_charges(id, params = {}) query_params = [:after, :before, :limit] parsed, = Stigg::V1::PlanListChargesParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["api/v1/plans/%1$s/charges", id], query: query, headers: parsed.except(*query_params).transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::PlanListChargesResponse, options: ) end |
#list_overage_charges(id, after: nil, before: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::PlanListOverageChargesResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListOverageChargesParams for more details.
Retrieves the list of overage charges configured on a plan.
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/stigg/resources/v1/plans.rb', line 317 def list_overage_charges(id, params = {}) query_params = [:after, :before, :limit] parsed, = Stigg::V1::PlanListOverageChargesParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["api/v1/plans/%1$s/overage-charges", id], query: query, headers: parsed.except(*query_params).transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::PlanListOverageChargesResponse, options: ) end |
#publish(id, migration_type:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::PlanPublishResponse
Some parameter documentations has been truncated, see Models::V1::PlanPublishParams for more details.
Publishes a draft plan, making it available for use in subscriptions.
355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/stigg/resources/v1/plans.rb', line 355 def publish(id, params) parsed, = Stigg::V1::PlanPublishParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: ["api/v1/plans/%1$s/publish", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::PlanPublishResponse, options: ) end |
#remove_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::PlanRemoveDraftResponse
Some parameter documentations has been truncated, see Models::V1::PlanRemoveDraftParams for more details.
Removes a draft version of a plan.
386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/stigg/resources/v1/plans.rb', line 386 def remove_draft(id, params = {}) parsed, = Stigg::V1::PlanRemoveDraftParams.dump_request(params) @client.request( method: :delete, path: ["api/v1/plans/%1$s/draft", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::Models::V1::PlanRemoveDraftResponse, options: ) end |
#retrieve(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanRetrieveParams for more details.
Retrieves a plan by its unique identifier, including entitlements and pricing details.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/stigg/resources/v1/plans.rb', line 79 def retrieve(id, params = {}) parsed, = Stigg::V1::PlanRetrieveParams.dump_request(params) @client.request( method: :get, path: ["api/v1/plans/%1$s", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Plan, 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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plan
Some parameter documentations has been truncated, see Models::V1::PlanUpdateParams for more details.
Updates an existing plan’s properties such as display name, description, and metadata.
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/stigg/resources/v1/plans.rb', line 128 def update(id, params = {}) parsed, = Stigg::V1::PlanUpdateParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :patch, path: ["api/v1/plans/%1$s", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Plan, options: ) end |