Class: Hivehook::Resources::EventService

Inherits:
BaseService show all
Defined in:
lib/hivehook/resources/event_service.rb

Constant Summary collapse

FRAGMENT =
"id sourceId idempotencyKey eventType rawBody status receivedAt"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Hivehook::Resources::BaseService

Instance Method Details

#get(id) ⇒ Object



18
19
20
21
# File 'lib/hivehook/resources/event_service.rb', line 18

def get(id)
  query = "query($id: UUID!) { event(id: $id) { #{FRAGMENT} } }"
  @transport.execute(query, { "id" => id })["event"]
end

#list(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/hivehook/resources/event_service.rb', line 8

def list(options = {})
  query = "query($sourceId: UUID, $eventType: String, $status: EventStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
    events(sourceId: $sourceId, eventType: $eventType, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
      nodes { #{FRAGMENT} }
      pageInfo { total limit offset endCursor hasNextPage }
    }
  }"
  @transport.execute(query, build_variables(options, %w[sourceId eventType status search limit offset after first]))["events"]
end