Class: Stigg::Resources::V1::Products
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Products
- Defined in:
- lib/stigg/resources/v1/products.rb
Overview
Operations related to products
Instance Method Summary collapse
-
#archive_product(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductArchiveProductParams for more details.
-
#create_product(id:, display_name:, description: nil, metadata: nil, multiple_subscriptions: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductCreateProductParams for more details.
-
#duplicate_product(id, target_id:, description: nil, display_name: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductDuplicateProductParams for more details.
-
#initialize(client:) ⇒ Products
constructor
private
A new instance of Products.
-
#list_products(id: nil, after: nil, before: nil, created_at: nil, limit: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::ProductListProductsResponse>
Some parameter documentations has been truncated, see Models::V1::ProductListProductsParams for more details.
-
#unarchive_product(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductUnarchiveProductParams for more details.
-
#update_product(id, description: nil, display_name: nil, metadata: nil, multiple_subscriptions: nil, product_settings: nil, usage_reset_cutoff_rule: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductUpdateProductParams 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/stigg/resources/v1/products.rb', line 242 def initialize(client:) @client = client end |
Instance Method Details
#archive_product(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductArchiveProductParams for more details.
Archives a product, preventing new subscriptions. All plans and addons are archived.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stigg/resources/v1/products.rb', line 27 def archive_product(id, params = {}) parsed, = Stigg::V1::ProductArchiveProductParams.dump_request(params) @client.request( method: :post, path: ["api/v1/products/%1$s/archive", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Product, options: ) end |
#create_product(id:, display_name:, description: nil, metadata: nil, multiple_subscriptions: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductCreateProductParams for more details.
Creates a new product.
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/stigg/resources/v1/products.rb', line 67 def create_product(params) parsed, = Stigg::V1::ProductCreateProductParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/products", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Product, options: ) end |
#duplicate_product(id, target_id:, description: nil, display_name: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductDuplicateProductParams for more details.
Duplicates an existing product, including its plans, addons, and configuration.
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/stigg/resources/v1/products.rb', line 104 def duplicate_product(id, params) parsed, = Stigg::V1::ProductDuplicateProductParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: ["api/v1/products/%1$s/duplicate", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Product, options: ) end |
#list_products(id: nil, after: nil, before: nil, created_at: nil, limit: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::ProductListProductsResponse>
Some parameter documentations has been truncated, see Models::V1::ProductListProductsParams for more details.
Retrieves a paginated list of products in the environment.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/stigg/resources/v1/products.rb', line 145 def list_products(params = {}) query_params = [:id, :after, :before, :created_at, :limit, :status] parsed, = Stigg::V1::ProductListProductsParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "api/v1/products", query: query.transform_keys(created_at: "createdAt"), 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::ProductListProductsResponse, options: ) end |
#unarchive_product(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductUnarchiveProductParams for more details.
Restores an archived product, allowing new subscriptions to be created.
181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/stigg/resources/v1/products.rb', line 181 def unarchive_product(id, params = {}) parsed, = Stigg::V1::ProductUnarchiveProductParams.dump_request(params) @client.request( method: :post, path: ["api/v1/products/%1$s/unarchive", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Product, options: ) end |
#update_product(id, description: nil, display_name: nil, metadata: nil, multiple_subscriptions: nil, product_settings: nil, usage_reset_cutoff_rule: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Product
Some parameter documentations has been truncated, see Models::V1::ProductUpdateProductParams for more details.
Updates an existing product’s properties such as display name, description, and metadata.
226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/stigg/resources/v1/products.rb', line 226 def update_product(id, params = {}) parsed, = Stigg::V1::ProductUpdateProductParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :patch, path: ["api/v1/products/%1$s", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Product, options: ) end |