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

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

Overview

Operations related to usage & metering

Defined Under Namespace

Classes: Credits

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:



37
38
39
40
# File 'lib/stigg/resources/v1/events.rb', line 37

def initialize(client:)
  @client = client
  @credits = Stigg::Resources::V1::Events::Credits.new(client: client)
end

Instance Attribute Details

#creditsStigg::Resources::V1::Events::Credits (readonly)



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

def credits
  @credits
end

Instance Method Details

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

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

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/stigg/resources/v1/events.rb', line 23

def report(params)
  parsed, options = Stigg::V1::EventReportParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/v1/events",
    body: parsed,
    model: Stigg::Models::V1::EventReportResponse,
    options: options
  )
end