Class: Pago::V2026_04::Services::CustomerMeters
- Defined in:
- lib/pago/v2026_04/services/customer_meters.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get(id) ⇒ Models::CustomerMeter
Get a customer meter by ID.
-
#list(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, page: 1, limit: 10, sorting: ["-modified_at"]) ⇒ Models::ListResourceCustomerMeter
List customer meters.
-
#list_each(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, limit: 10, sorting: ["-modified_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#get(id) ⇒ Models::CustomerMeter
Get a customer meter by ID.
Scopes: customer_meters:read
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pago/v2026_04/services/customer_meters.rb', line 53 def get(id) data = client.request( http_method: "GET", path: "/v1/customer-meters/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Models::CustomerMeter.from_json(data) end |
#list(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, page: 1, limit: 10, sorting: ["-modified_at"]) ⇒ Models::ListResourceCustomerMeter
List customer meters.
Scopes: customer_meters:read
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pago/v2026_04/services/customer_meters.rb', line 21 def list(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, page: 1, limit: 10, sorting: ["-modified_at"]) data = client.request( http_method: "GET", path: "/v1/customer-meters/", path_params: {}, query: { "organization_id" => organization_id, "customer_id" => customer_id, "external_customer_id" => external_customer_id, "meter_id" => meter_id, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceCustomerMeter.from_json(data) end |
#list_each(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, limit: 10, sorting: ["-modified_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
37 38 39 40 41 42 |
# File 'lib/pago/v2026_04/services/customer_meters.rb', line 37 def list_each(organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, limit: 10, sorting: ["-modified_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(organization_id: organization_id, customer_id: customer_id, external_customer_id: external_customer_id, meter_id: meter_id, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |