stigg 0.1.0.pre.beta.54 → 0.1.0.pre.beta.55

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/lib/stigg/client.rb +4 -0
  5. data/lib/stigg/models/v1/credits/consumption_consume_response.rb +96 -1
  6. data/lib/stigg/models/v1/customer_list_response.rb +23 -1
  7. data/lib/stigg/models/v1/customer_response.rb +23 -1
  8. data/lib/stigg/models/v2/usage_report_params.rb +150 -0
  9. data/lib/stigg/models/v2/usage_report_response.rb +357 -0
  10. data/lib/stigg/models.rb +2 -0
  11. data/lib/stigg/resources/v1/usage.rb +4 -1
  12. data/lib/stigg/resources/v2/usage.rb +50 -0
  13. data/lib/stigg/resources/v2.rb +19 -0
  14. data/lib/stigg/version.rb +1 -1
  15. data/lib/stigg.rb +4 -0
  16. data/rbi/stigg/client.rbi +3 -0
  17. data/rbi/stigg/models/v1/credits/consumption_consume_response.rbi +148 -0
  18. data/rbi/stigg/models/v1/customer_list_response.rbi +23 -3
  19. data/rbi/stigg/models/v1/customer_response.rbi +23 -3
  20. data/rbi/stigg/models/v2/usage_report_params.rbi +276 -0
  21. data/rbi/stigg/models/v2/usage_report_response.rbi +571 -0
  22. data/rbi/stigg/models.rbi +2 -0
  23. data/rbi/stigg/resources/v1/usage.rbi +2 -1
  24. data/rbi/stigg/resources/v2/usage.rbi +40 -0
  25. data/rbi/stigg/resources/v2.rbi +16 -0
  26. data/sig/stigg/client.rbs +2 -0
  27. data/sig/stigg/models/v1/credits/consumption_consume_response.rbs +70 -0
  28. data/sig/stigg/models/v1/customer_list_response.rbs +13 -3
  29. data/sig/stigg/models/v1/customer_response.rbs +13 -3
  30. data/sig/stigg/models/v2/usage_report_params.rbs +125 -0
  31. data/sig/stigg/models/v2/usage_report_response.rbs +245 -0
  32. data/sig/stigg/models.rbs +2 -0
  33. data/sig/stigg/resources/v2/usage.rbs +16 -0
  34. data/sig/stigg/resources/v2.rbs +9 -0
  35. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b656b4ba3fc90ca4486804b4c37637e9468716350c477bc6f5316c2ad696125c
4
- data.tar.gz: 904bb67fde8fc93166f60586984d8fa1fc341a4744fb20f27681e1de2bd17b4f
3
+ metadata.gz: 22ad9d5621e65d220a1610dc9dcf3701d56317fb243354e3ac20b9218793d9a6
4
+ data.tar.gz: e9cc80ef3ebbc84fb8579ebe7e63dcfaa2d2222955877744bb87af23ce46d38e
5
5
  SHA512:
