stigg 0.1.0.pre.beta.39 → 0.1.0.pre.beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +1 -1
- data/lib/stigg/models/v1/event_estimate_cost_params.rb +76 -0
- data/lib/stigg/models/v1/event_estimate_cost_response.rb +150 -0
- data/lib/stigg/models/v1/usage_estimate_cost_params.rb +105 -0
- data/lib/stigg/models/v1/usage_estimate_cost_response.rb +150 -0
- data/lib/stigg/resources/v1/customers/events.rb +18 -0
- data/lib/stigg/resources/v1/customers/usage.rb +18 -0
- data/lib/stigg/resources/v1/customers.rb +9 -2
- data/lib/stigg/resources/v1/events/data_export/destinations.rb +3 -1
- data/lib/stigg/resources/v1/events.rb +39 -0
- data/lib/stigg/resources/v1/usage.rb +43 -0
- data/lib/stigg/version.rb +1 -1
- data/lib/stigg.rb +6 -0
- data/rbi/stigg/models/v1/event_estimate_cost_params.rbi +129 -0
- data/rbi/stigg/models/v1/event_estimate_cost_response.rbi +335 -0
- data/rbi/stigg/models/v1/usage_estimate_cost_params.rbi +193 -0
- data/rbi/stigg/models/v1/usage_estimate_cost_response.rbi +335 -0
- data/rbi/stigg/resources/v1/customers/events.rbi +16 -0
- data/rbi/stigg/resources/v1/customers/usage.rbi +16 -0
- data/rbi/stigg/resources/v1/customers.rbi +7 -2
- data/rbi/stigg/resources/v1/events/data_export/destinations.rbi +3 -1
- data/rbi/stigg/resources/v1/events.rbi +38 -0
- data/rbi/stigg/resources/v1/usage.rbi +45 -0
- data/sig/stigg/models/v1/event_estimate_cost_params.rbs +69 -0
- data/sig/stigg/models/v1/event_estimate_cost_response.rbs +136 -0
- data/sig/stigg/models/v1/usage_estimate_cost_params.rbs +94 -0
- data/sig/stigg/models/v1/usage_estimate_cost_response.rbs +136 -0
- data/sig/stigg/resources/v1/customers/events.rbs +11 -0
- data/sig/stigg/resources/v1/customers/usage.rbs +11 -0
- data/sig/stigg/resources/v1/customers.rbs +4 -0
- data/sig/stigg/resources/v1/events.rbs +10 -0
- data/sig/stigg/resources/v1/usage.rbs +12 -0
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ff3e5412440a215842d03161ea3ebd53565493e6d16d45d0910d65cb4813e73
|
|
4
|
+
data.tar.gz: ceddb91f00c85987c709b90b3e4b0fffadadc0810651020f5bccf2962cc5de7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d05a8cb2584b1fb675b4cc0a6950c2948322e6d6782ef62334f1551cbab5bf32f893d35c46769197d8e64a66d2d4a33e1c500a54270e2395d8a3a9ad2a040017
|
|
7
|
+
data.tar.gz: a737412e440d091b7a17876ae773ccf1a6190295291159ba21b9f548fedf727842fdfa640645c172454c68c2d1bf8a570d641efdedebf7eb90dc3ea22bc13df5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.40 (2026-07-14)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-beta.39...v0.1.0-beta.40](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.39...v0.1.0-beta.40)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add estimate endpoints to customers events/usage ([0244f08](https://github.com/stiggio/stigg-ruby/commit/0244f0830e39c3ad7d65433baa8566a1259869af))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* **api:** clarify delete behavior in data_export destinations ([690040d](https://github.com/stiggio/stigg-ruby/commit/690040d89d32b2b09edd8a3da3012c82f7897116))
|
|
15
|
+
* **api:** update customers provision method description ([5c2ef75](https://github.com/stiggio/stigg-ruby/commit/5c2ef756c66511a1a6ee1069ee9c10270303febc))
|
|
16
|
+
|
|
3
17
|
## 0.1.0-beta.39 (2026-07-12)
|
|
4
18
|
|
|
5
19
|
Full Changelog: [v0.1.0-beta.38...v0.1.0-beta.39](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.38...v0.1.0-beta.39)
|
data/README.md
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
module V1
|
|
6
|
+
# @see Stigg::Resources::V1::Events#estimate_cost
|
|
7
|
+
class EventEstimateCostParams < Stigg::Internal::Type::BaseModel
|
|
8
|
+
extend Stigg::Internal::Type::RequestParameters::Converter
|
|
9
|
+
include Stigg::Internal::Type::RequestParameters
|
|
10
|
+
|
|
11
|
+
# @!attribute customer_id
|
|
12
|
+
# Customer id
|
|
13
|
+
#
|
|
14
|
+
# @return [String]
|
|
15
|
+
required :customer_id, String, api_name: :customerId
|
|
16
|
+
|
|
17
|
+
# @!attribute event_name
|
|
18
|
+
# The name of the usage event
|
|
19
|
+
#
|
|
20
|
+
# @return [String]
|
|
21
|
+
required :event_name, String, api_name: :eventName
|
|
22
|
+
|
|
23
|
+
# @!attribute dimensions
|
|
24
|
+
# Dimensions associated with the usage event
|
|
25
|
+
#
|
|
26
|
+
# @return [Hash{Symbol=>String, Float, Boolean}, nil]
|
|
27
|
+
optional :dimensions,
|
|
28
|
+
-> { Stigg::Internal::Type::HashOf[union: Stigg::V1::EventEstimateCostParams::Dimension] }
|
|
29
|
+
|
|
30
|
+
# @!attribute resource_id
|
|
31
|
+
# Resource id
|
|
32
|
+
#
|
|
33
|
+
# @return [String, nil]
|
|
34
|
+
optional :resource_id, String, api_name: :resourceId, nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute x_account_id
|
|
37
|
+
#
|
|
38
|
+
# @return [String, nil]
|
|
39
|
+
optional :x_account_id, String
|
|
40
|
+
|
|
41
|
+
# @!attribute x_environment_id
|
|
42
|
+
#
|
|
43
|
+
# @return [String, nil]
|
|
44
|
+
optional :x_environment_id, String
|
|
45
|
+
|
|
46
|
+
# @!method initialize(customer_id:, event_name:, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
|
|
47
|
+
# @param customer_id [String] Customer id
|
|
48
|
+
#
|
|
49
|
+
# @param event_name [String] The name of the usage event
|
|
50
|
+
#
|
|
51
|
+
# @param dimensions [Hash{Symbol=>String, Float, Boolean}] Dimensions associated with the usage event
|
|
52
|
+
#
|
|
53
|
+
# @param resource_id [String, nil] Resource id
|
|
54
|
+
#
|
|
55
|
+
# @param x_account_id [String]
|
|
56
|
+
#
|
|
57
|
+
# @param x_environment_id [String]
|
|
58
|
+
#
|
|
59
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
|
|
60
|
+
|
|
61
|
+
module Dimension
|
|
62
|
+
extend Stigg::Internal::Type::Union
|
|
63
|
+
|
|
64
|
+
variant String
|
|
65
|
+
|
|
66
|
+
variant Float
|
|
67
|
+
|
|
68
|
+
variant Stigg::Internal::Type::Boolean
|
|
69
|
+
|
|
70
|
+
# @!method self.variants
|
|
71
|
+
# @return [Array(String, Float, Boolean)]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
module V1
|
|
6
|
+
# @see Stigg::Resources::V1::Events#estimate_cost
|
|
7
|
+
class EventEstimateCostResponse < Stigg::Internal::Type::BaseModel
|
|
8
|
+
# @!attribute data
|
|
9
|
+
# Estimated credit cost, current balance and balance after
|
|
10
|
+
#
|
|
11
|
+
# @return [Stigg::Models::V1::EventEstimateCostResponse::Data]
|
|
12
|
+
required :data, -> { Stigg::Models::V1::EventEstimateCostResponse::Data }
|
|
13
|
+
|
|
14
|
+
# @!method initialize(data:)
|
|
15
|
+
# Response object
|
|
16
|
+
#
|
|
17
|
+
# @param data [Stigg::Models::V1::EventEstimateCostResponse::Data] Estimated credit cost, current balance and balance after
|
|
18
|
+
|
|
19
|
+
# @see Stigg::Models::V1::EventEstimateCostResponse#data
|
|
20
|
+
class Data < Stigg::Internal::Type::BaseModel
|
|
21
|
+
# @!attribute estimates
|
|
22
|
+
# Per-currency cost estimates
|
|
23
|
+
#
|
|
24
|
+
# @return [Array<Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate>]
|
|
25
|
+
required :estimates,
|
|
26
|
+
-> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate] }
|
|
27
|
+
|
|
28
|
+
# @!attribute warnings
|
|
29
|
+
# Request-level warnings about the estimation context
|
|
30
|
+
#
|
|
31
|
+
# @return [Array<Symbol, Stigg::Models::V1::EventEstimateCostResponse::Data::Warning>]
|
|
32
|
+
required :warnings,
|
|
33
|
+
-> { Stigg::Internal::Type::ArrayOf[enum: Stigg::Models::V1::EventEstimateCostResponse::Data::Warning] }
|
|
34
|
+
|
|
35
|
+
# @!method initialize(estimates:, warnings:)
|
|
36
|
+
# Estimated credit cost, current balance and balance after
|
|
37
|
+
#
|
|
38
|
+
# @param estimates [Array<Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate>] Per-currency cost estimates
|
|
39
|
+
#
|
|
40
|
+
# @param warnings [Array<Symbol, Stigg::Models::V1::EventEstimateCostResponse::Data::Warning>] Request-level warnings about the estimation context
|
|
41
|
+
|
|
42
|
+
class Estimate < Stigg::Internal::Type::BaseModel
|
|
43
|
+
# @!attribute balance_after_estimate
|
|
44
|
+
# The credit balance after subtracting the estimated cost
|
|
45
|
+
#
|
|
46
|
+
# @return [Float]
|
|
47
|
+
required :balance_after_estimate, Float, api_name: :balanceAfterEstimate
|
|
48
|
+
|
|
49
|
+
# @!attribute breakdown
|
|
50
|
+
# Estimated cost contribution per feature
|
|
51
|
+
#
|
|
52
|
+
# @return [Array<Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown>]
|
|
53
|
+
required :breakdown,
|
|
54
|
+
-> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown] }
|
|
55
|
+
|
|
56
|
+
# @!attribute currency_id
|
|
57
|
+
# The credit currency identifier
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
required :currency_id, String, api_name: :currencyId
|
|
61
|
+
|
|
62
|
+
# @!attribute current_balance
|
|
63
|
+
# The current credit balance, including not-yet-reconciled consumption
|
|
64
|
+
#
|
|
65
|
+
# @return [Float]
|
|
66
|
+
required :current_balance, Float, api_name: :currentBalance
|
|
67
|
+
|
|
68
|
+
# @!attribute estimated_cost
|
|
69
|
+
# The estimated credit cost of the reported event or usage
|
|
70
|
+
#
|
|
71
|
+
# @return [Float]
|
|
72
|
+
required :estimated_cost, Float, api_name: :estimatedCost
|
|
73
|
+
|
|
74
|
+
# @!attribute would_overdraft
|
|
75
|
+
# Whether the estimated consumption would bring the balance below zero
|
|
76
|
+
#
|
|
77
|
+
# @return [Boolean]
|
|
78
|
+
required :would_overdraft, Stigg::Internal::Type::Boolean, api_name: :wouldOverdraft
|
|
79
|
+
|
|
80
|
+
# @!method initialize(balance_after_estimate:, breakdown:, currency_id:, current_balance:, estimated_cost:, would_overdraft:)
|
|
81
|
+
# @param balance_after_estimate [Float] The credit balance after subtracting the estimated cost
|
|
82
|
+
#
|
|
83
|
+
# @param breakdown [Array<Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown>] Estimated cost contribution per feature
|
|
84
|
+
#
|
|
85
|
+
# @param currency_id [String] The credit currency identifier
|
|
86
|
+
#
|
|
87
|
+
# @param current_balance [Float] The current credit balance, including not-yet-reconciled consumption
|
|
88
|
+
#
|
|
89
|
+
# @param estimated_cost [Float] The estimated credit cost of the reported event or usage
|
|
90
|
+
#
|
|
91
|
+
# @param would_overdraft [Boolean] Whether the estimated consumption would bring the balance below zero
|
|
92
|
+
|
|
93
|
+
class Breakdown < Stigg::Internal::Type::BaseModel
|
|
94
|
+
# @!attribute cost
|
|
95
|
+
# The estimated credit cost contributed by this feature
|
|
96
|
+
#
|
|
97
|
+
# @return [Float]
|
|
98
|
+
required :cost, Float
|
|
99
|
+
|
|
100
|
+
# @!attribute feature_id
|
|
101
|
+
# The feature whose meter contributed this cost
|
|
102
|
+
#
|
|
103
|
+
# @return [String]
|
|
104
|
+
required :feature_id, String, api_name: :featureId
|
|
105
|
+
|
|
106
|
+
# @!attribute warning_code
|
|
107
|
+
# Warning explaining why this cost may be inaccurate, if any
|
|
108
|
+
#
|
|
109
|
+
# @return [Symbol, Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown::WarningCode, nil]
|
|
110
|
+
required :warning_code,
|
|
111
|
+
enum: -> { Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown::WarningCode },
|
|
112
|
+
api_name: :warningCode,
|
|
113
|
+
nil?: true
|
|
114
|
+
|
|
115
|
+
# @!method initialize(cost:, feature_id:, warning_code:)
|
|
116
|
+
# @param cost [Float] The estimated credit cost contributed by this feature
|
|
117
|
+
#
|
|
118
|
+
# @param feature_id [String] The feature whose meter contributed this cost
|
|
119
|
+
#
|
|
120
|
+
# @param warning_code [Symbol, Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown::WarningCode, nil] Warning explaining why this cost may be inaccurate, if any
|
|
121
|
+
|
|
122
|
+
# Warning explaining why this cost may be inaccurate, if any
|
|
123
|
+
#
|
|
124
|
+
# @see Stigg::Models::V1::EventEstimateCostResponse::Data::Estimate::Breakdown#warning_code
|
|
125
|
+
module WarningCode
|
|
126
|
+
extend Stigg::Internal::Type::Enum
|
|
127
|
+
|
|
128
|
+
UNSUPPORTED_AGGREGATION = :UNSUPPORTED_AGGREGATION
|
|
129
|
+
|
|
130
|
+
# @!method self.values
|
|
131
|
+
# @return [Array<Symbol>]
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
module Warning
|
|
137
|
+
extend Stigg::Internal::Type::Enum
|
|
138
|
+
|
|
139
|
+
RESOURCE_SCOPED_SUBSCRIPTION_EXISTS = :RESOURCE_SCOPED_SUBSCRIPTION_EXISTS
|
|
140
|
+
FEATURE_NOT_FOUND = :FEATURE_NOT_FOUND
|
|
141
|
+
FEATURE_NOT_CREDIT_BASED = :FEATURE_NOT_CREDIT_BASED
|
|
142
|
+
|
|
143
|
+
# @!method self.values
|
|
144
|
+
# @return [Array<Symbol>]
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
module V1
|
|
6
|
+
# @see Stigg::Resources::V1::Usage#estimate_cost
|
|
7
|
+
class UsageEstimateCostParams < Stigg::Internal::Type::BaseModel
|
|
8
|
+
extend Stigg::Internal::Type::RequestParameters::Converter
|
|
9
|
+
include Stigg::Internal::Type::RequestParameters
|
|
10
|
+
|
|
11
|
+
# @!attribute customer_id
|
|
12
|
+
# Customer id
|
|
13
|
+
#
|
|
14
|
+
# @return [String]
|
|
15
|
+
required :customer_id, String, api_name: :customerId
|
|
16
|
+
|
|
17
|
+
# @!attribute feature_id
|
|
18
|
+
# Feature id
|
|
19
|
+
#
|
|
20
|
+
# @return [String]
|
|
21
|
+
required :feature_id, String, api_name: :featureId
|
|
22
|
+
|
|
23
|
+
# @!attribute value
|
|
24
|
+
# The value to report for usage
|
|
25
|
+
#
|
|
26
|
+
# @return [Integer]
|
|
27
|
+
required :value, Integer
|
|
28
|
+
|
|
29
|
+
# @!attribute dimensions
|
|
30
|
+
# Additional dimensions for the usage report
|
|
31
|
+
#
|
|
32
|
+
# @return [Hash{Symbol=>String, Float, Boolean}, nil]
|
|
33
|
+
optional :dimensions,
|
|
34
|
+
-> { Stigg::Internal::Type::HashOf[union: Stigg::V1::UsageEstimateCostParams::Dimension] }
|
|
35
|
+
|
|
36
|
+
# @!attribute resource_id
|
|
37
|
+
# Resource id
|
|
38
|
+
#
|
|
39
|
+
# @return [String, nil]
|
|
40
|
+
optional :resource_id, String, api_name: :resourceId, nil?: true
|
|
41
|
+
|
|
42
|
+
# @!attribute update_behavior
|
|
43
|
+
# The method by which the usage value should be updated
|
|
44
|
+
#
|
|
45
|
+
# @return [Symbol, Stigg::Models::V1::UsageEstimateCostParams::UpdateBehavior, nil]
|
|
46
|
+
optional :update_behavior,
|
|
47
|
+
enum: -> { Stigg::V1::UsageEstimateCostParams::UpdateBehavior },
|
|
48
|
+
api_name: :updateBehavior
|
|
49
|
+
|
|
50
|
+
# @!attribute x_account_id
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
optional :x_account_id, String
|
|
54
|
+
|
|
55
|
+
# @!attribute x_environment_id
|
|
56
|
+
#
|
|
57
|
+
# @return [String, nil]
|
|
58
|
+
optional :x_environment_id, String
|
|
59
|
+
|
|
60
|
+
# @!method initialize(customer_id:, feature_id:, value:, dimensions: nil, resource_id: nil, update_behavior: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
|
|
61
|
+
# @param customer_id [String] Customer id
|
|
62
|
+
#
|
|
63
|
+
# @param feature_id [String] Feature id
|
|
64
|
+
#
|
|
65
|
+
# @param value [Integer] The value to report for usage
|
|
66
|
+
#
|
|
67
|
+
# @param dimensions [Hash{Symbol=>String, Float, Boolean}] Additional dimensions for the usage report
|
|
68
|
+
#
|
|
69
|
+
# @param resource_id [String, nil] Resource id
|
|
70
|
+
#
|
|
71
|
+
# @param update_behavior [Symbol, Stigg::Models::V1::UsageEstimateCostParams::UpdateBehavior] The method by which the usage value should be updated
|
|
72
|
+
#
|
|
73
|
+
# @param x_account_id [String]
|
|
74
|
+
#
|
|
75
|
+
# @param x_environment_id [String]
|
|
76
|
+
#
|
|
77
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
|
|
78
|
+
|
|
79
|
+
module Dimension
|
|
80
|
+
extend Stigg::Internal::Type::Union
|
|
81
|
+
|
|
82
|
+
variant String
|
|
83
|
+
|
|
84
|
+
variant Float
|
|
85
|
+
|
|
86
|
+
variant Stigg::Internal::Type::Boolean
|
|
87
|
+
|
|
88
|
+
# @!method self.variants
|
|
89
|
+
# @return [Array(String, Float, Boolean)]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# The method by which the usage value should be updated
|
|
93
|
+
module UpdateBehavior
|
|
94
|
+
extend Stigg::Internal::Type::Enum
|
|
95
|
+
|
|
96
|
+
DELTA = :DELTA
|
|
97
|
+
SET = :SET
|
|
98
|
+
|
|
99
|
+
# @!method self.values
|
|
100
|
+
# @return [Array<Symbol>]
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
module V1
|
|
6
|
+
# @see Stigg::Resources::V1::Usage#estimate_cost
|
|
7
|
+
class UsageEstimateCostResponse < Stigg::Internal::Type::BaseModel
|
|
8
|
+
# @!attribute data
|
|
9
|
+
# Estimated credit cost, current balance and balance after
|
|
10
|
+
#
|
|
11
|
+
# @return [Stigg::Models::V1::UsageEstimateCostResponse::Data]
|
|
12
|
+
required :data, -> { Stigg::Models::V1::UsageEstimateCostResponse::Data }
|
|
13
|
+
|
|
14
|
+
# @!method initialize(data:)
|
|
15
|
+
# Response object
|
|
16
|
+
#
|
|
17
|
+
# @param data [Stigg::Models::V1::UsageEstimateCostResponse::Data] Estimated credit cost, current balance and balance after
|
|
18
|
+
|
|
19
|
+
# @see Stigg::Models::V1::UsageEstimateCostResponse#data
|
|
20
|
+
class Data < Stigg::Internal::Type::BaseModel
|
|
21
|
+
# @!attribute estimates
|
|
22
|
+
# Per-currency cost estimates
|
|
23
|
+
#
|
|
24
|
+
# @return [Array<Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate>]
|
|
25
|
+
required :estimates,
|
|
26
|
+
-> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate] }
|
|
27
|
+
|
|
28
|
+
# @!attribute warnings
|
|
29
|
+
# Request-level warnings about the estimation context
|
|
30
|
+
#
|
|
31
|
+
# @return [Array<Symbol, Stigg::Models::V1::UsageEstimateCostResponse::Data::Warning>]
|
|
32
|
+
required :warnings,
|
|
33
|
+
-> { Stigg::Internal::Type::ArrayOf[enum: Stigg::Models::V1::UsageEstimateCostResponse::Data::Warning] }
|
|
34
|
+
|
|
35
|
+
# @!method initialize(estimates:, warnings:)
|
|
36
|
+
# Estimated credit cost, current balance and balance after
|
|
37
|
+
#
|
|
38
|
+
# @param estimates [Array<Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate>] Per-currency cost estimates
|
|
39
|
+
#
|
|
40
|
+
# @param warnings [Array<Symbol, Stigg::Models::V1::UsageEstimateCostResponse::Data::Warning>] Request-level warnings about the estimation context
|
|
41
|
+
|
|
42
|
+
class Estimate < Stigg::Internal::Type::BaseModel
|
|
43
|
+
# @!attribute balance_after_estimate
|
|
44
|
+
# The credit balance after subtracting the estimated cost
|
|
45
|
+
#
|
|
46
|
+
# @return [Float]
|
|
47
|
+
required :balance_after_estimate, Float, api_name: :balanceAfterEstimate
|
|
48
|
+
|
|
49
|
+
# @!attribute breakdown
|
|
50
|
+
# Estimated cost contribution per feature
|
|
51
|
+
#
|
|
52
|
+
# @return [Array<Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown>]
|
|
53
|
+
required :breakdown,
|
|
54
|
+
-> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown] }
|
|
55
|
+
|
|
56
|
+
# @!attribute currency_id
|
|
57
|
+
# The credit currency identifier
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
required :currency_id, String, api_name: :currencyId
|
|
61
|
+
|
|
62
|
+
# @!attribute current_balance
|
|
63
|
+
# The current credit balance, including not-yet-reconciled consumption
|
|
64
|
+
#
|
|
65
|
+
# @return [Float]
|
|
66
|
+
required :current_balance, Float, api_name: :currentBalance
|
|
67
|
+
|
|
68
|
+
# @!attribute estimated_cost
|
|
69
|
+
# The estimated credit cost of the reported event or usage
|
|
70
|
+
#
|
|
71
|
+
# @return [Float]
|
|
72
|
+
required :estimated_cost, Float, api_name: :estimatedCost
|
|
73
|
+
|
|
74
|
+
# @!attribute would_overdraft
|
|
75
|
+
# Whether the estimated consumption would bring the balance below zero
|
|
76
|
+
#
|
|
77
|
+
# @return [Boolean]
|
|
78
|
+
required :would_overdraft, Stigg::Internal::Type::Boolean, api_name: :wouldOverdraft
|
|
79
|
+
|
|
80
|
+
# @!method initialize(balance_after_estimate:, breakdown:, currency_id:, current_balance:, estimated_cost:, would_overdraft:)
|
|
81
|
+
# @param balance_after_estimate [Float] The credit balance after subtracting the estimated cost
|
|
82
|
+
#
|
|
83
|
+
# @param breakdown [Array<Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown>] Estimated cost contribution per feature
|
|
84
|
+
#
|
|
85
|
+
# @param currency_id [String] The credit currency identifier
|
|
86
|
+
#
|
|
87
|
+
# @param current_balance [Float] The current credit balance, including not-yet-reconciled consumption
|
|
88
|
+
#
|
|
89
|
+
# @param estimated_cost [Float] The estimated credit cost of the reported event or usage
|
|
90
|
+
#
|
|
91
|
+
# @param would_overdraft [Boolean] Whether the estimated consumption would bring the balance below zero
|
|
92
|
+
|
|
93
|
+
class Breakdown < Stigg::Internal::Type::BaseModel
|
|
94
|
+
# @!attribute cost
|
|
95
|
+
# The estimated credit cost contributed by this feature
|
|
96
|
+
#
|
|
97
|
+
# @return [Float]
|
|
98
|
+
required :cost, Float
|
|
99
|
+
|
|
100
|
+
# @!attribute feature_id
|
|
101
|
+
# The feature whose meter contributed this cost
|
|
102
|
+
#
|
|
103
|
+
# @return [String]
|
|
104
|
+
required :feature_id, String, api_name: :featureId
|
|
105
|
+
|
|
106
|
+
# @!attribute warning_code
|
|
107
|
+
# Warning explaining why this cost may be inaccurate, if any
|
|
108
|
+
#
|
|
109
|
+
# @return [Symbol, Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown::WarningCode, nil]
|
|
110
|
+
required :warning_code,
|
|
111
|
+
enum: -> { Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown::WarningCode },
|
|
112
|
+
api_name: :warningCode,
|
|
113
|
+
nil?: true
|
|
114
|
+
|
|
115
|
+
# @!method initialize(cost:, feature_id:, warning_code:)
|
|
116
|
+
# @param cost [Float] The estimated credit cost contributed by this feature
|
|
117
|
+
#
|
|
118
|
+
# @param feature_id [String] The feature whose meter contributed this cost
|
|
119
|
+
#
|
|
120
|
+
# @param warning_code [Symbol, Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown::WarningCode, nil] Warning explaining why this cost may be inaccurate, if any
|
|
121
|
+
|
|
122
|
+
# Warning explaining why this cost may be inaccurate, if any
|
|
123
|
+
#
|
|
124
|
+
# @see Stigg::Models::V1::UsageEstimateCostResponse::Data::Estimate::Breakdown#warning_code
|
|
125
|
+
module WarningCode
|
|
126
|
+
extend Stigg::Internal::Type::Enum
|
|
127
|
+
|
|
128
|
+
UNSUPPORTED_AGGREGATION = :UNSUPPORTED_AGGREGATION
|
|
129
|
+
|
|
130
|
+
# @!method self.values
|
|
131
|
+
# @return [Array<Symbol>]
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
module Warning
|
|
137
|
+
extend Stigg::Internal::Type::Enum
|
|
138
|
+
|
|
139
|
+
RESOURCE_SCOPED_SUBSCRIPTION_EXISTS = :RESOURCE_SCOPED_SUBSCRIPTION_EXISTS
|
|
140
|
+
FEATURE_NOT_FOUND = :FEATURE_NOT_FOUND
|
|
141
|
+
FEATURE_NOT_CREDIT_BASED = :FEATURE_NOT_CREDIT_BASED
|
|
142
|
+
|
|
143
|
+
# @!method self.values
|
|
144
|
+
# @return [Array<Symbol>]
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Customers
|
|
7
|
+
class Events
|
|
8
|
+
# @api private
|
|
9
|
+
#
|
|
10
|
+
# @param client [Stigg::Client]
|
|
11
|
+
def initialize(client:)
|
|
12
|
+
@client = client
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Customers
|
|
7
|
+
class Usage
|
|
8
|
+
# @api private
|
|
9
|
+
#
|
|
10
|
+
# @param client [Stigg::Client]
|
|
11
|
+
def initialize(client:)
|
|
12
|
+
@client = client
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -15,6 +15,12 @@ module Stigg
|
|
|
15
15
|
# @return [Stigg::Resources::V1::Customers::Integrations]
|
|
16
16
|
attr_reader :integrations
|
|
17
17
|
|
|
18
|
+
# @return [Stigg::Resources::V1::Customers::Events]
|
|
19
|
+
attr_reader :events
|
|
20
|
+
|
|
21
|
+
# @return [Stigg::Resources::V1::Customers::Usage]
|
|
22
|
+
attr_reader :usage
|
|
23
|
+
|
|
18
24
|
# Some parameter documentations has been truncated, see
|
|
19
25
|
# {Stigg::Models::V1::CustomerRetrieveParams} for more details.
|
|
20
26
|
#
|
|
@@ -316,8 +322,7 @@ module Stigg
|
|
|
316
322
|
# Some parameter documentations has been truncated, see
|
|
317
323
|
# {Stigg::Models::V1::CustomerProvisionParams} for more details.
|
|
318
324
|
#
|
|
319
|
-
# Creates a new customer
|
|
320
|
-
# single operation.
|
|
325
|
+
# Creates a new customer.
|
|
321
326
|
#
|
|
322
327
|
# @overload provision(id:, billing_currency: nil, billing_id: nil, coupon_id: nil, default_payment_method: nil, email: nil, integrations: nil, language: nil, metadata: nil, name: nil, passthrough: nil, timezone: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
|
|
323
328
|
#
|
|
@@ -450,6 +455,8 @@ module Stigg
|
|
|
450
455
|
@payment_method = Stigg::Resources::V1::Customers::PaymentMethod.new(client: client)
|
|
451
456
|
@promotional_entitlements = Stigg::Resources::V1::Customers::PromotionalEntitlements.new(client: client)
|
|
452
457
|
@integrations = Stigg::Resources::V1::Customers::Integrations.new(client: client)
|
|
458
|
+
@events = Stigg::Resources::V1::Customers::Events.new(client: client)
|
|
459
|
+
@usage = Stigg::Resources::V1::Customers::Usage.new(client: client)
|
|
453
460
|
end
|
|
454
461
|
end
|
|
455
462
|
end
|
|
@@ -86,7 +86,9 @@ module Stigg
|
|
|
86
86
|
# {Stigg::Models::V1::Events::DataExport::DestinationDeleteParams} for more
|
|
87
87
|
# details.
|
|
88
88
|
#
|
|
89
|
-
#
|
|
89
|
+
# Disconnect a destination: stops the provider sync (deletes the provider
|
|
90
|
+
# destination) and removes it from the DATA_EXPORT integration. Non-destructive —
|
|
91
|
+
# the warehouse table is left intact. Idempotent.
|
|
90
92
|
#
|
|
91
93
|
# @overload delete(destination_id, x_account_id: nil, x_environment_id: nil, request_options: {})
|
|
92
94
|
#
|
|
@@ -11,6 +11,45 @@ module Stigg
|
|
|
11
11
|
# @return [Stigg::Resources::V1::Events::Beta]
|
|
12
12
|
attr_reader :beta
|
|
13
13
|
|
|
14
|
+
# Some parameter documentations has been truncated, see
|
|
15
|
+
# {Stigg::Models::V1::EventEstimateCostParams} for more details.
|
|
16
|
+
#
|
|
17
|
+
# Estimates the credit cost of a usage event without ingesting it. Returns the
|
|
18
|
+
# estimated cost per credit currency, the current balance, and the balance after
|
|
19
|
+
# the estimated consumption.
|
|
20
|
+
#
|
|
21
|
+
# @overload estimate_cost(customer_id:, event_name:, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
|
|
22
|
+
#
|
|
23
|
+
# @param customer_id [String] Body param: Customer id
|
|
24
|
+
#
|
|
25
|
+
# @param event_name [String] Body param: The name of the usage event
|
|
26
|
+
#
|
|
27
|
+
# @param dimensions [Hash{Symbol=>String, Float, Boolean}] Body param: Dimensions associated with the usage event
|
|
28
|
+
#
|
|
29
|
+
# @param resource_id [String, nil] Body param: Resource id
|
|
30
|
+
#
|
|
31
|
+
# @param x_account_id [String] Header param: Account ID — optional when authenticating with a user JWT (Bearer
|
|
32
|
+
#
|
|
33
|
+
# @param x_environment_id [String] Header param: Environment ID — required when authenticating with a user JWT (Bea
|
|
34
|
+
#
|
|
35
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
36
|
+
#
|
|
37
|
+
# @return [Stigg::Models::V1::EventEstimateCostResponse]
|
|
38
|
+
#
|
|
39
|
+
# @see Stigg::Models::V1::EventEstimateCostParams
|
|
40
|
+
def estimate_cost(params)
|
|
41
|
+
parsed, options = Stigg::V1::EventEstimateCostParams.dump_request(params)
|
|
42
|
+
header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
|
|
43
|
+
@client.request(
|
|
44
|
+
method: :post,
|
|
45
|
+
path: "api/v1/events/estimate",
|
|
46
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
47
|
+
body: parsed.except(*header_params.keys),
|
|
48
|
+
model: Stigg::Models::V1::EventEstimateCostResponse,
|
|
49
|
+
options: options
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
14
53
|
# Some parameter documentations has been truncated, see
|
|
15
54
|
# {Stigg::Models::V1::EventReportParams} for more details.
|
|
16
55
|
#
|