Class: Stigg::Resources::V1::Plans::Entitlements
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Plans::Entitlements
- Defined in:
- lib/stigg/resources/v1/plans/entitlements.rb
Instance Method Summary collapse
-
#create(plan_id, entitlements:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementCreateResponse
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementCreateParams for more details.
-
#delete(id, plan_id:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementDeleteParams for more details.
-
#initialize(client:) ⇒ Entitlements
constructor
private
A new instance of Entitlements.
-
#list(plan_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementListResponse
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementListParams for more details.
-
#update(id, plan_id:, body:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Entitlements
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 Entitlements.
155 156 157 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 155 def initialize(client:) @client = client end |
Instance Method Details
#create(plan_id, entitlements:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementCreateResponse
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementCreateParams for more details.
Creates one or more entitlements (feature or credit) on a draft plan.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 28 def create(plan_id, params) parsed, = Stigg::V1::Plans::EntitlementCreateParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: ["api/v1/plans/%1$s/entitlements", plan_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::Plans::EntitlementCreateResponse, options: ) end |
#delete(id, plan_id:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementDeleteParams for more details.
Deletes an entitlement from a draft plan.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 134 def delete(id, params) parsed, = Stigg::V1::Plans::EntitlementDeleteParams.dump_request(params) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/v1/plans/%1$s/entitlements/%2$s", plan_id, id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::Plans::PlanEntitlement, options: ) end |
#list(plan_id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementListResponse
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementListParams for more details.
Retrieves a list of entitlements for a plan.
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 100 def list(plan_id, params = {}) parsed, = Stigg::V1::Plans::EntitlementListParams.dump_request(params) @client.request( method: :get, path: ["api/v1/plans/%1$s/entitlements", plan_id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::Models::V1::Plans::EntitlementListResponse, options: ) end |
#update(id, plan_id:, body:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Some parameter documentations has been truncated, see Models::V1::Plans::EntitlementUpdateParams for more details.
Updates an existing entitlement on a draft plan.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 63 def update(id, params) parsed, = Stigg::V1::Plans::EntitlementUpdateParams.dump_request(params) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["api/v1/plans/%1$s/entitlements/%2$s", plan_id, id], headers: parsed.except(:body).transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), body: parsed[:body], model: Stigg::V1::Plans::PlanEntitlement, options: ) end |