Class: Stigg::Resources::V1::Addons

Inherits:
Object
  • Object
show all
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

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.

Parameters:



359
360
361
362
# File 'lib/stigg/resources/v1/addons.rb', line 359

def initialize(client:)
  @client = client
  @entitlements = Stigg::Resources::V1::Addons::Entitlements.new(client: client)
end

Instance Attribute Details

#entitlementsStigg::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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon

Some parameter documentations has been truncated, see Models::V1::AddonArchiveParams for more details.

Archives an addon, preventing it from being used in new subscriptions.

Parameters:

  • id (String)

    The unique identifier of the entity

  • x_account_id (String)

    Account ID — optional when authenticating with a user JWT (Bearer token); falls

  • x_environment_id (String)

    Environment ID — required when authenticating with a user JWT (Bearer token) on

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/stigg/resources/v1/addons.rb', line 203

def archive(id, params = {})
  parsed, options = Stigg::V1::AddonArchiveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v1/addons/%1$s/archive", id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::V1::Addon,
    options: options
  )
end

#create(id:, display_name:, product_id:, billing_id: nil, description: nil, max_quantity: nil, metadata: nil, pricing_type: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon

Some parameter documentations has been truncated, see Models::V1::AddonCreateParams for more details.

Creates a new addon in draft status, associated with a specific product.

Parameters:

  • id (String)

    Body param: The unique identifier for the entity

  • display_name (String)

    Body param: The display name of the package

  • product_id (String)

    Body param: The product id of the package

  • billing_id (String, nil)

    Body param: The unique identifier for the entity in the billing provider

  • description (String, nil)

    Body param: The description of the package

  • max_quantity (Integer, nil)

    Body param: The maximum quantity of this addon that can be added to a subscripti

  • metadata (Hash{Symbol=>String})

    Body param: Metadata associated with the entity

  • pricing_type (Symbol, Stigg::Models::V1::AddonCreateParams::PricingType, nil)

    Body param: The pricing type of the package

  • status (Symbol, Stigg::Models::V1::AddonCreateParams::Status)

    Body param: The status of the package

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/stigg/resources/v1/addons.rb', line 45

def create(params)
  parsed, options = Stigg::V1::AddonCreateParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: "api/v1/addons",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::V1::Addon,
    options: options
  )
end

#create_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon

Some parameter documentations has been truncated, see Models::V1::AddonCreateDraftParams for more details.

Creates a draft version of an existing addon for modification before publishing.

Parameters:

  • id (String)

    The unique identifier of the entity

  • x_account_id (String)

    Account ID — optional when authenticating with a user JWT (Bearer token); falls

  • x_environment_id (String)

    Environment ID — required when authenticating with a user JWT (Bearer token) on

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/stigg/resources/v1/addons.rb', line 235

def create_draft(id, params = {})
  parsed, options = Stigg::V1::AddonCreateDraftParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v1/addons/%1$s/draft", id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::V1::Addon,
    options: 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::AddonListResponse>

Some parameter documentations has been truncated, see Models::V1::AddonListParams for more details.

Retrieves a paginated list of addons in the environment.

Parameters:

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • created_at (Stigg::Models::V1::AddonListParams::CreatedAt)

    Query param: Filter by creation date using range operators: gt, gte, lt, lte

  • limit (Integer)

    Query param: Maximum number of items to return

  • product_id (String)

    Query param: Filter by product ID

  • status (Array<Symbol, Stigg::Models::V1::AddonListParams::Status>)

    Query param: Filter by status. Supports comma-separated values for multiple stat

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/stigg/resources/v1/addons.rb', line 167

def list(params = {})
  query_params = [:after, :before, :created_at, :limit, :product_id, :status]
  parsed, options = Stigg::V1::AddonListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "api/v1/addons",
    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::AddonListResponse,
    options: 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::AddonListChargesResponse>

