Class: Hook0::Generated::EventTypesApi

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ EventTypesApi

Returns a new instance of EventTypesApi.

Parameters:

  • transport (Object)

    what one request is issued through



288
289
290
# File 'lib/hook0/generated/api.rb', line 288

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(body) ⇒ EventType

Create a new event type

Parameters:

Returns:



296
297
298
299
300
301
302
303
304
305
306
# File 'lib/hook0/generated/api.rb', line 296

def create(body)
  read_answer(
    @transport.request(
      "POST",
      "/api/v1/event_types/",
      [],
      body.to_h
    ),
    EventType.method(:from_json)
  )
end

#delete(event_type_name, application_id) ⇒ void

This method returns an undefined value.

Delete an event type

Parameters:

  • event_type_name (String)

    carries event_type_name.

  • application_id (String)

    carries application_id.



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/hook0/generated/api.rb', line 313

def delete(event_type_name, application_id)
  check_answer(
    @transport.request(
      "DELETE",
      Runtime.path(
        "/api/v1/event_types/{event_type_name}",
        "event_type_name" => event_type_name
      ),
      Runtime.query(
        [
          ["application_id", application_id]
        ],
        []
      ),
      nil
    )
  )
end

#get(event_type_name, application_id) ⇒ EventType

Get an event type by its name

Parameters:

  • event_type_name (String)

    carries event_type_name.

  • application_id (String)

    carries application_id.

Returns:



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/hook0/generated/api.rb', line 337

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

#list(application_id) ⇒ Array<EventType>

List event types

Parameters:

  • application_id (String)

    carries application_id.

Returns:



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/hook0/generated/api.rb', line 361

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