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, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Archives a custom currency.
-
#create(id:, display_name:, description: nil, metadata: nil, symbol: nil, units: 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, 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, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse
Lists the active plans and addons that reference a custom currency.
-
#unarchive(currency_id, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Restores a previously archived custom currency.
-
#update(currency_id, description: nil, display_name: nil, metadata: nil, symbol: nil, units: 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.
181 182 183 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 181 def initialize(client:) @client = client end |
Instance Method Details
#archive(currency_id, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
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.
127 128 129 130 131 132 133 134 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 127 def archive(currency_id, params = {}) @client.request( method: :post, path: ["api/v1/credits/custom-currencies/%1$s/archive", currency_id], model: Stigg::V1::Credits::CustomCurrencyResponse, options: params[:request_options] ) end |
#create(id:, display_name:, description: nil, metadata: nil, symbol: nil, units: 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.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 33 def create(params) parsed, = Stigg::V1::Credits::CustomCurrencyCreateParams.dump_request(params) @client.request( method: :post, path: "api/v1/credits/custom-currencies", body: parsed, model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |
#list(after: nil, before: nil, limit: nil, status: 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.
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 101 def list(params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/credits/custom-currencies", query: query, page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::Credits::CustomCurrencyListResponse, options: ) end |
#list_associated_entities(currency_id, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse
Lists the active plans and addons that reference a custom currency. Useful before archiving to inspect dependencies.
148 149 150 151 152 153 154 155 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 148 def list_associated_entities(currency_id, params = {}) @client.request( method: :get, path: ["api/v1/credits/custom-currencies/%1$s/associated-entities", currency_id], model: Stigg::Models::V1::Credits::CustomCurrencyListAssociatedEntitiesResponse, options: params[:request_options] ) end |
#unarchive(currency_id, request_options: {}) ⇒ Stigg::Models::V1::Credits::CustomCurrencyResponse
Restores a previously archived custom currency. Fails if another active currency with the same ID already exists.
169 170 171 172 173 174 175 176 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 169 def unarchive(currency_id, params = {}) @client.request( method: :post, path: ["api/v1/credits/custom-currencies/%1$s/unarchive", currency_id], model: Stigg::V1::Credits::CustomCurrencyResponse, options: params[:request_options] ) end |
#update(currency_id, description: nil, display_name: nil, metadata: nil, symbol: nil, units: 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.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/stigg/resources/v1/credits/custom_currencies.rb', line 68 def update(currency_id, params = {}) parsed, = Stigg::V1::Credits::CustomCurrencyUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/v1/credits/custom-currencies/%1$s", currency_id], body: parsed, model: Stigg::V1::Credits::CustomCurrencyResponse, options: ) end |