Some parameter documentations has been truncated, see Models::V1::AddonListChargesParams for more details.

Retrieves the list of charges configured on an addon.

Parameters:

  • id (String)

    Path param: The unique identifier of the entity

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • limit (Integer)

    Query param: Maximum number of items to return

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/stigg/resources/v1/addons.rb', line 273

def list_charges(id, params = {})
  query_params = [:after, :before, :limit]
  parsed, options = Stigg::V1::AddonListChargesParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["api/v1/addons/%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::AddonListChargesResponse,
    options: options
  )
end

#publish(id, migration_type:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::AddonPublishResponse

Some parameter documentations has been truncated, see Models::V1::AddonPublishParams for more details.

Publishes a draft addon, making it available for use in subscriptions.

Parameters:

  • id (String)

    Path param: The unique identifier of the entity

  • migration_type (Symbol, Stigg::Models::V1::AddonPublishParams::MigrationType)

    Body param: The migration type of the package

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/stigg/resources/v1/addons.rb', line 311

def publish(id, params)
  parsed, options = Stigg::V1::AddonPublishParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1/addons/%1$s/publish", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::AddonPublishResponse,
    options: options
  )
end

#remove_draft(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::AddonRemoveDraftResponse

Some parameter documentations has been truncated, see Models::V1::AddonRemoveDraftParams for more details.

Removes a draft version of an addon.

Parameters:

  • id (String)

    The unique identifier of the entity

  • x_account_id (String)

    Account ID — optional when authenticating with a user JWT (Bearer token); falls

  • x_environment_id (String)

    Environment ID — required when authenticating with a user JWT (Bearer token) on

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/stigg/resources/v1/addons.rb', line 342

def remove_draft(id, params = {})
  parsed, options = Stigg::V1::AddonRemoveDraftParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["api/v1/addons/%1$s/draft", id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1::AddonRemoveDraftResponse,
    options: options
  )
end

#retrieve(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon

Some parameter documentations has been truncated, see Models::V1::AddonRetrieveParams for more details.

Retrieves an addon by its unique identifier, including entitlements and pricing details.

Parameters:

  • id (String)

    The unique identifier of the entity

  • x_account_id (String)

    Account ID — optional when authenticating with a user JWT (Bearer token); falls

  • x_environment_id (String)

    Environment ID — required when authenticating with a user JWT (Bearer token) on

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/stigg/resources/v1/addons.rb', line 77

def retrieve(id, params = {})
  parsed, options = Stigg::V1::AddonRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["api/v1/addons/%1$s", id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::V1::Addon,
    options: options
  )
end

#update(id, billing_id: nil, charges: nil, dependencies: nil, description: nil, display_name: nil, max_quantity: nil, metadata: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Addon

Some parameter documentations has been truncated, see Models::V1::AddonUpdateParams for more details.

Updates an existing addon’s properties such as display name, description, and metadata.

Parameters:

  • id (String)

    Path param: The unique identifier of the entity

  • billing_id (String, nil)

    Body param: The unique identifier for the entity in the billing provider

  • charges (Stigg::Models::V1::AddonUpdateParams::Charges)

    Body param: Pricing configuration to set on the addon draft

  • dependencies (Array<String>, nil)

    Body param: List of addons the addon is dependant on

  • description (String, nil)

    Body param: The description of the package

  • display_name (String)

    Body param: The display name of the package

  • max_quantity (Integer, nil)

    Body param: The maximum quantity of this addon that can be added to a subscripti

  • metadata (Hash{Symbol=>String})

    Body param: Metadata associated with the entity

  • status (Symbol, Stigg::Models::V1::AddonUpdateParams::Status)

    Body param: The status of the package

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/stigg/resources/v1/addons.rb', line 126

def update(id, params = {})
  parsed, options = Stigg::V1::AddonUpdateParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :patch,
    path: ["api/v1/addons/%1$s", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::V1::Addon,
    options: options
  )
end