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