Class: Stigg::Resources::V1::Credits::CustomCurrencies
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Credits::CustomCurrencies
- Defined in:
- lib/stigg/resources/v1/credits/custom_currencies.rb
Overview
Operations related to custom currencies
Instance Method Summary collapse
-
#archive(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyArchiveParams for more details.
-
#create(id:, display_name:, description: nil, metadata: nil, symbol: nil, units: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyCreateParams for more details.
-
#initialize(client:) ⇒ CustomCurrencies
constructor
private
A new instance of CustomCurrencies.
-
#list(after: nil, before: nil, limit: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Credits::CustomCurrencyListResponse>
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyListParams for more details.
-
#list_associated_entities(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyListAssociatedEntitiesParams for more details.
-
#unarchive(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyUnarchiveParams for more details.
-
#update(currency_id, description: nil, display_name: nil, metadata: nil, symbol: nil, units: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ CustomCurrencies
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 CustomCurrencies.
239 240 241 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 239 def initialize(client:) @client = client end |
Instance Method Details
#archive(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyArchiveParams for more details.
Archives a custom currency. Fails if the currency is still associated with any active plan or addon — use the associated-entities endpoint first to inspect dependencies.
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 155 def archive(currency_id, params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyArchiveParams.dump_request(params) @client.request( method: :post, path: ["api/v1/credits/custom-currencies/%1$s/archive", currency_id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |
#create(id:, display_name:, description: nil, metadata: nil, symbol: nil, units: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyCreateParams for more details.
Creates a new custom currency in the environment.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 37 def create(params) parsed, = Stigg::V1::Credits::CustomCurrencyCreateParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/credits/custom-currencies", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |
#list(after: nil, before: nil, limit: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Credits::CustomCurrencyListResponse>
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyListParams for more details.
Retrieves a paginated list of custom currencies in the environment. Archived currencies are excluded by default; pass ‘status=ARCHIVED` (or `status=ACTIVE,ARCHIVED`) to include them.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 117 def list(params = {}) query_params = [:after, :before, :limit, :status] parsed, = Stigg::V1::Credits::CustomCurrencyListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "api/v1/credits/custom-currencies", 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::Credits::CustomCurrencyListResponse, options: ) end |
#list_associated_entities(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyListAssociatedEntitiesParams for more details.
Lists the active plans and addons that reference a custom currency. Useful before archiving to inspect dependencies.
189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 189 def list_associated_entities(currency_id, params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyListAssociatedEntitiesParams.dump_request(params) @client.request( method: :get, path: ["api/v1/credits/custom-currencies/%1$s/associated-entities", currency_id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse, options: ) end |
#unarchive(currency_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyUnarchiveParams for more details.
Restores a previously archived custom currency. Fails if another active currency with the same ID already exists.
222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 222 def unarchive(currency_id, params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyUnarchiveParams.dump_request(params) @client.request( method: :post, path: ["api/v1/credits/custom-currencies/%1$s/unarchive", currency_id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |
#update(currency_id, description: nil, display_name: nil, metadata: nil, symbol: nil, units: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Some parameter documentations has been truncated, see Models::V1::Credits::CustomCurrencyUpdateParams for more details.
Updates an existing custom currency. Only the supplied fields are modified.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 78 def update(currency_id, params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyUpdateParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :patch, path: ["api/v1/credits/custom-currencies/%1$s", currency_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |