Class: Stigg::Resources::V1::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/events.rb,
lib/stigg/resources/v1/events/data_export.rb,
lib/stigg/resources/v1/events/data_export/destinations.rb

Overview

Operations related to usage & metering

Defined Under Namespace

Classes: DataExport

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Events

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Events.

Parameters:



46
47
48
49
# File 'lib/stigg/resources/v1/events.rb', line 46

def initialize(client:)
  @client = client
  @data_export = Stigg::Resources::V1::Events::DataExport.new(client: client)
end

Instance Attribute Details

#data_exportStigg::Resources::V1::Events::DataExport (readonly)



9
10
11
# File 'lib/stigg/resources/v1/events.rb', line 9

def data_export
  @data_export
end

Instance Method Details

#report(events:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::EventReportResponse

Some parameter documentations has been truncated, see Models::V1::EventReportParams for more details.

Reports raw usage events for event-based metering. Events are ingested asynchronously and aggregated into usage totals.

Parameters:

  • events (Array<Stigg::Models::V1::EventReportParams::Event>)

    Body param: A list of usage events to report

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/stigg/resources/v1/events.rb', line 30

def report(params)
  parsed, options = Stigg::V1::EventReportParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: "api/v1/events",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::EventReportResponse,
    options: options
  )
end