Class: Stigg::Resources::V1::Addons
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Addons
- Defined in:
- lib/stigg/resources/v1/addons.rb,
lib/stigg/resources/v1/addons/entitlements.rb
Overview
Operations related to addons
Defined Under Namespace
Classes: Entitlements
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#archive(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Archives an addon, preventing it from being used in new subscriptions.
-
#create(id:, display_name:, product_id:, billing_id: nil, description: nil, max_quantity: nil, metadata: nil, pricing_type: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon
Creates a new addon in draft status, associated with a specific product.
-
#create_draft(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Creates a draft version of an existing addon for modification before publishing.
-
#initialize(client:) ⇒ Addons
constructor
private
A new instance of Addons.
-
#list(after: nil, before: nil, created_at: nil, limit: nil, product_id: nil, status: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::AddonListResponse>
Retrieves a paginated list of addons in the environment.
-
#publish(id, migration_type:, request_options: {}) ⇒ Stigg::Models::V1::AddonPublishResponse
Publishes a draft addon, making it available for use in subscriptions.
-
#remove_draft(id, request_options: {}) ⇒ Stigg::Models::V1::AddonRemoveDraftResponse
Removes a draft version of an addon.
-
#retrieve(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Retrieves an addon by its unique identifier, including entitlements and pricing details.
-
#update(id, billing_id: nil, charges: nil, dependencies: nil, description: nil, display_name: nil, max_quantity: nil, metadata: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon
Updates an existing addon’s properties such as display name, description, and metadata.
Constructor Details
#initialize(client:) ⇒ Addons
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 Addons.
230 231 232 233 |
# File 'lib/stigg/resources/v1/addons.rb', line 230 def initialize(client:) @client = client @entitlements = Stigg::Resources::V1::Addons::Entitlements.new(client: client) end |
Instance Attribute Details
#entitlements ⇒ Stigg::Resources::V1::Addons::Entitlements (readonly)
9 10 11 |
# File 'lib/stigg/resources/v1/addons.rb', line 9 def entitlements @entitlements end |
Instance Method Details
#archive(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Archives an addon, preventing it from being used in new subscriptions.
154 155 156 157 158 159 160 161 |
# File 'lib/stigg/resources/v1/addons.rb', line 154 def archive(id, params = {}) @client.request( method: :post, path: ["api/v1/addons/%1$s/archive", id], model: Stigg::V1::Addon, options: params[:request_options] ) end |
#create(id:, display_name:, product_id:, billing_id: nil, description: nil, max_quantity: nil, metadata: nil, pricing_type: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon
Creates a new addon in draft status, associated with a specific product.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/stigg/resources/v1/addons.rb', line 38 def create(params) parsed, = Stigg::V1::AddonCreateParams.dump_request(params) @client.request( method: :post, path: "api/v1/addons", body: parsed, model: Stigg::V1::Addon, options: ) end |
#create_draft(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Creates a draft version of an existing addon for modification before publishing.
174 175 176 177 178 179 180 181 |
# File 'lib/stigg/resources/v1/addons.rb', line 174 def create_draft(id, params = {}) @client.request( method: :post, path: ["api/v1/addons/%1$s/draft", id], model: Stigg::V1::Addon, 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::AddonListResponse>
Retrieves a paginated list of addons in the environment.
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/stigg/resources/v1/addons.rb', line 130 def list(params = {}) parsed, = Stigg::V1::AddonListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/addons", query: query.transform_keys(created_at: "createdAt", product_id: "productId"), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::AddonListResponse, options: ) end |
#publish(id, migration_type:, request_options: {}) ⇒ Stigg::Models::V1::AddonPublishResponse
Publishes a draft addon, making it available for use in subscriptions.
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/stigg/resources/v1/addons.rb', line 196 def publish(id, params) parsed, = Stigg::V1::AddonPublishParams.dump_request(params) @client.request( method: :post, path: ["api/v1/addons/%1$s/publish", id], body: parsed, model: Stigg::Models::V1::AddonPublishResponse, options: ) end |
#remove_draft(id, request_options: {}) ⇒ Stigg::Models::V1::AddonRemoveDraftResponse
Removes a draft version of an addon.
218 219 220 221 222 223 224 225 |
# File 'lib/stigg/resources/v1/addons.rb', line 218 def remove_draft(id, params = {}) @client.request( method: :delete, path: ["api/v1/addons/%1$s/draft", id], model: Stigg::Models::V1::AddonRemoveDraftResponse, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ Stigg::Models::V1::Addon
Retrieves an addon by its unique identifier, including entitlements and pricing details.
61 62 63 64 65 66 67 68 |
# File 'lib/stigg/resources/v1/addons.rb', line 61 def retrieve(id, params = {}) @client.request( method: :get, path: ["api/v1/addons/%1$s", id], model: Stigg::V1::Addon, options: params[:request_options] ) end |
#update(id, billing_id: nil, charges: nil, dependencies: nil, description: nil, display_name: nil, max_quantity: nil, metadata: nil, status: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon
Updates an existing addon’s properties such as display name, description, and metadata.
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/stigg/resources/v1/addons.rb', line 98 def update(id, params = {}) parsed, = Stigg::V1::AddonUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/v1/addons/%1$s", id], body: parsed, model: Stigg::V1::Addon, options: ) end |