Class: Hook0::Generated::EventsPerDayApi

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ EventsPerDayApi

Returns a new instance of EventsPerDayApi.

Parameters:

  • transport (Object)

    what one request is issued through



517
518
519
# File 'lib/hook0/generated/api.rb', line 517

def initialize(transport)
  @transport = transport
end

Instance Method Details

#list_for_application(application_id, from: nil, to: nil) ⇒ Array<EventsPerDayEntry>

List events per day for an application

Parameters:

  • application_id (String)

    carries application_id.

  • from (String, nil) (defaults to: nil)

    carries from: Start of date range (inclusive). Defaults to 30 days before to.

  • to (String, nil) (defaults to: nil)

    carries to: End of date range (inclusive). Defaults to today.

Returns:



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/hook0/generated/api.rb', line 527

def list_for_application(application_id, from: nil, to: nil)
  read_answer(
    @transport.request(
      "GET",
      "/api/v1/events_per_day/application",
      Runtime.query(
        [
          ["application_id", application_id]
        ],
        [
          ["from", from],
          ["to", to]
        ]
      ),
      nil
    ),
    Runtime.list(EventsPerDayEntry.method(:from_json))
  )
end

#list_for_organization(organization_id, from: nil, to: nil) ⇒ Array<EventsPerDayEntry>

List events per day for an organization

Parameters:

  • organization_id (String)

    carries organization_id.

  • from (String, nil) (defaults to: nil)

    carries from: Start of date range (inclusive). Defaults to 30 days before to.

  • to (String, nil) (defaults to: nil)

    carries to: End of date range (inclusive). Defaults to today.

Returns:



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/hook0/generated/api.rb', line 553

def list_for_organization(organization_id, from: nil, to: nil)
  read_answer(
    @transport.request(
      "GET",
      "/api/v1/events_per_day/organization",
      Runtime.query(
        [
          ["organization_id", organization_id]
        ],
        [
          ["from", from],
          ["to", to]
        ]
      ),
      nil
    ),
    Runtime.list(EventsPerDayEntry.method(:from_json))
  )
end