stigg 0.1.0.pre.beta.33 → 0.1.0.pre.beta.35

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/stigg/client.rb +1 -1
  5. data/lib/stigg/models/v1/credits/consumption_consume_async_params.rb +116 -0
  6. data/lib/stigg/models/v1/credits/consumption_consume_async_response.rb +23 -0
  7. data/lib/stigg/models/v1/credits/consumption_consume_params.rb +102 -0
  8. data/lib/stigg/models/v1/credits/consumption_consume_response.rb +134 -0
  9. data/lib/stigg/models/v1/customer_integration_response.rb +1 -0
  10. data/lib/stigg/models/v1/customer_list_response.rb +1 -0
  11. data/lib/stigg/models/v1/customer_provision_params.rb +1 -0
  12. data/lib/stigg/models/v1/customer_response.rb +1 -0
  13. data/lib/stigg/models/v1/customer_update_params.rb +1 -0
  14. data/lib/stigg/models/v1/customers/integration_link_params.rb +1 -0
  15. data/lib/stigg/models/v1/customers/integration_list_params.rb +1 -0
  16. data/lib/stigg/models/v1/customers/integration_list_response.rb +1 -0
  17. data/lib/stigg/models/v1/customers/payment_method_attach_params.rb +1 -0
  18. data/lib/stigg/resources/v1/credits/consumption.rb +94 -0
  19. data/lib/stigg/resources/v1/credits.rb +4 -0
  20. data/lib/stigg/version.rb +1 -1
  21. data/lib/stigg.rb +5 -0
  22. data/rbi/stigg/models/v1/credits/consumption_consume_async_params.rbi +214 -0
  23. data/rbi/stigg/models/v1/credits/consumption_consume_async_response.rbi +35 -0
  24. data/rbi/stigg/models/v1/credits/consumption_consume_params.rbi +166 -0
  25. data/rbi/stigg/models/v1/credits/consumption_consume_response.rbi +232 -0
  26. data/rbi/stigg/models/v1/customer_integration_response.rbi +5 -0
  27. data/rbi/stigg/models/v1/customer_list_response.rbi +5 -0
  28. data/rbi/stigg/models/v1/customer_provision_params.rbi +5 -0
  29. data/rbi/stigg/models/v1/customer_response.rbi +5 -0
  30. data/rbi/stigg/models/v1/customer_update_params.rbi +5 -0
  31. data/rbi/stigg/models/v1/customers/integration_link_params.rbi +5 -0
  32. data/rbi/stigg/models/v1/customers/integration_list_params.rbi +5 -0
  33. data/rbi/stigg/models/v1/customers/integration_list_response.rbi +5 -0
  34. data/rbi/stigg/models/v1/customers/payment_method_attach_params.rbi +5 -0
  35. data/rbi/stigg/resources/v1/credits/consumption.rbi +91 -0
  36. data/rbi/stigg/resources/v1/credits.rbi +3 -0
  37. data/sig/stigg/models/v1/credits/consumption_consume_async_params.rbs +107 -0
  38. data/sig/stigg/models/v1/credits/consumption_consume_async_response.rbs +17 -0
  39. data/sig/stigg/models/v1/credits/consumption_consume_params.rbs +90 -0
  40. data/sig/stigg/models/v1/credits/consumption_consume_response.rbs +101 -0
  41. data/sig/stigg/models/v1/customer_integration_response.rbs +2 -0
  42. data/sig/stigg/models/v1/customer_list_response.rbs +2 -0
  43. data/sig/stigg/models/v1/customer_provision_params.rbs +2 -0
  44. data/sig/stigg/models/v1/customer_response.rbs +2 -0
  45. data/sig/stigg/models/v1/customer_update_params.rbs +2 -0
  46. data/sig/stigg/models/v1/customers/integration_link_params.rbs +2 -0
  47. data/sig/stigg/models/v1/customers/integration_list_params.rbs +2 -0
  48. data/sig/stigg/models/v1/customers/integration_list_response.rbs +2 -0
  49. data/sig/stigg/models/v1/customers/payment_method_attach_params.rbs +2 -0
  50. data/sig/stigg/resources/v1/credits/consumption.rbs +31 -0
  51. data/sig/stigg/resources/v1/credits.rbs +2 -0
  52. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b986d4b46100a2ddc8aac4adf1cdc08eeec6604fe14f55a465759009821b6c9e
