Class: Pago::V2026_04::Services::Events
- Defined in:
- lib/pago/v2026_04/services/events.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get(id) ⇒ Object
Get an event by ID.
-
#ingest(body: {}) ⇒ Models::EventsIngestResponse
Ingest batch of events.
-
#list(filter: nil, start_timestamp: nil, end_timestamp: nil, organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, name: nil, source: nil, query: nil, parent_id: nil, depth: nil, page: 1, limit: 10, sorting: ["-timestamp"], metadata: nil) ⇒ Models::ListResourceEvent, Models::ListResourceWithCursorPaginationEvent
List events.
-
#list_names(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, page: 1, limit: 10, sorting: ["-last_seen"]) ⇒ Models::ListResourceEventName
List event names.
-
#list_names_each(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, limit: 10, sorting: ["-last_seen"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list_names, fetching pages on demand.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#get(id) ⇒ Object
Get an event by ID.
Scopes: events:read events:write
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/pago/v2026_04/services/events.rb', line 89 def get(id) data = client.request( http_method: "GET", path: "/v1/events/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Unions::Event.from_json(data) end |
#ingest(body: {}) ⇒ Models::EventsIngestResponse
Ingest batch of events.
Scopes: events:write
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/pago/v2026_04/services/events.rb', line 109 def ingest(body: {}) data = client.request( http_method: "POST", path: "/v1/events/ingest", path_params: {}, query: {}, body: body, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::EventsIngestResponse.from_json(data) end |
#list(filter: nil, start_timestamp: nil, end_timestamp: nil, organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, name: nil, source: nil, query: nil, parent_id: nil, depth: nil, page: 1, limit: 10, sorting: ["-timestamp"], metadata: nil) ⇒ Models::ListResourceEvent, Models::ListResourceWithCursorPaginationEvent
List events.
Scopes: events:read events:write
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pago/v2026_04/services/events.rb', line 30 def list(filter: nil, start_timestamp: nil, end_timestamp: nil, organization_id: nil, customer_id: nil, external_customer_id: nil, meter_id: nil, name: nil, source: nil, query: nil, parent_id: nil, depth: nil, page: 1, limit: 10, sorting: ["-timestamp"], metadata: nil) data = client.request( http_method: "GET", path: "/v1/events/", path_params: {}, query: { "filter" => filter, "start_timestamp" => , "end_timestamp" => , "organization_id" => organization_id, "customer_id" => customer_id, "external_customer_id" => external_customer_id, "meter_id" => meter_id, "name" => name, "source" => source, "query" => query, "parent_id" => parent_id, "depth" => depth, "page" => page, "limit" => limit, "sorting" => sorting, "metadata" => }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) ::Pago::Serde.union(data, variants: [Models::ListResourceEvent, Models::ListResourceWithCursorPaginationEvent]) end |
#list_names(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, page: 1, limit: 10, sorting: ["-last_seen"]) ⇒ Models::ListResourceEventName
List event names.
Scopes: events:read events:write
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/pago/v2026_04/services/events.rb', line 57 def list_names(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, page: 1, limit: 10, sorting: ["-last_seen"]) data = client.request( http_method: "GET", path: "/v1/events/names", path_params: {}, query: { "organization_id" => organization_id, "customer_id" => customer_id, "external_customer_id" => external_customer_id, "source" => source, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceEventName.from_json(data) end |
#list_names_each(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, limit: 10, sorting: ["-last_seen"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list_names, fetching pages on demand.
73 74 75 76 77 78 |
# File 'lib/pago/v2026_04/services/events.rb', line 73 def list_names_each(organization_id: nil, customer_id: nil, external_customer_id: nil, source: nil, query: nil, limit: 10, sorting: ["-last_seen"], &block) paginator = ::Pago::Paginator.new do |page_number| list_names(organization_id: organization_id, customer_id: customer_id, external_customer_id: external_customer_id, source: source, query: query, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |