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

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/events.rb,
lib/stigg/resources/v1/events/beta.rb,
lib/stigg/resources/v1/events/data_export.rb,
lib/stigg/resources/v1/events/beta/customers.rb,
lib/stigg/resources/v1/events/beta/entity_types.rb,
lib/stigg/resources/v1/events/beta/customers/entities.rb,
lib/stigg/resources/v1/events/data_export/destinations.rb,
lib/stigg/resources/v1/events/beta/customers/assignments.rb,
lib/stigg/resources/v1/events/beta/customers/entitlements.rb

Overview

Operations related to usage & metering

Defined Under Namespace

Classes: Beta, 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:



49
50
51
52
53
# File 'lib/stigg/resources/v1/events.rb', line 49

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

Instance Attribute Details

#betaStigg::Resources::V1::Events::Beta (readonly)



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

def beta
  @beta
end

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



12
13
14
# File 'lib/stigg/resources/v1/events.rb', line 12

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:



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/stigg/resources/v1/events.rb', line 33

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