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:, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementCreateResponse
Creates one or more entitlements (feature or credit) on a draft plan.
-
#delete(id, plan_id:, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Deletes an entitlement from a draft plan.
-
#initialize(client:) ⇒ Entitlements
constructor
private
A new instance of Entitlements.
-
#list(plan_id, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementListResponse
Retrieves a list of entitlements for a plan.
-
#update(id, plan_id:, body:, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Updates an existing entitlement on a draft plan.
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.
112 113 114 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 112 def initialize(client:) @client = client end |
Instance Method Details
#create(plan_id, entitlements:, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementCreateResponse
Creates one or more entitlements (feature or credit) on a draft plan.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 21 def create(plan_id, params) parsed, = Stigg::V1::Plans::EntitlementCreateParams.dump_request(params) @client.request( method: :post, path: ["api/v1/plans/%1$s/entitlements", plan_id], body: parsed, model: Stigg::Models::V1::Plans::EntitlementCreateResponse, options: ) end |
#delete(id, plan_id:, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Deletes an entitlement from a draft plan.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 95 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], model: Stigg::V1::Plans::PlanEntitlement, options: ) end |
#list(plan_id, request_options: {}) ⇒ Stigg::Models::V1::Plans::EntitlementListResponse
Retrieves a list of entitlements for a plan.
73 74 75 76 77 78 79 80 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 73 def list(plan_id, params = {}) @client.request( method: :get, path: ["api/v1/plans/%1$s/entitlements", plan_id], model: Stigg::Models::V1::Plans::EntitlementListResponse, options: params[:request_options] ) end |
#update(id, plan_id:, body:, request_options: {}) ⇒ Stigg::Models::V1::Plans::PlanEntitlement
Updates an existing entitlement on a draft plan.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/stigg/resources/v1/plans/entitlements.rb', line 47 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], body: parsed[:body], model: Stigg::V1::Plans::PlanEntitlement, options: ) end |