Class: Pago::V2026_04::Services::CustomerPortal::Wallets

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

#get(id) ⇒ Models::CustomerWallet

Get a wallet by ID for the authenticated customer.

Parameters:

  • id (String)

    The wallet ID.

Returns:

Raises:



1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 1163

def get(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/wallets/{id}",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerWallet.from_json(data)
end

#list(page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceCustomerWallet

List wallets of the authenticated customer.

Parameters:

  • 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.

  • sorting (Array<String>, nil) (defaults to: ["-created_at"])

    Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

  • page: (Integer, nil) (defaults to: 1)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Returns:

Raises:



1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 1133

def list(page: 1, limit: 10, sorting: ["-created_at"])
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/wallets/",
    path_params: {},
    query: { "page" => page, "limit" => limit, "sorting" => sorting },
    response_type: :json,
    errors: { 422 => Errors::HTTPValidationError }
  )
  Models::ListResourceCustomerWallet.from_json(data)
end

#list_each(limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator

Enumerate every item of list, fetching pages on demand.

Parameters:

  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Yield Parameters:

Returns:



1149
1150
1151
1152
1153
1154
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 1149

def list_each(limit: 10, sorting: ["-created_at"], &block)
  paginator = ::Pago::Paginator.new do |page_number|
    list(page: page_number, limit: limit, sorting: sorting)
  end
  block ? paginator.each(&block) : paginator
end