4
- data.tar.gz: a1066a8329e8f7b48b549adfc53e8e6d0c8af839f50123d9052f3fe6f43c9179
3
+ metadata.gz: 37796b53d48cf3448b56cb9d463ed46c3308e729cf52f572513f959c7dacec50
4
+ data.tar.gz: 5d16deb29b585ff6bef9e6a996e39e53069a93fc0bd0c2dc00a4a4f5552d96c3
5
5
  SHA512:
6
- metadata.gz: d014220946db704c30b28b23cfcde3e022d9c7398e901b0640f53dcdc1808ab473ce999eb460e45b3123f57aad0f1f709c30110a703a39773e951496afc69927
7
- data.tar.gz: feaa881c5512a63e76a35a8f88fc6c6b2a351115b050aaffda26144abd5deea8809d650288b49e9ddf865906f544261c48c0c53432639aab408b8d3a482a229f
6
+ metadata.gz: 8cdc6cb04e672018779405902befa35db1a420df3390f661dd126cc15ef9fc4b76c92dd3bedfb354814aecc51a8b5844181aa54b3bc00021d481260f6e1ded45
7
+ data.tar.gz: 37357f0095e9611dd9cf877b09bbb3bc908279bf4fda021cb07d431c2844ce509379648ff91bda4ddd7ae1722dc4c67d526a1f45085f000dc1a3a85d3154fe15
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-beta.35 (2026-07-01)
4
+
5
+ Full Changelog: [v0.1.0-beta.34...v0.1.0-beta.35](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.34...v0.1.0-beta.35)
6
+
7
+ ### Features
8
+
9
+ * **api:** add consumption sub-resource to credits ([91984a0](https://github.com/stiggio/stigg-ruby/commit/91984a0134e60ec1b03ed1c0ad34fdbdabea9426))
10
+
11
+ ## 0.1.0-beta.34 (2026-06-30)
12
+
13
+ Full Changelog: [v0.1.0-beta.33...v0.1.0-beta.34](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.33...v0.1.0-beta.34)
14
+
15
+ ### Features
16
+
17
+ * **api:** add AIRWALLEX vendor identifier to customer models ([4bf7b9b](https://github.com/stiggio/stigg-ruby/commit/4bf7b9b507ce825f15eb95f283fa3eefca90c427))
18
+
19
+
20
+ ### Chores
21
+
22
+ * **internal:** bound formatter parallelism to CPU count ([e502f28](https://github.com/stiggio/stigg-ruby/commit/e502f285ce741474835722363099025b01cfe87a))
23
+
3
24
  ## 0.1.0-beta.33 (2026-06-28)
4
25
 
5
26
  Full Changelog: [v0.1.0-beta.32...v0.1.0-beta.33](https://github.com/stiggio/stigg-ruby/compare/v0.1.0-beta.32...v0.1.0-beta.33)
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.33"
27
+ gem "stigg", "~> 0.1.0.pre.beta.35"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
data/lib/stigg/client.rb CHANGED
@@ -53,7 +53,7 @@ module Stigg
53
53
  initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
54
54
  max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
55
55
  )
56
- base_url ||= "https://edge.api.stigg.io"
56
+ base_url ||= "https://api.stigg.io"
57
57
 
58
58
  if api_key.nil?
59
59
  raise ArgumentError.new("api_key is required, and can be set via environ: \"STIGG_API_KEY\"")
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ module V1
6
+ module Credits
7
+ # @see Stigg::Resources::V1::Credits::Consumption#consume_async
8
+ class ConsumptionConsumeAsyncParams < Stigg::Internal::Type::BaseModel
9
+ extend Stigg::Internal::Type::RequestParameters::Converter
10
+ include Stigg::Internal::Type::RequestParameters
11
+
12
+ # @!attribute consumptions
13
+ # The credit consumptions to report (up to 1000)
14
+ #
15
+ # @return [Array<Stigg::Models::V1::Credits::ConsumptionConsumeAsyncParams::Consumption>]
16
+ required :consumptions,
17
+ -> { Stigg::Internal::Type::ArrayOf[Stigg::V1::Credits::ConsumptionConsumeAsyncParams::Consumption] }
18
+
19
+ # @!attribute x_account_id
20
+ #
21
+ # @return [String, nil]
22
+ optional :x_account_id, String
23
+
24
+ # @!attribute x_environment_id
25
+ #
26
+ # @return [String, nil]
27
+ optional :x_environment_id, String
28
+
29
+ # @!method initialize(consumptions:, x_account_id: nil, x_environment_id: nil, request_options: {})
30
+ # @param consumptions [Array<Stigg::Models::V1::Credits::ConsumptionConsumeAsyncParams::Consumption>] The credit consumptions to report (up to 1000)
31
+ #
32
+ # @param x_account_id [String]
33
+ #
34
+ # @param x_environment_id [String]
35
+ #
36
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
37
+
38
+ class Consumption < Stigg::Internal::Type::BaseModel
39
+ # @!attribute amount
40
+ # The amount of credits to consume
41
+ #
42
+ # @return [Float]
43
+ required :amount, Float
44
+
45
+ # @!attribute currency_id
46
+ # The credit currency to consume from (required)
47
+ #
48
+ # @return [String]
49
+ required :currency_id, String, api_name: :currencyId
50
+
51
+ # @!attribute customer_id
52
+ # The customer to consume credits from (required)
53
+ #
54
+ # @return [String]
55
+ required :customer_id, String, api_name: :customerId
56
+
57
+ # @!attribute idempotency_key
58
+ # A unique key used to deduplicate the consumption (required)
59
+ #
60
+ # @return [String]
61
+ required :idempotency_key, String, api_name: :idempotencyKey
62
+
63
+ # @!attribute created_at
64
+ # Optional timestamp the consumption is attributed to
65
+ #
66
+ # @return [Time, nil]
67
+ optional :created_at, Time, api_name: :createdAt
68
+
69
+ # @!attribute dimensions
70
+ # Optional dimensions describing the consumption
71
+ #
72
+ # @return [Hash{Symbol=>String, Float, Boolean}, nil]
73
+ optional :dimensions,
74
+ -> { Stigg::Internal::Type::HashOf[union: Stigg::V1::Credits::ConsumptionConsumeAsyncParams::Consumption::Dimension] }
75
+
76
+ # @!attribute resource_id
77
+ # Optional resource the consumption is attributed to
78
+ #
79
+ # @return [String, nil]
80
+ optional :resource_id, String, api_name: :resourceId
81
+
82
+ # @!method initialize(amount:, currency_id:, customer_id:, idempotency_key:, created_at: nil, dimensions: nil, resource_id: nil)
83
+ # Request body for consuming credits directly from a wallet
84
+ #
85
+ # @param amount [Float] The amount of credits to consume
86
+ #
87
+ # @param currency_id [String] The credit currency to consume from (required)
88
+ #
89
+ # @param customer_id [String] The customer to consume credits from (required)
90
+ #
91
+ # @param idempotency_key [String] A unique key used to deduplicate the consumption (required)
92
+ #
93
+ # @param created_at [Time] Optional timestamp the consumption is attributed to
94
+ #
95
+ # @param dimensions [Hash{Symbol=>String, Float, Boolean}] Optional dimensions describing the consumption
96
+ #
97
+ # @param resource_id [String] Optional resource the consumption is attributed to
98
+
99
+ module Dimension
100
+ extend Stigg::Internal::Type::Union
101
+
102
+ variant String
103
+
104
+ variant Float
105
+
106
+ variant Stigg::Internal::Type::Boolean
107
+
108
+ # @!method self.variants
109
+ # @return [Array(String, Float, Boolean)]
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ module V1
6
+ module Credits
7
+ # @see Stigg::Resources::V1::Credits::Consumption#consume_async
8
+ class ConsumptionConsumeAsyncResponse < Stigg::Internal::Type::BaseModel
9
+ # @!attribute data
10
+ # Confirmation that the credit consumptions were accepted for processing
11
+ #
12
+ # @return [Object]
13
+ required :data, Stigg::Internal::Type::Unknown
14
+
15
+ # @!method initialize(data:)
16
+ # Response object
17
+ #
18
+ # @param data [Object] Confirmation that the credit consumptions were accepted for processing
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ module V1
6
+ module Credits
7
+ # @see Stigg::Resources::V1::Credits::Consumption#consume
8
+ class ConsumptionConsumeParams < Stigg::Internal::Type::BaseModel
9
+ extend Stigg::Internal::Type::RequestParameters::Converter
10
+ include Stigg::Internal::Type::RequestParameters
11
+
12
+ # @!attribute amount
13
+ # The amount of credits to consume
14
+ #
15
+ # @return [Float]
16
+ required :amount, Float
17
+
18
+ # @!attribute currency_id
19
+ # The credit currency to consume from (required)
20
+ #
21
+ # @return [String]
22
+ required :currency_id, String, api_name: :currencyId
23
+
24
+ # @!attribute customer_id
25
+ # The customer to consume credits from (required)
26
+ #
27
+ # @return [String]
28
+ required :customer_id, String, api_name: :customerId
29
+
30
+ # @!attribute idempotency_key
31
+ # A unique key used to deduplicate the consumption (required)
32
+ #
33
+ # @return [String]
34
+ required :idempotency_key, String, api_name: :idempotencyKey
35
+
36
+ # @!attribute created_at
37
+ # Optional timestamp the consumption is attributed to
38
+ #
39
+ # @return [Time, nil]
40
+ optional :created_at, Time, api_name: :createdAt
41
+
42
+ # @!attribute dimensions
43
+ # Optional dimensions describing the consumption
44
+ #
45
+ # @return [Hash{Symbol=>String, Float, Boolean}, nil]
46
+ optional :dimensions,
47
+ -> { Stigg::Internal::Type::HashOf[union: Stigg::V1::Credits::ConsumptionConsumeParams::Dimension] }
48
+
49
+ # @!attribute resource_id
50
+ # Optional resource the consumption is attributed to
51
+ #
52
+ # @return [String, nil]
53
+ optional :resource_id, String, api_name: :resourceId
54
+
55
+ # @!attribute x_account_id
56
+ #
57
+ # @return [String, nil]
58
+ optional :x_account_id, String
59
+
60
+ # @!attribute x_environment_id
61
+ #
62
+ # @return [String, nil]
63
+ optional :x_environment_id, String
64
+
65
+ # @!method initialize(amount:, currency_id:, customer_id:, idempotency_key:, created_at: nil, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
66
+ # @param amount [Float] The amount of credits to consume
67
+ #
68
+ # @param currency_id [String] The credit currency to consume from (required)
69
+ #
70
+ # @param customer_id [String] The customer to consume credits from (required)
71
+ #
72
+ # @param idempotency_key [String] A unique key used to deduplicate the consumption (required)
73
+ #
74
+ # @param created_at [Time] Optional timestamp the consumption is attributed to
75
+ #
76
+ # @param dimensions [Hash{Symbol=>String, Float, Boolean}] Optional dimensions describing the consumption
77
+ #
78
+ # @param resource_id [String] Optional resource the consumption is attributed to
79
+ #
80
+ # @param x_account_id [String]
81
+ #
82
+ # @param x_environment_id [String]
83
+ #
84
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
85
+
86
+ module Dimension
87
+ extend Stigg::Internal::Type::Union
88
+
89
+ variant String
90
+
91
+ variant Float
92
+
93
+ variant Stigg::Internal::Type::Boolean
94
+
95
+ # @!method self.variants
96
+ # @return [Array(String, Float, Boolean)]
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Models
5
+ module V1
6
+ module Credits
7
+ # @see Stigg::Resources::V1::Credits::Consumption#consume
8
+ class ConsumptionConsumeResponse < Stigg::Internal::Type::BaseModel
9
+ # @!attribute data
10
+ # Result of a synchronous direct credit consumption
11
+ #
12
+ # @return [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data]
13
+ required :data, -> { Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data }
14
+
15
+ # @!method initialize(data:)
16
+ # Response object
17
+ #
18
+ # @param data [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data] Result of a synchronous direct credit consumption
19
+
20
+ # @see Stigg::Models::V1::Credits::ConsumptionConsumeResponse#data
21
+ class Data < Stigg::Internal::Type::BaseModel
22
+ # @!attribute amount
23
+ # The amount of credits consumed
24
+ #
25
+ # @return [Float]
26
+ required :amount, Float
27
+
28
+ # @!attribute currency_id
29
+ # The credit currency the credits were consumed from
30
+ #
31
+ # @return [String]
32
+ required :currency_id, String, api_name: :currencyId
33
+
34
+ # @!attribute customer_id
35
+ # The customer the credits were consumed from
36
+ #
37
+ # @return [String]
38
+ required :customer_id, String, api_name: :customerId
39
+
40
+ # @!attribute timestamp
41
+ # The timestamp the consumption was attributed to
42
+ #
43
+ # @return [Time]
44
+ required :timestamp, Time
45
+
46
+ # @!attribute credit
47
+ # The optimistic credit balance after consumption (when sync credit consumption is
48
+ # enabled)
49
+ #
50
+ # @return [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit, nil]
51
+ optional :credit, -> { Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit }, nil?: true
52
+
53
+ # @!attribute resource_id
54
+ # The resource the consumption was attributed to
55
+ #
56
+ # @return [String, nil]
57
+ optional :resource_id, String, api_name: :resourceId, nil?: true
58
+
59
+ # @!method initialize(amount:, currency_id:, customer_id:, timestamp:, credit: nil, resource_id: nil)
60
+ # Some parameter documentations has been truncated, see
61
+ # {Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data} for more details.
62
+ #
63
+ # Result of a synchronous direct credit consumption
64
+ #
65
+ # @param amount [Float] The amount of credits consumed
66
+ #
67
+ # @param currency_id [String] The credit currency the credits were consumed from
68
+ #
69
+ # @param customer_id [String] The customer the credits were consumed from
70
+ #
71
+ # @param timestamp [Time] The timestamp the consumption was attributed to
72
+ #
73
+ # @param credit [Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit, nil] The optimistic credit balance after consumption (when sync credit consumption is
74
+ #
75
+ # @param resource_id [String, nil] The resource the consumption was attributed to
76
+
77
+ # @see Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data#credit
78
+ class Credit < Stigg::Internal::Type::BaseModel
79
+ # @!attribute currency_id
80
+ # The credit currency identifier
81
+ #
82
+ # @return [String]
83
+ required :currency_id, String, api_name: :currencyId
84
+
85
+ # @!attribute current_usage
86
+ # The credits consumed (optimistic — includes not-yet-reconciled usage)
87
+ #
88
+ # @return [Float]
89
+ required :current_usage, Float, api_name: :currentUsage
90
+
91
+ # @!attribute timestamp
92
+ # The grant-version timestamp of this balance, used by the SDK for last-write-wins
93
+ # reconciliation
94
+ #
95
+ # @return [Time]
96
+ required :timestamp, Time
97
+
98
+ # @!attribute usage_limit
99
+ # The total credits granted
100
+ #
101
+ # @return [Float]
102
+ required :usage_limit, Float, api_name: :usageLimit
103
+
104
+ # @!attribute usage_period_end
105
+ # End of the current credit grant period (when recurring credits reset), if
106
+ # applicable
107
+ #
108
+ # @return [Time, nil]
109
+ optional :usage_period_end, Time, api_name: :usagePeriodEnd, nil?: true
110
+
111
+ # @!method initialize(currency_id:, current_usage:, timestamp:, usage_limit:, usage_period_end: nil)
112
+ # Some parameter documentations has been truncated, see
113
+ # {Stigg::Models::V1::Credits::ConsumptionConsumeResponse::Data::Credit} for more
114
+ # details.
115
+ #
116
+ # The optimistic credit balance after consumption (when sync credit consumption is
117
+ # enabled)
118
+ #
119
+ # @param currency_id [String] The credit currency identifier
120
+ #
121
+ # @param current_usage [Float] The credits consumed (optimistic — includes not-yet-reconciled usage)
122
+ #
123
+ # @param timestamp [Time] The grant-version timestamp of this balance, used by the SDK for last-write-wins
124
+ #
125
+ # @param usage_limit [Float] The total credits granted
126
+ #
127
+ # @param usage_period_end [Time, nil] End of the current credit grant period (when recurring credits reset), if applic
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -79,6 +79,7 @@ module Stigg
79
79
  APP_STORE = :APP_STORE
80
80
  RECEIVED = :RECEIVED
81
81
  PREQUEL = :PREQUEL
82
+ AIRWALLEX = :AIRWALLEX
82
83
 
83
84
  # @!method self.values
84
85
  # @return [Array<Symbol>]
@@ -398,6 +398,7 @@ module Stigg
398
398
  APP_STORE = :APP_STORE
399
399
  RECEIVED = :RECEIVED
400
400
  PREQUEL = :PREQUEL
401
+ AIRWALLEX = :AIRWALLEX
401
402
 
402
403
  # @!method self.values
403
404
  # @return [Array<Symbol>]
@@ -386,6 +386,7 @@ module Stigg
386
386
  APP_STORE = :APP_STORE
387
387
  RECEIVED = :RECEIVED
388
388
  PREQUEL = :PREQUEL
389
+ AIRWALLEX = :AIRWALLEX
389
390
 
390
391
  # @!method self.values
391
392
  # @return [Array<Symbol>]
@@ -411,6 +411,7 @@ module Stigg
411
411
  APP_STORE = :APP_STORE
412
412
  RECEIVED = :RECEIVED
413
413
  PREQUEL = :PREQUEL
414
+ AIRWALLEX = :AIRWALLEX
414
415
 
415
416
  # @!method self.values
416
417
  # @return [Array<Symbol>]
@@ -315,6 +315,7 @@ module Stigg
315
315
  APP_STORE = :APP_STORE
316
316
  RECEIVED = :RECEIVED
317
317
  PREQUEL = :PREQUEL
318
+ AIRWALLEX = :AIRWALLEX
318
319
 
319
320
  # @!method self.values
320
321
  # @return [Array<Symbol>]
@@ -75,6 +75,7 @@ module Stigg
75
75
  APP_STORE = :APP_STORE
76
76
  RECEIVED = :RECEIVED
77
77
  PREQUEL = :PREQUEL
78
+ AIRWALLEX = :AIRWALLEX
78
79
 
79
80
  # @!method self.values
80
81
  # @return [Array<Symbol>]
@@ -85,6 +85,7 @@ module Stigg
85
85
  APP_STORE = :APP_STORE
86
86
  RECEIVED = :RECEIVED
87
87
  PREQUEL = :PREQUEL
88
+ AIRWALLEX = :AIRWALLEX
88
89
 
89
90
  # @!method self.values
90
91
  # @return [Array<Symbol>]
@@ -68,6 +68,7 @@ module Stigg
68
68
  APP_STORE = :APP_STORE
69
69
  RECEIVED = :RECEIVED
70
70
  PREQUEL = :PREQUEL
71
+ AIRWALLEX = :AIRWALLEX
71
72
 
72
73
  # @!method self.values
73
74
  # @return [Array<Symbol>]
@@ -86,6 +86,7 @@ module Stigg
86
86
  APP_STORE = :APP_STORE
87
87
  RECEIVED = :RECEIVED
88
88
  PREQUEL = :PREQUEL
89
+ AIRWALLEX = :AIRWALLEX
89
90
 
90
91
  # @!method self.values
91
92
  # @return [Array<Symbol>]
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stigg
4
+ module Resources
5
+ class V1
6
+ class Credits
7
+ class Consumption
8
+ # Some parameter documentations has been truncated, see
9
+ # {Stigg::Models::V1::Credits::ConsumptionConsumeParams} for more details.
10
+ #
11
+ # Consumes a specified amount of credits directly from a customer wallet, with no
12
+ # feature mapping. Returns the optimistic balance.
13
+ #
14
+ # @overload consume(amount:, currency_id:, customer_id:, idempotency_key:, created_at: nil, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {})
15
+ #
16
+ # @param amount [Float] Body param: The amount of credits to consume
17
+ #
18
+ # @param currency_id [String] Body param: The credit currency to consume from (required)
19
+ #
20
+ # @param customer_id [String] Body param: The customer to consume credits from (required)
21
+ #
22
+ # @param idempotency_key [String] Body param: A unique key used to deduplicate the consumption (required)
23
+ #
24
+ # @param created_at [Time] Body param: Optional timestamp the consumption is attributed to
25
+ #
26
+ # @param dimensions [Hash{Symbol=>String, Float, Boolean}] Body param: Optional dimensions describing the consumption
27
+ #
28
+ # @param resource_id [String] Body param: Optional resource the consumption is attributed to
29
+ #
30
+ # @param x_account_id [String] Header param: Account ID — optional when authenticating with a user JWT (Bearer
31
+ #
32
+ # @param x_environment_id [String] Header param: Environment ID — required when authenticating with a user JWT (Bea
33
+ #
34
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
35
+ #
36
+ # @return [Stigg::Models::V1::Credits::ConsumptionConsumeResponse]
37
+ #
38
+ # @see Stigg::Models::V1::Credits::ConsumptionConsumeParams
39
+ def consume(params)
40
+ parsed, options = Stigg::V1::Credits::ConsumptionConsumeParams.dump_request(params)
41
+ header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
42
+ @client.request(
43
+ method: :post,
44
+ path: "api/v1/credits/consumption",
45
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
46
+ body: parsed.except(*header_params.keys),
47
+ model: Stigg::Models::V1::Credits::ConsumptionConsumeResponse,
48
+ options: options
49
+ )
50
+ end
51
+
52
+ # Some parameter documentations has been truncated, see
53
+ # {Stigg::Models::V1::Credits::ConsumptionConsumeAsyncParams} for more details.
54
+ #
55
+ # Consumes credits directly from customer wallets asynchronously. Consumptions are
56
+ # reconciled asynchronously into the credit balances.
57
+ #
58
+ # @overload consume_async(consumptions:, x_account_id: nil, x_environment_id: nil, request_options: {})
59
+ #
60
+ # @param consumptions [Array<Stigg::Models::V1::Credits::ConsumptionConsumeAsyncParams::Consumption>] Body param: The credit consumptions to report (up to 1000)
61
+ #
62
+ # @param x_account_id [String] Header param: Account ID — optional when authenticating with a user JWT (Bearer
63
+ #
64
+ # @param x_environment_id [String] Header param: Environment ID — required when authenticating with a user JWT (Bea
65
+ #
66
+ # @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @return [Stigg::Models::V1::Credits::ConsumptionConsumeAsyncResponse]
69
+ #
70
+ # @see Stigg::Models::V1::Credits::ConsumptionConsumeAsyncParams
71
+ def consume_async(params)
72
+ parsed, options = Stigg::V1::Credits::ConsumptionConsumeAsyncParams.dump_request(params)
73
+ header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
74
+ @client.request(
75
+ method: :post,
76
+ path: "api/v1/credits/consumption/async",
77
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
78
+ body: parsed.except(*header_params.keys),
79
+ model: Stigg::Models::V1::Credits::ConsumptionConsumeAsyncResponse,
80
+ options: options
81
+ )
82
+ end
83
+
84
+ # @api private
85
+ #
86
+ # @param client [Stigg::Client]
87
+ def initialize(client:)
88
+ @client = client
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -12,6 +12,9 @@ module Stigg
12
12
  # @return [Stigg::Resources::V1::Credits::CustomCurrencies]
13
13
  attr_reader :custom_currencies
14
14
 
15
+ # @return [Stigg::Resources::V1::Credits::Consumption]
16
+ attr_reader :consumption
17
+
15
18
  # Some parameter documentations has been truncated, see
16
19
  # {Stigg::Models::V1::CreditGetAutoRechargeParams} for more details.
17
20
  #
@@ -181,6 +184,7 @@ module Stigg
181
184
  @client = client
182
185
  @grants = Stigg::Resources::V1::Credits::Grants.new(client: client)
183
186
  @custom_currencies = Stigg::Resources::V1::Credits::CustomCurrencies.new(client: client)
187
+ @consumption = Stigg::Resources::V1::Credits::Consumption.new(client: client)
184
188
  end
185
189
  end
186
190
  end
data/lib/stigg/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stigg
4
- VERSION = "0.1.0.pre.beta.33"
4
+ VERSION = "0.1.0.pre.beta.35"
5
5
  end
data/lib/stigg.rb CHANGED
@@ -87,6 +87,10 @@ require_relative "stigg/models/v1/credit_get_usage_params"
87
87
  require_relative "stigg/models/v1/credit_get_usage_response"
88
88
  require_relative "stigg/models/v1/credit_list_ledger_params"
89
89
  require_relative "stigg/models/v1/credit_list_ledger_response"
90
+ require_relative "stigg/models/v1/credits/consumption_consume_async_params"
91
+ require_relative "stigg/models/v1/credits/consumption_consume_async_response"
92
+ require_relative "stigg/models/v1/credits/consumption_consume_params"
93
+ require_relative "stigg/models/v1/credits/consumption_consume_response"
90
94
  require_relative "stigg/models/v1/credits/credit_grant_response"
91
95
  require_relative "stigg/models/v1/credits/custom_currency_archive_params"
92
96
  require_relative "stigg/models/v1/credits/custom_currency_create_params"
@@ -241,6 +245,7 @@ require_relative "stigg/resources/v1/addons"
241
245
  require_relative "stigg/resources/v1/addons/entitlements"
242
246
  require_relative "stigg/resources/v1/coupons"
243
247
  require_relative "stigg/resources/v1/credits"
248
+ require_relative "stigg/resources/v1/credits/consumption"
244
249
  require_relative "stigg/resources/v1/credits/custom_currencies"
245
250
  require_relative "stigg/resources/v1/credits/grants"
246
251
  require_relative "stigg/resources/v1/customers"