Class: Hook0::Generated::EventsApi
- Inherits:
-
Object
- Object
- Hook0::Generated::EventsApi
- 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
-
#get(event_id, application_id) ⇒ EventWithPayload
Get an event by its ID.
-
#ingest(body) ⇒ IngestedEvent
Ingest an event.
-
#initialize(transport) ⇒ EventsApi
constructor
A new instance of EventsApi.
-
#list(application_id) ⇒ Array<Event>
List latest events.
-
#replay(event_id, body) ⇒ void
Replay an event.
Constructor Details
#initialize(transport) ⇒ EventsApi
Returns a new instance of EventsApi.
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
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
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
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
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 |