Class: Pago::V2026_04::Services::LicenseKeys
- Defined in:
- lib/pago/v2026_04/services/license_keys.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#activate(body: {}) ⇒ Models::LicenseKeyActivationRead
Activate a license key instance.
-
#deactivate(body: {}) ⇒ nil
Deactivate a license key instance.
-
#get(id) ⇒ Models::LicenseKeyWithActivations
Get a license key.
-
#get_activation(id, activation_id) ⇒ Models::LicenseKeyActivationRead
Get a license key activation.
-
#list(organization_id: nil, benefit_id: nil, status: nil, page: 1, limit: 10) ⇒ Models::ListResourceLicenseKeyRead
Get license keys connected to the given organization & filters.
-
#list_each(organization_id: nil, benefit_id: nil, status: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand. -
#update(id, body: {}) ⇒ Models::LicenseKeyRead
Update a license key.
-
#validate(body: {}) ⇒ Models::ValidatedLicenseKey
Validate a license key.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#activate(body: {}) ⇒ Models::LicenseKeyActivationRead
Activate a license key instance.
Scopes: license_keys:write
145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 145 def activate(body: {}) data = client.request( http_method: "POST", path: "/v1/license-keys/activate", path_params: {}, query: {}, body: body, response_type: :json, errors: { 403 => Errors::NotPermitted, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::LicenseKeyActivationRead.from_json(data) end |
#deactivate(body: {}) ⇒ nil
Deactivate a license key instance.
Scopes: license_keys:write
167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 167 def deactivate(body: {}) client.request( http_method: "POST", path: "/v1/license-keys/deactivate", path_params: {}, query: {}, body: body, response_type: :none, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) end |
#get(id) ⇒ Models::LicenseKeyWithActivations
Get a license key.
Scopes: license_keys:read license_keys:write
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 54 def get(id) data = client.request( http_method: "GET", path: "/v1/license-keys/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 401 => Errors::Unauthorized, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::LicenseKeyWithActivations.from_json(data) end |
#get_activation(id, activation_id) ⇒ Models::LicenseKeyActivationRead
Get a license key activation.
Scopes: license_keys:read license_keys:write
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 101 def get_activation(id, activation_id) data = client.request( http_method: "GET", path: "/v1/license-keys/{id}/activations/{activation_id}", path_params: { "id" => id, "activation_id" => activation_id }, query: {}, response_type: :json, errors: { 401 => Errors::Unauthorized, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::LicenseKeyActivationRead.from_json(data) end |
#list(organization_id: nil, benefit_id: nil, status: nil, page: 1, limit: 10) ⇒ Models::ListResourceLicenseKeyRead
Get license keys connected to the given organization & filters.
Scopes: license_keys:read license_keys:write
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 21 def list(organization_id: nil, benefit_id: nil, status: nil, page: 1, limit: 10) data = client.request( http_method: "GET", path: "/v1/license-keys/", path_params: {}, query: { "organization_id" => organization_id, "benefit_id" => benefit_id, "status" => status, "page" => page, "limit" => limit }, response_type: :json, errors: { 401 => Errors::Unauthorized, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::ListResourceLicenseKeyRead.from_json(data) end |
#list_each(organization_id: nil, benefit_id: nil, status: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
37 38 39 40 41 42 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 37 def list_each(organization_id: nil, benefit_id: nil, status: nil, limit: 10, &block) paginator = ::Pago::Paginator.new do |page_number| list(organization_id: organization_id, benefit_id: benefit_id, status: status, page: page_number, limit: limit) end block ? paginator.each(&block) : paginator end |
#update(id, body: {}) ⇒ Models::LicenseKeyRead
Update a license key.
Scopes: license_keys:write
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 77 def update(id, body: {}) data = client.request( http_method: "PATCH", path: "/v1/license-keys/{id}", path_params: { "id" => id }, query: {}, body: body, response_type: :json, errors: { 401 => Errors::Unauthorized, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::LicenseKeyRead.from_json(data) end |
#validate(body: {}) ⇒ Models::ValidatedLicenseKey
Validate a license key.
Scopes: license_keys:write
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/pago/v2026_04/services/license_keys.rb', line 122 def validate(body: {}) data = client.request( http_method: "POST", path: "/v1/license-keys/validate", path_params: {}, query: {}, body: body, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::ValidatedLicenseKey.from_json(data) end |