Class: Pago::V2026_04::Services::CustomerPortal::LicenseKeys

Inherits:
Service
  • Object
show all
Defined in:
lib/pago/v2026_04/services/customer_portal.rb,
sig/pago/v2026_04/generated.rbs

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

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/activate endpoint instead.

Parameters:

Returns:

Raises:



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/deactivate endpoint instead.

Parameters:

Returns:

  • (nil)

Raises:



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

Parameters:

  • id (String)

Returns:

Raises:



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

Parameters:

  • benefit_id (String, nil) (defaults to: nil)

    Filter by a specific benefit

  • page (Integer) (defaults to: 1)

    Page number, defaults to 1.

  • limit (Integer) (defaults to: 10)

    Size of a page, defaults to 10. Maximum is 100.

  • benefit_id: (String, nil) (defaults to: nil)
  • page: (Integer, nil) (defaults to: 1)
  • limit: (Integer, nil) (defaults to: 10)

Returns:

Raises:



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.

Parameters:

  • benefit_id: (String, nil) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: 10)

Yield Parameters:

Returns:



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/validate endpoint instead.

Parameters:

Returns:

Raises:



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