Class: Stigg::Resources::V1::Features

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/features.rb

Overview

Operations related to features

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Features

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 Features.

Parameters:



260
261
262
# File 'lib/stigg/resources/v1/features.rb', line 260

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Archives a feature, preventing it from being used in new entitlements.

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:



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/stigg/resources/v1/features.rb', line 26

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

#create_feature(id:, display_name:, feature_type:, description: nil, enum_configuration: nil, feature_status: nil, feature_units: nil, feature_units_plural: nil, metadata: nil, meter_type: nil, unit_transformation: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Feature

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

Creates a new feature with the specified type, metering, and configuration.

Parameters:

Returns:

See Also:



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

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

#list_features(id: nil, after: nil, before: nil, created_at: nil, feature_type: nil, limit: nil, meter_type: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::FeatureListFeaturesResponse>

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

Retrieves a paginated list of features in the environment.

Parameters:

  • id (String)

    Query param: Filter by entity ID

  • 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::FeatureListFeaturesParams::CreatedAt)

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

  • feature_type (Array<Symbol, Stigg::Models::V1::FeatureListFeaturesParams::FeatureType>)

    Query param: Filter by feature type. Supports comma-separated values for multipl

  • limit (Integer)

    Query param: Maximum number of items to return

  • meter_type (Array<Symbol, Stigg::Models::V1::FeatureListFeaturesParams::MeterType>)

    Query param: Filter by meter type. Supports comma-separated values for multiple

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

    Query param: Filter by feature status. Supports comma-separated values for multi

  • 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:



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/stigg/resources/v1/features.rb', line 123

def list_features(params = {})
  query_params = [:id, :after, :before, :created_at, :feature_type, :limit, :meter_type, :status]
  parsed, options = Stigg::V1::FeatureListFeaturesParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "api/v1/features",
    query: query.transform_keys(
      created_at: "createdAt",
      feature_type: "featureType",
      meter_type: "meterType"
    ),
    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::FeatureListFeaturesResponse,
    options: options
  )
end

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

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

Retrieves a feature by its unique identifier.

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:



163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/stigg/resources/v1/features.rb', line 163

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

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

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

Restores an archived feature, allowing it to be used in entitlements again.

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:



195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/stigg/resources/v1/features.rb', line 195

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

#update_feature(id, description: nil, display_name: nil, enum_configuration: nil, feature_units: nil, feature_units_plural: nil, metadata: nil, meter: nil, unit_transformation: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Feature

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

Updates an existing feature’s properties such as display name, description, and configuration.

Parameters:

  • id (String)

    Path param: The unique identifier of the entity

  • description (String)

    Body param: The description for the feature

  • display_name (String)

    Body param: The display name for the feature

  • enum_configuration (Array<Stigg::Models::V1::FeatureUpdateFeatureParams::EnumConfiguration>)

    Body param: The configuration data for the feature

  • feature_units (String)

    Body param: The units for the feature

  • feature_units_plural (String)

    Body param: The plural units for the feature

  • metadata (Hash{Symbol=>String})

    Body param: The additional metadata for the feature

  • meter (Stigg::Models::V1::FeatureUpdateFeatureParams::Meter)

    Body param

  • unit_transformation (Stigg::Models::V1::FeatureUpdateFeatureParams::UnitTransformation, nil)

    Body param: Unit transformation to be applied to the reported usage

  • 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:



244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/stigg/resources/v1/features.rb', line 244

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