Class: Pago::V2026_04::Services::CustomerPortal::LicenseKeys
- Defined in:
- lib/pago/v2026_04/services/customer_portal.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.
-
#list(benefit_id: nil, page: 1, limit: 10) ⇒ Models::ListResourceLicenseKeyRead
Scopes:
customer_portal:readcustomer_portal:write. -
#list_each(benefit_id: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand. -
#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.
This endpoint doesn't require authentication and can be safely used on a public client, like a desktop application or a mobile app. If you plan to validate a license key on a server, use the
/v1/license-keys/activateendpoint instead.
660 661 662 663 664 665 666 667 668 669 670 671 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 660 def activate(body: {}) data = client.request( http_method: "POST", path: "/v1/customer-portal/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.
This endpoint doesn't require authentication and can be safely used on a public client, like a desktop application or a mobile app. If you plan to validate a license key on a server, use the
/v1/license-keys/deactivateendpoint instead.
685 686 687 688 689 690 691 692 693 694 695 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 685 def deactivate(body: {}) client.request( http_method: "POST", path: "/v1/customer-portal/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: customer_portal:read customer_portal:write
610 611 612 613 614 615 616 617 618 619 620 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 610 def get(id) data = client.request( http_method: "GET", path: "/v1/customer-portal/license-keys/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::LicenseKeyWithActivations.from_json(data) end |
#list(benefit_id: nil, page: 1, limit: 10) ⇒ Models::ListResourceLicenseKeyRead
Scopes: customer_portal:read customer_portal:write
578 579 580 581 582 583 584 585 586 587 588 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 578 def list(benefit_id: nil, page: 1, limit: 10) data = client.request( http_method: "GET", path: "/v1/customer-portal/license-keys/", path_params: {}, query: { "benefit_id" => benefit_id, "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(benefit_id: nil, limit: 10) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
594 595 596 597 598 599 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 594 def list_each(benefit_id: nil, limit: 10, &block) paginator = ::Pago::Paginator.new do |page_number| list(benefit_id: benefit_id, page: page_number, limit: limit) end block ? paginator.each(&block) : paginator end |
#validate(body: {}) ⇒ Models::ValidatedLicenseKey
Validate a license key.
This endpoint doesn't require authentication and can be safely used on a public client, like a desktop application or a mobile app. If you plan to validate a license key on a server, use the
/v1/license-keys/validateendpoint instead.
634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 634 def validate(body: {}) data = client.request( http_method: "POST", path: "/v1/customer-portal/license-keys/validate", path_params: {}, query: {}, body: body, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::ValidatedLicenseKey.from_json(data) end |