6
- metadata.gz: b2c4c488e943c64427f91576620d000470f7b635b17c607ae79270791c8ad7c0da49802513601e255c21fe7d69b340f1174086db4ac6ba4b1ab784afcd2f851a
7
- data.tar.gz: df2b4bbf81244e2c668f270859b864f1eab1c77d9c7cfe86c429323e4ab5109eda04248cd3bcd61ac0e8b12e539e04748c4d4347ad2422f99c4c2a20a0e5cfac
6
+ metadata.gz: 70be9b6e78f9a97c1966d62559d9dbd0dd523359a1b1375b9eca48cbb21ca4476c1d39b83c400813845b530c95e9242003e6ebeac2bd6622a3ed520afd276f1c
7
+ data.tar.gz: 569fa41d256f010d8e6e0e025924f161d77462bfff09ae1cc5c9dc4fcacaa5bdc8b6fdce72f996e6a5df0e8c134b98d680ec52b82986ca25db33f4e150e86f23
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-beta.55](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.54...v0.1.0-beta.55) (2026-10-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * **STIGG-10154:** generate the v2 usage report ([64e8a4d](https://github.com/stiggio/stigg-ruby/commit/64e8a4d06caf1fbcd929a7a17dcdf8a7d3020807))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * sync OpenAPI spec from stigg-api ([fcbbfa0](https://github.com/stiggio/stigg-ruby/commit/fcbbfa088bb96e8db3d3ab222a0327cbd496f48d))
14
+ * sync OpenAPI spec from stigg-api ([404305e](https://github.com/stiggio/stigg-ruby/commit/404305e71b4e8a58df318ca9304f70224c7338f3))
15
+ * sync OpenAPI spec from stigg-api ([36888c2](https://github.com/stiggio/stigg-ruby/commit/36888c2b5dee5e5c9b0ce961b4c2c8881fcef60a))
16
+
17
+
18
+ ### Chores
19
+
20
+ * normalize version.rb to gem prerelease format for stlc codegen ([5d99ffb](https://github.com/stiggio/stigg-ruby/commit/5d99ffba236fb2e7a68ecf451927b00feefb42b8))
21
+
3
22
  ## [0.1.0-beta.54](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.53...v0.1.0-beta.54) (2026-09-29)
4
23
 
5
24
 
data/README.md CHANGED
@@ -24,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application
24
24
  <!-- x-release-please-start-version -->
25
25
 
26
26
  ```ruby
27
- gem "stigg", "~> 0.1.0.pre.beta.53"
27
+ gem "stigg", "~> 0.1.0.pre.beta.54"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
data/lib/stigg/client.rb CHANGED
@@ -24,6 +24,9 @@ module Stigg
24
24
  # @return [Stigg::Resources::V1Beta]
25
25
  attr_reader :v1_beta
26
26
 
27
+ # @return [Stigg::Resources::V2]
28
+ attr_reader :v2
29
+
27
30
  # @api private
28
31
  #
29
32
  # @return [Hash{String=>String}]
@@ -85,6 +88,7 @@ module Stigg
85
88
 
86
89
  @v1 = Stigg::Resources::V1.new(client: self)
87
90
  @v1_beta = Stigg::Resources::V1Beta.new(client: self)
91
+ @v2 = Stigg::Resources::V2.new(client: self)
88
92
  end
89
93
  end
90
94
  end
@@ -50,13 +50,23 @@ module Stigg
50
50
  # @return [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit, nil]
51
51
  optional :credit, -> { Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit }, nil?: true
52
52
 
53
+ # @!attribute entities
54
+ # The current usage of each governance entitlement this request counted towards.
55
+ # Absent when governance is not enabled or the usage is unknown. Entitlements
56
+ # whose usage could not be read, and those of repeated idempotent requests, are
57
+ # left out
58
+ #
59
+ # @return [Array<Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Entity>, nil]
60
+ optional :entities,
61
+ -> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Entity] }
62
+
53
63
  # @!attribute resource_id
54
64
  # The resource the consumption was attributed to
55
65
  #
56
66
  # @return [String, nil]
57
67
  optional :resource_id, String, api_name: :resourceId, nil?: true
58
68
 
59
- # @!method initialize(amount:, currency_id:, customer_id:, timestamp:, credit: nil, resource_id: nil)
69
+ # @!method initialize(amount:, currency_id:, customer_id:, timestamp:, credit: nil, entities: nil, resource_id: nil)
60
70
  # Some parameter documentations has been truncated, see
61
71
  # {Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data} for more details.
62
72
  #
@@ -72,6 +82,8 @@ module Stigg
72
82
  #
73
83
  # @param credit [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit, nil] The optimistic credit balance after consumption (when sync credit consumption is
74
84
  #
85
+ # @param entities [Array<Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Entity>] The current usage of each governance entitlement this request counted towards. A
86
+ #
75
87
  # @param resource_id [String, nil] The resource the consumption was attributed to
76
88
 
77
89
  # @see Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data#credit
@@ -129,6 +141,89 @@ module Stigg
129
141
  #
130
142
  # @param usage_period_end [Time, nil] End of the current credit grant period (when recurring credits reset), if applic
131
143
  end
144
+
145
+ class Entity < Stigg::Internal::Type::BaseModel
146
+ # @!attribute current_usage
147
+ # The absolute usage counted against the entitlement
148
+ #
149
+ # @return [Float]
150
+ required :current_usage, Float, api_name: :currentUsage
151
+
152
+ # @!attribute customer_id
153
+ # The customer whose usage counted towards the entitlement
154
+ #
155
+ # @return [String]
156
+ required :customer_id, String, api_name: :customerId
157
+
158
+ # @!attribute entitlement_id
159
+ # The governance entitlement the usage counts towards
160
+ #
161
+ # @return [String]
162
+ required :entitlement_id, String, api_name: :entitlementId
163
+
164
+ # @!attribute entity_id
165
+ # The governance entity the entitlement belongs to
166
+ #
167
+ # @return [String]
168
+ required :entity_id, String, api_name: :entityId
169
+
170
+ # @!attribute resource_id
171
+ # The customer resource the usage counted from; `null` for customer-level usage
172
+ #
173
+ # @return [String, nil]
174
+ required :resource_id, String, api_name: :resourceId, nil?: true
175
+
176
+ # @!attribute scope_entity_ids
177
+ # The entities the entitlement is scoped to (empty when it is not scoped)
178
+ #
179
+ # @return [Array<String>]
180
+ required :scope_entity_ids, Stigg::Internal::Type::ArrayOf[String], api_name: :scopeEntityIds
181
+
182
+ # @!attribute usage_updated_at
183
+ # When the entitlement usage was last updated
184
+ #
185
+ # @return [Time]
186
+ required :usage_updated_at, Time, api_name: :usageUpdatedAt
187
+
188
+ # @!attribute currency_id
189
+ # The credit currency the entitlement governs (exactly one of featureId and
190
+ # currencyId is set)
191
+ #
192
+ # @return [String, nil]
193
+ optional :currency_id, String, api_name: :currencyId
194
+
195
+ # @!attribute feature_id
196
+ # The feature the entitlement governs (exactly one of featureId and currencyId is
197
+ # set)
198
+ #
199
+ # @return [String, nil]
200
+ optional :feature_id, String, api_name: :featureId
201
+
202
+ # @!method initialize(current_usage:, customer_id:, entitlement_id:, entity_id:, resource_id:, scope_entity_ids:, usage_updated_at:, currency_id: nil, feature_id: nil)
203
+ # Some parameter documentations has been truncated, see
204
+ # {Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Entity} for more
205
+ # details.
206
+ #
207
+ # The usage counted against one governance entitlement
208
+ #
209
+ # @param current_usage [Float] The absolute usage counted against the entitlement
210
+ #
211
+ # @param customer_id [String] The customer whose usage counted towards the entitlement
212
+ #
213
+ # @param entitlement_id [String] The governance entitlement the usage counts towards
214
+ #
215
+ # @param entity_id [String] The governance entity the entitlement belongs to
216
+ #
217
+ # @param resource_id [String, nil] The customer resource the usage counted from; `null` for customer-level usage
218
+ #
219
+ # @param scope_entity_ids [Array<String>] The entities the entitlement is scoped to (empty when it is not scoped)
220
+ #
221
+ # @param usage_updated_at [Time] When the entitlement usage was last updated
222
+ #
223
+ # @param currency_id [String] The credit currency the entitlement governs (exactly one of featureId and curren
224
+ #
225
+ # @param feature_id [String] The feature the entitlement governs (exactly one of featureId and currencyId is
226
+ end
132
227
  end
133
228
  end
134
229
  end
@@ -305,6 +305,13 @@ module Stigg
305
305
  # @return [String, nil]
306
306
  required :billing_id, String, api_name: :billingId, nil?: true
307
307
 
308
+ # @!attribute card_brand
309
+ # The card brand of the default payment method, as reported by the billing
310
+ # provider (e.g. visa, mastercard, amex)
311
+ #
312
+ # @return [String, nil]
313
+ required :card_brand, String, api_name: :cardBrand, nil?: true
314
+
308
315
  # @!attribute card_expiry_month
309
316
  # The expiration month of the default payment method
310
317
  #
@@ -331,11 +338,24 @@ module Stigg
331
338
  enum: -> { Stigg::Models::V1::CustomerListResponse::DefaultPaymentMethod::Type },
332
339
  nil?: true
333
340
 
334
- # @!method initialize(billing_id:, card_expiry_month:, card_expiry_year:, card_last4_digits:, type:)
341
+ # @!attribute wallet_type
342
+ # The digital wallet used to add the default card payment method, as reported by
343
+ # the billing provider (e.g. apple_pay, google_pay)
344
+ #
345
+ # @return [String, nil]
346
+ required :wallet_type, String, api_name: :walletType, nil?: true
347
+
348
+ # @!method initialize(billing_id:, card_brand:, card_expiry_month:, card_expiry_year:, card_last4_digits:, type:, wallet_type:)
349
+ # Some parameter documentations has been truncated, see
350
+ # {Stigg::Models::V1::CustomerListResponse::DefaultPaymentMethod} for more
351
+ # details.
352
+ #
335
353
  # The default payment method details
336
354
  #
337
355
  # @param billing_id [String, nil] The default payment method id
338
356
  #
357
+ # @param card_brand [String, nil] The card brand of the default payment method, as reported by the billing provide
358
+ #
339
359
  # @param card_expiry_month [Float, nil] The expiration month of the default payment method
340
360
  #
341
361
  # @param card_expiry_year [Float, nil] The expiration year of the default payment method
@@ -343,6 +363,8 @@ module Stigg
343
363
  # @param card_last4_digits [String, nil] The last 4 digits of the default payment method
344
364
  #
345
365
  # @param type [Symbol, Stigg::Models::V1::CustomerListResponse::DefaultPaymentMethod::Type, nil] The default payment method type
366
+ #
367
+ # @param wallet_type [String, nil] The digital wallet used to add the default card payment method, as reported by t
346
368
 
347
369
  # The default payment method type
348
370
  #
@@ -318,6 +318,13 @@ module Stigg
318
318
  # @return [String, nil]
319
319
  required :billing_id, String, api_name: :billingId, nil?: true
320
320
 
321
+ # @!attribute card_brand
322
+ # The card brand of the default payment method, as reported by the billing
323
+ # provider (e.g. visa, mastercard, amex)
324
+ #
325
+ # @return [String, nil]
326
+ required :card_brand, String, api_name: :cardBrand, nil?: true
327
+
321
328
  # @!attribute card_expiry_month
322
329
  # The expiration month of the default payment method
323
330
  #
@@ -346,11 +353,24 @@ module Stigg
346
353
  },
347
354
  nil?: true
348
355
 
349
- # @!method initialize(billing_id:, card_expiry_month:, card_expiry_year:, card_last4_digits:, type:)
356
+ # @!attribute wallet_type
357
+ # The digital wallet used to add the default card payment method, as reported by
358
+ # the billing provider (e.g. apple_pay, google_pay)
359
+ #
360
+ # @return [String, nil]
361
+ required :wallet_type, String, api_name: :walletType, nil?: true
362
+
363
+ # @!method initialize(billing_id:, card_brand:, card_expiry_month:, card_expiry_year:, card_last4_digits:, type:, wallet_type:)
364
+ # Some parameter documentations has been truncated, see
365
+ # {Stigg::Models::V1::CustomerResponse::Data::DefaultPaymentMethod} for more
366
+ # details.
367
+ #
350
368
  # The default payment method details
351
369
  #
352
370
  # @param billing_id [String, nil] The default payment method id
353
371
  #
372
+ # @param card_brand [String, nil] The card brand of the default payment method, as reported by the billing provide
373
+ #
354
374
  # @param card_expiry_month [Float, nil] The expiration month of the default payment method
355
375
  #
356
376
  # @param card_expiry_year [Float, nil] The expiration year of the default payment method
@@ -358,6 +378,8 @@ module Stigg
358
378
  # @param card_last4_digits [String, nil] The last 4 digits of the default payment method
359
379
  #
360
380
  # @param type [Symbol, Stigg::Models::V1::CustomerResponse::Data::DefaultPaymentMethod::Type, nil] The default payment method type
381
+ #
382
+ # @param wallet_type [String, nil] The digital wallet used to add the default card payment method, as reported by t
361
383
 
362
384
  # The default payment method type
363
385
  #
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ module V2
6
+ # @see Stigg::Resources::V2::Usage#report
7
+ class UsageReportParams < Stigg::Internal::Type::BaseModel
8
+ extend Stigg::Internal::Type::RequestParameters::Converter
9
+ include Stigg::Internal::Type::RequestParameters
10
+
11
+ # @!attribute usages
12
+ # A list of usage reports to be submitted in bulk
13
+ #
14
+ # @return [Array<Stigg::Models::V2::UsageReportParams::Usage>]
15
+ required :usages, -> { Stigg::Internal::Type::ArrayOf[Stigg::V2::UsageReportParams::Usage] }
16
+
17
+ # @!attribute x_account_id
18
+ #
19
+ # @return [String, nil]
20
+ optional :x_account_id, String
21
+
22
+ # @!attribute x_environment_id
23
+ #
24
+ # @return [String, nil]
25
+ optional :x_environment_id, String
26
+
27
+ # @!method initialize(usages:, x_account_id: nil, x_environment_id: nil, request_options: {})
28
+ # @param usages [Array<Stigg::Models::V2::UsageReportParams::Usage>] A list of usage reports to be submitted in bulk
29
+ #
30
+ # @param x_account_id [String]
31
+ #
32
+ # @param x_environment_id [String]
33
+ #
34
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
35
+
36
+ class Usage < Stigg::Internal::Type::BaseModel
37
+ # @!attribute customer_id
38
+ # Customer id
39
+ #
40
+ # @return [String]
41
+ required :customer_id, String, api_name: :customerId
42
+
43
+ # @!attribute feature_id
44
+ # Feature id
45
+ #
46
+ # @return [String]
47
+ required :feature_id, String, api_name: :featureId
48
+
49
+ # @!attribute value
50
+ # The value to report for usage. Must be a whole number — the REST API does not
51
+ # accept fractional (float) usage values; scale up (e.g. report cents instead of
52
+ # dollars, or milliseconds instead of seconds) if you need sub-unit precision.
53
+ #
54
+ # @return [Integer]
55
+ required :value, Integer
56
+
57
+ # @!attribute created_at
58
+ # Timestamp of when the record was created
59
+ #
60
+ # @return [Time, nil]
61
+ optional :created_at, Time, api_name: :createdAt
62
+
63
+ # @!attribute dimensions
64
+ # Additional dimensions for the usage report
65
+ #
66
+ # @return [Hash{Symbol=>String, Float, Boolean}, nil]
67
+ optional :dimensions,
68
+ -> { Stigg::Internal::Type::HashOf[union: Stigg::V2::UsageReportParams::Usage::Dimension] }
69
+
70
+ # @!attribute idempotency_key
71
+ # A key you provide to safely retry the same usage report without double-counting
72
+ # it. Reports with a previously-seen idempotency key are deduplicated for 7 days;
73
+ # after that window a retry is treated as new usage.
74
+ #
75
+ # @return [String, nil]
76
+ optional :idempotency_key, String, api_name: :idempotencyKey
77
+
78
+ # @!attribute resource_id
79
+ # The customer resource this usage applies to. Optional — only required if the
80
+ # customer has multiple resources (for example, one subscription per workspace or
81
+ # site) and usage needs to be tracked separately per resource; omit it to report
82
+ # usage at the customer level.
83
+ #
84
+ # @return [String, nil]
85
+ optional :resource_id, String, api_name: :resourceId, nil?: true
86
+
87
+ # @!attribute update_behavior
88
+ # How the reported value is applied: DELTA (default) adds it to the feature's
89
+ # current usage; SET treats it as the new absolute usage total, and Stigg computes
90
+ # the delta internally.
91
+ #
92
+ # @return [Symbol, Stigg::Models::V2::UsageReportParams::Usage::UpdateBehavior, nil]
93
+ optional :update_behavior,
94
+ enum: -> { Stigg::V2::UsageReportParams::Usage::UpdateBehavior },
95
+ api_name: :updateBehavior
96
+
97
+ # @!method initialize(customer_id:, feature_id:, value:, created_at: nil, dimensions: nil, idempotency_key: nil, resource_id: nil, update_behavior: nil)
98
+ # Some parameter documentations has been truncated, see
99
+ # {Stigg::Models::V2::UsageReportParams::Usage} for more details.
100
+ #
101
+ # Single usage measurement
102
+ #
103
+ # @param customer_id [String] Customer id
104
+ #
105
+ # @param feature_id [String] Feature id
106
+ #
107
+ # @param value [Integer] The value to report for usage. Must be a whole number — the REST API does not ac
108
+ #
109
+ # @param created_at [Time] Timestamp of when the record was created
110
+ #
111
+ # @param dimensions [Hash{Symbol=>String, Float, Boolean}] Additional dimensions for the usage report
112
+ #
113
+ # @param idempotency_key [String] A key you provide to safely retry the same usage report without double-counting
114
+ #
115
+ # @param resource_id [String, nil] The customer resource this usage applies to. Optional — only required if the cus
116
+ #
117
+ # @param update_behavior [Symbol, Stigg::Models::V2::UsageReportParams::Usage::UpdateBehavior] How the reported value is applied: DELTA (default) adds it to the feature's curr
118
+
119
+ module Dimension
120
+ extend Stigg::Internal::Type::Union
121
+
122
+ variant String
123
+
124
+ variant Float
125
+
126
+ variant Stigg::Internal::Type::Boolean
127
+
128
+ # @!method self.variants
129
+ # @return [Array(String, Float, Boolean)]
130
+ end
131
+
132
+ # How the reported value is applied: DELTA (default) adds it to the feature's
133
+ # current usage; SET treats it as the new absolute usage total, and Stigg computes
134
+ # the delta internally.
135
+ #
136
+ # @see Stigg::Models::V2::UsageReportParams::Usage#update_behavior
137
+ module UpdateBehavior
138
+ extend Stigg::Internal::Type::Enum
139
+
140
+ DELTA = :DELTA
141
+ SET = :SET
142
+
143
+ # @!method self.values
144
+ # @return [Array<Symbol>]
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end