Class: Hook0::Generated::EventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/api.rb

Overview

What the API declares under events, issued through the transport it is handed.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ EventsApi

Returns a new instance of EventsApi.

Parameters:

  • transport (Object)

    what one request is issued through



405
406
407
# File 'lib/hook0/generated/api.rb', line 405

def initialize(transport)
  @transport = transport
end

Instance Method Details

#get(event_id, application_id) ⇒ EventWithPayload

Get an event by its ID

Parameters:

  • event_id (String)

    carries event_id.

  • application_id (String)

    carries application_id.

Returns:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/hook0/generated/api.rb', line 414

def get(event_id, application_id)
  read_answer(
    @transport.request(
      "GET",
      Runtime.path(
        "/api/v1/events/{event_id}",
        "event_id" => event_id
      ),
      Runtime.query(
        [
          ["application_id", application_id]
        ],
        []
      ),
      nil
    ),
    EventWithPayload.method(:from_json)
  )
end

#ingest(body) ⇒ IngestedEvent

Ingest an event

Parameters:

  • body (EventPost)

    what the operation reads

Returns:



438
439
440
441
442
443
444
445
446
447
448
# File 'lib/hook0/generated/api.rb', line 438

def ingest(body)
  read_answer(
    @transport.request(
      "POST",
      "/api/v1/event/",
      [],
      body.to_h
    ),
    IngestedEvent.method(:from_json)
  )
end

#list(application_id) ⇒ Array<Event>

List latest events

Parameters:

  • application_id (String)

    carries application_id.

Returns:



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/hook0/generated/api.rb', line 454

def list(application_id)
  read_answer(
    @transport.request(
      "GET",
      "/api/v1/events/",
      Runtime.query(
        [
          ["application_id", application_id]
        ],
        []
      ),
      nil
    ),
    Runtime.list(Event.method(:from_json))
  )
end

#replay(event_id, body) ⇒ void

This method returns an undefined value.

Replay an event

Parameters:

  • event_id (String)

    carries event_id.

  • body (ReplayEvent)

    what the operation reads



476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/hook0/generated/api.rb', line 476

def replay(event_id, body)
  check_answer(
    @transport.request(
      "POST",
      Runtime.path(
        "/api/v1/events/{event_id}/replay",
        "event_id" => event_id
      ),
      [],
      body.to_h
    )
  )
end