orb-billing 1.48.0 → 1.49.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a525b92a1a6f29957b2cb25a56d07bffb8e69a009852a1f2ca72132a2e2f531
4
- data.tar.gz: 429829175519be27c097d4d1cc1079eb358bf57038303228085e85c9ddda4242
3
+ metadata.gz: a9de5e66a507e201cfc16aabb8c3b05315d34c90cc18ea4ddd4ec5af2f20397d
4
+ data.tar.gz: 9ce23da33a1d9052453b788b969f4bd7759cbf336d89bd48737313375870ebce
5
5
  SHA512:
6
- metadata.gz: e89d1b03c858c4f8971a925951a800ccba1c58b072f791db95c732b216e8b507b7e9ced541a96c4a6be656c6f1f2ba9237b63a7c697fe8c67cd7757d9bc74a33
7
- data.tar.gz: 5fcd2c53b737a529881de5d8391224ac614d71592c3e73a0857f56e7e9043996243155ddce23da4efe6b2e91c9fc2682b1267d055169b9eb75f92bf2cb13969c
6
+ metadata.gz: 56b985ac015716ca1d328c60cc1d5659dd6f5ea69052bc541aa7a6258d0ad5f5ed685b46dd2b2a9e837d4efb8ea709426ca9773113e1205fa34deb4d383b0611
7
+ data.tar.gz: ac6d59ad41d20c3878c9531ff2ff899da372cb44a5ce349eea3bbd8ec01144fd199049c5ed31fd309aa2190ed9acdad252cadf0fbf8c892aa6f6e4c1e1e8cb79
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.49.0](https://github.com/orbcorp/orb-ruby/compare/v1.48.0...v1.49.0) (2026-10-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** allow up to 50 spend_exceeded alerts per plan or subscription ([0448a00](https://github.com/orbcorp/orb-ruby/commit/0448a002cbad582b428b77b530b62460e6f96274))
9
+
3
10
  ## [1.48.0](https://github.com/orbcorp/orb-ruby/compare/v1.47.0...v1.48.0) (2026-10-24)
4
11
 
5
12
 
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "orb-billing", "~> 1.48.0"
18
+ gem "orb-billing", "~> 1.49.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Models
5
+ # @see Orb::Resources::Subscriptions#list_summary
6
+ class SubscriptionListSummaryParams < Orb::Internal::Type::BaseModel
7
+ extend Orb::Internal::Type::RequestParameters::Converter
8
+ include Orb::Internal::Type::RequestParameters
9
+
10
+ # @!attribute created_at_gt
11
+ #
12
+ # @return [Time, nil]
13
+ optional :created_at_gt, Time, nil?: true
14
+
15
+ # @!attribute created_at_gte
16
+ #
17
+ # @return [Time, nil]
18
+ optional :created_at_gte, Time, nil?: true
19
+
20
+ # @!attribute created_at_lt
21
+ #
22
+ # @return [Time, nil]
23
+ optional :created_at_lt, Time, nil?: true
24
+
25
+ # @!attribute created_at_lte
26
+ #
27
+ # @return [Time, nil]
28
+ optional :created_at_lte, Time, nil?: true
29
+
30
+ # @!attribute cursor
31
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
32
+ # from the initial request.
33
+ #
34
+ # @return [String, nil]
35
+ optional :cursor, String, nil?: true
36
+
37
+ # @!attribute customer_id
38
+ #
39
+ # @return [String, nil]
40
+ optional :customer_id, String, nil?: true
41
+
42
+ # @!attribute external_customer_id
43
+ #
44
+ # @return [String, nil]
45
+ optional :external_customer_id, String, nil?: true
46
+
47
+ # @!attribute external_plan_id
48
+ #
49
+ # @return [String, nil]
50
+ optional :external_plan_id, String, nil?: true
51
+
52
+ # @!attribute limit
53
+ # The number of items to fetch. Defaults to 20.
54
+ #
55
+ # @return [Integer, nil]
56
+ optional :limit, Integer
57
+
58
+ # @!attribute plan_id
59
+ #
60
+ # @return [String, nil]
61
+ optional :plan_id, String, nil?: true
62
+
63
+ # @!attribute status
64
+ #
65
+ # @return [Symbol, Orb::Models::SubscriptionListSummaryParams::Status, nil]
66
+ optional :status, enum: -> { Orb::SubscriptionListSummaryParams::Status }, nil?: true
67
+
68
+ # @!method initialize(created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, cursor: nil, customer_id: nil, external_customer_id: nil, external_plan_id: nil, limit: nil, plan_id: nil, status: nil, request_options: {})
69
+ # Some parameter documentations has been truncated, see
70
+ # {Orb::Models::SubscriptionListSummaryParams} for more details.
71
+ #
72
+ # @param created_at_gt [Time, nil]
73
+ #
74
+ # @param created_at_gte [Time, nil]
75
+ #
76
+ # @param created_at_lt [Time, nil]
77
+ #
78
+ # @param created_at_lte [Time, nil]
79
+ #
80
+ # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
81
+ #
82
+ # @param customer_id [String, nil]
83
+ #
84
+ # @param external_customer_id [String, nil]
85
+ #
86
+ # @param external_plan_id [String, nil]
87
+ #
88
+ # @param limit [Integer] The number of items to fetch. Defaults to 20.
89
+ #
90
+ # @param plan_id [String, nil]
91
+ #
92
+ # @param status [Symbol, Orb::Models::SubscriptionListSummaryParams::Status, nil]
93
+ #
94
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
95
+
96
+ module Status
97
+ extend Orb::Internal::Type::Enum
98
+
99
+ ACTIVE = :active
100
+ ENDED = :ended
101
+ UPCOMING = :upcoming
102
+
103
+ # @!method self.values
104
+ # @return [Array<Symbol>]
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Models
5
+ # @see Orb::Resources::Subscriptions#list_summary
6
+ class SubscriptionListSummaryResponse < Orb::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute created_at
13
+ #
14
+ # @return [Time]
15
+ required :created_at, Time
16
+
17
+ # @!attribute customer
18
+ #
19
+ # @return [Orb::Models::CustomerMinified]
20
+ required :customer, -> { Orb::CustomerMinified }
21
+
22
+ # @!attribute end_date
23
+ # The date Orb stops billing for this subscription.
24
+ #
25
+ # @return [Time, nil]
26
+ required :end_date, Time, nil?: true
27
+
28
+ # @!attribute metadata
29
+ # User specified key-value pairs for the resource. If not present, this defaults
30
+ # to an empty dictionary. Individual keys can be removed by setting the value to
31
+ # `null`, and the entire metadata mapping can be cleared by setting `metadata` to
32
+ # `null`.
33
+ #
34
+ # @return [Hash{Symbol=>String}]
35
+ required :metadata, Orb::Internal::Type::HashOf[String]
36
+
37
+ # @!attribute name
38
+ # The name of the subscription.
39
+ #
40
+ # @return [String]
41
+ required :name, String
42
+
43
+ # @!attribute plan
44
+ #
45
+ # @return [Orb::Models::SubscriptionListSummaryResponse::Plan, nil]
46
+ required :plan, -> { Orb::Models::SubscriptionListSummaryResponse::Plan }, nil?: true
47
+
48
+ # @!attribute start_date
49
+ # The date Orb starts billing for this subscription.
50
+ #
51
+ # @return [Time]
52
+ required :start_date, Time
53
+
54
+ # @!attribute status
55
+ #
56
+ # @return [Symbol, Orb::Models::SubscriptionListSummaryResponse::Status]
57
+ required :status, enum: -> { Orb::Models::SubscriptionListSummaryResponse::Status }
58
+
59
+ # @!method initialize(id:, created_at:, customer:, end_date:, metadata:, name:, plan:, start_date:, status:)
60
+ # Some parameter documentations has been truncated, see
61
+ # {Orb::Models::SubscriptionListSummaryResponse} for more details.
62
+ #
63
+ # A subscription's own fields, with its plan and customer as references, as listed
64
+ # by List subscription summaries and carried in standard webhook payloads. Fetch
65
+ # the subscription for its price intervals, billing periods, plan phases and other
66
+ # derived fields.
67
+ #
68
+ # @param id [String]
69
+ #
70
+ # @param created_at [Time]
71
+ #
72
+ # @param customer [Orb::Models::CustomerMinified]
73
+ #
74
+ # @param end_date [Time, nil] The date Orb stops billing for this subscription.
75
+ #
76
+ # @param metadata [Hash{Symbol=>String}] User specified key-value pairs for the resource. If not present, this defaults t
77
+ #
78
+ # @param name [String] The name of the subscription.
79
+ #
80
+ # @param plan [Orb::Models::SubscriptionListSummaryResponse::Plan, nil]
81
+ #
82
+ # @param start_date [Time] The date Orb starts billing for this subscription.
83
+ #
84
+ # @param status [Symbol, Orb::Models::SubscriptionListSummaryResponse::Status]
85
+
86
+ # @see Orb::Models::SubscriptionListSummaryResponse#plan
87
+ class Plan < Orb::Internal::Type::BaseModel
88
+ # @!attribute id
89
+ #
90
+ # @return [String, nil]
91
+ required :id, String, nil?: true
92
+
93
+ # @!attribute external_plan_id
94
+ # An optional user-defined ID for this plan resource, used throughout the system
95
+ # as an alias for this Plan. Use this field to identify a plan by an existing
96
+ # identifier in your system.
97
+ #
98
+ # @return [String, nil]
99
+ required :external_plan_id, String, nil?: true
100
+
101
+ # @!attribute name
102
+ #
103
+ # @return [String, nil]
104
+ required :name, String, nil?: true
105
+
106
+ # @!method initialize(id:, external_plan_id:, name:)
107
+ # Some parameter documentations has been truncated, see
108
+ # {Orb::Models::SubscriptionListSummaryResponse::Plan} for more details.
109
+ #
110
+ # @param id [String, nil]
111
+ #
112
+ # @param external_plan_id [String, nil] An optional user-defined ID for this plan resource, used throughout the system a
113
+ #
114
+ # @param name [String, nil]
115
+ end
116
+
117
+ # @see Orb::Models::SubscriptionListSummaryResponse#status
118
+ module Status
119
+ extend Orb::Internal::Type::Enum
120
+
121
+ ACTIVE = :active
122
+ ENDED = :ended
123
+ UPCOMING = :upcoming
124
+
125
+ # @!method self.values
126
+ # @return [Array<Symbol>]
127
+ end
128
+ end
129
+ end
130
+ end
data/lib/orb/models.rb CHANGED
@@ -751,6 +751,8 @@ module Orb
751
751
 
752
752
  SubscriptionListParams = Orb::Models::SubscriptionListParams
753
753
 
754
+ SubscriptionListSummaryParams = Orb::Models::SubscriptionListSummaryParams
755
+
754
756
  SubscriptionMinified = Orb::Models::SubscriptionMinified
755
757
 
756
758
  SubscriptionPlanChangedWebhookEvent = Orb::Models::SubscriptionPlanChangedWebhookEvent
@@ -233,8 +233,9 @@ module Orb
233
233
  # before invoice-level adjustments and credits) denominated in the alert's
234
234
  # currency exceeds predefined thresholds during the current billing cycle;
235
235
  # `price_filters` can scope which prices contribute. Each plan can have one
236
- # `cost_exceeded` alert and one `usage_exceeded` alert per metric that is a part
237
- # of the plan.
236
+ # `cost_exceeded` alert, one `usage_exceeded` alert per metric that is a part of
237
+ # the plan, and up to 50 `spend_exceeded` alerts, one per combination of currency
238
+ # and `price_filters`, so separate products can each have their own spend alert.
238
239
  #
239
240
  # @overload create_for_plan(plan_id, thresholds:, type:, currency: nil, grouping_keys: nil, metric_id: nil, plan_version: nil, price_filters: nil, request_options: {})
240
241
  #
@@ -285,8 +286,10 @@ module Orb
285
286
  # spend (the pricing subtotal, before invoice-level adjustments and credits)
286
287
  # denominated in the alert's currency exceeds predefined thresholds during the
287
288
  # current billing cycle; `price_filters` can scope which prices contribute. Each
288
- # subscription can have one `cost_exceeded` alert and one `usage_exceeded` alert
289
- # per metric that is a part of the subscription.
289
+ # subscription can have one `cost_exceeded` alert, one `usage_exceeded` alert per
290
+ # metric that is a part of the subscription, and up to 50 `spend_exceeded` alerts,
291
+ # one per combination of currency and `price_filters`, so separate products can
292
+ # each have their own spend alert.
290
293
  #
291
294
  # @overload create_for_subscription(subscription_id, thresholds:, type:, currency: nil, grouping_keys: nil, metric_id: nil, price_filters: nil, threshold_overrides: nil, request_options: {})
292
295
  #
@@ -897,6 +897,66 @@ module Orb
897
897
  )
898
898
  end
899
899
 
900
+ # Some parameter documentations has been truncated, see
901
+ # {Orb::Models::SubscriptionListSummaryParams} for more details.
902
+ #
903
+ # This is a lighter-weight version of
904
+ # [List subscriptions](/api-reference/subscription/list-subscriptions), with the
905
+ # same filters, pagination and order. It returns each subscription's own fields,
906
+ # with its plan and customer as references, and leaves out price intervals,
907
+ # billing periods, plan phases and other derived fields, making it faster to
908
+ # respond. Fetch a subscription for those.
909
+ #
910
+ # This is the same summary of a subscription that standard
911
+ # [webhook payloads](/integrations-and-exports/webhook-payload-styles) carry.
912
+ #
913
+ # @overload list_summary(created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, cursor: nil, customer_id: nil, external_customer_id: nil, external_plan_id: nil, limit: nil, plan_id: nil, status: nil, request_options: {})
914
+ #
915
+ # @param created_at_gt [Time, nil]
916
+ #
917
+ # @param created_at_gte [Time, nil]
918
+ #
919
+ # @param created_at_lt [Time, nil]
920
+ #
921
+ # @param created_at_lte [Time, nil]
922
+ #
923
+ # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
924
+ #
925
+ # @param customer_id [String, nil]
926
+ #
927
+ # @param external_customer_id [String, nil]
928
+ #
929
+ # @param external_plan_id [String, nil]
930
+ #
931
+ # @param limit [Integer] The number of items to fetch. Defaults to 20.
932
+ #
933
+ # @param plan_id [String, nil]
934
+ #
935
+ # @param status [Symbol, Orb::Models::SubscriptionListSummaryParams::Status, nil]
936
+ #
937
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
938
+ #
939
+ # @return [Orb::Internal::Page<Orb::Models::SubscriptionListSummaryResponse>]
940
+ #
941
+ # @see Orb::Models::SubscriptionListSummaryParams
942
+ def list_summary(params = {})
943
+ parsed, options = Orb::SubscriptionListSummaryParams.dump_request(params)
944
+ query = Orb::Internal::Util.encode_query_params(parsed)
945
+ @client.request(
946
+ method: :get,
947
+ path: "subscriptions/summary",
948
+ query: query.transform_keys(
949
+ created_at_gt: "created_at[gt]",
950
+ created_at_gte: "created_at[gte]",
951
+ created_at_lt: "created_at[lt]",
952
+ created_at_lte: "created_at[lte]"
953
+ ),
954
+ page: Orb::Internal::Page,
955
+ model: Orb::Models::SubscriptionListSummaryResponse,
956
+ options: options
957
+ )
958
+ end
959
+
900
960
  # Some parameter documentations has been truncated, see
901
961
  # {Orb::Models::SubscriptionPriceIntervalsParams} for more details.
902
962
  #
data/lib/orb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orb
4
- VERSION = "1.48.0"
4
+ VERSION = "1.49.0"
5
5
  end
data/lib/orb.rb CHANGED
@@ -495,6 +495,8 @@ require_relative "orb/models/subscription_invoicing_threshold_exceeded_webhook_e
495
495
  require_relative "orb/models/subscription_license_allocation_reset_webhook_event"
496
496
  require_relative "orb/models/subscription_license_balance_threshold_reached_webhook_event"
497
497
  require_relative "orb/models/subscription_list_params"
498
+ require_relative "orb/models/subscription_list_summary_params"
499
+ require_relative "orb/models/subscription_list_summary_response"
498
500
  require_relative "orb/models/subscription_minified"
499
501
  require_relative "orb/models/subscription_plan_changed_webhook_event"
500
502
  require_relative "orb/models/subscription_plan_change_scheduled_webhook_event"
@@ -0,0 +1,148 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class SubscriptionListSummaryParams < Orb::Internal::Type::BaseModel
6
+ extend Orb::Internal::Type::RequestParameters::Converter
7
+ include Orb::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Orb::SubscriptionListSummaryParams, Orb::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(T.nilable(Time)) }
15
+ attr_accessor :created_at_gt
16
+
17
+ sig { returns(T.nilable(Time)) }
18
+ attr_accessor :created_at_gte
19
+
20
+ sig { returns(T.nilable(Time)) }
21
+ attr_accessor :created_at_lt
22
+
23
+ sig { returns(T.nilable(Time)) }
24
+ attr_accessor :created_at_lte
25
+
26
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
27
+ # from the initial request.
28
+ sig { returns(T.nilable(String)) }
29
+ attr_accessor :cursor
30
+
31
+ sig { returns(T.nilable(String)) }
32
+ attr_accessor :customer_id
33
+
34
+ sig { returns(T.nilable(String)) }
35
+ attr_accessor :external_customer_id
36
+
37
+ sig { returns(T.nilable(String)) }
38
+ attr_accessor :external_plan_id
39
+
40
+ # The number of items to fetch. Defaults to 20.
41
+ sig { returns(T.nilable(Integer)) }
42
+ attr_reader :limit
43
+
44
+ sig { params(limit: Integer).void }
45
+ attr_writer :limit
46
+
47
+ sig { returns(T.nilable(String)) }
48
+ attr_accessor :plan_id
49
+
50
+ sig do
51
+ returns(T.nilable(Orb::SubscriptionListSummaryParams::Status::OrSymbol))
52
+ end
53
+ attr_accessor :status
54
+
55
+ sig do
56
+ params(
57
+ created_at_gt: T.nilable(Time),
58
+ created_at_gte: T.nilable(Time),
59
+ created_at_lt: T.nilable(Time),
60
+ created_at_lte: T.nilable(Time),
61
+ cursor: T.nilable(String),
62
+ customer_id: T.nilable(String),
63
+ external_customer_id: T.nilable(String),
64
+ external_plan_id: T.nilable(String),
65
+ limit: Integer,
66
+ plan_id: T.nilable(String),
67
+ status:
68
+ T.nilable(Orb::SubscriptionListSummaryParams::Status::OrSymbol),
69
+ request_options: Orb::RequestOptions::OrHash
70
+ ).returns(T.attached_class)
71
+ end
72
+ def self.new(
73
+ created_at_gt: nil,
74
+ created_at_gte: nil,
75
+ created_at_lt: nil,
76
+ created_at_lte: nil,
77
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
78
+ # from the initial request.
79
+ cursor: nil,
80
+ customer_id: nil,
81
+ external_customer_id: nil,
82
+ external_plan_id: nil,
83
+ # The number of items to fetch. Defaults to 20.
84
+ limit: nil,
85
+ plan_id: nil,
86
+ status: nil,
87
+ request_options: {}
88
+ )
89
+ end
90
+
91
+ sig do
92
+ override.returns(
93
+ {
94
+ created_at_gt: T.nilable(Time),
95
+ created_at_gte: T.nilable(Time),
96
+ created_at_lt: T.nilable(Time),
97
+ created_at_lte: T.nilable(Time),
98
+ cursor: T.nilable(String),
99
+ customer_id: T.nilable(String),
100
+ external_customer_id: T.nilable(String),
101
+ external_plan_id: T.nilable(String),
102
+ limit: Integer,
103
+ plan_id: T.nilable(String),
104
+ status:
105
+ T.nilable(Orb::SubscriptionListSummaryParams::Status::OrSymbol),
106
+ request_options: Orb::RequestOptions
107
+ }
108
+ )
109
+ end
110
+ def to_hash
111
+ end
112
+
113
+ module Status
114
+ extend Orb::Internal::Type::Enum
115
+
116
+ TaggedSymbol =
117
+ T.type_alias do
118
+ T.all(Symbol, Orb::SubscriptionListSummaryParams::Status)
119
+ end
120
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
121
+
122
+ ACTIVE =
123
+ T.let(
124
+ :active,
125
+ Orb::SubscriptionListSummaryParams::Status::TaggedSymbol
126
+ )
127
+ ENDED =
128
+ T.let(
129
+ :ended,
130
+ Orb::SubscriptionListSummaryParams::Status::TaggedSymbol
131
+ )
132
+ UPCOMING =
133
+ T.let(
134
+ :upcoming,
135
+ Orb::SubscriptionListSummaryParams::Status::TaggedSymbol
136
+ )
137
+
138
+ sig do
139
+ override.returns(
140
+ T::Array[Orb::SubscriptionListSummaryParams::Status::TaggedSymbol]
141
+ )
142
+ end
143
+ def self.values
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,214 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class SubscriptionListSummaryResponse < Orb::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Orb::Models::SubscriptionListSummaryResponse,
10
+ Orb::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :id
16
+
17
+ sig { returns(Time) }
18
+ attr_accessor :created_at
19
+
20
+ sig { returns(Orb::CustomerMinified) }
21
+ attr_reader :customer
22
+
23
+ sig { params(customer: Orb::CustomerMinified::OrHash).void }
24
+ attr_writer :customer
25
+
26
+ # The date Orb stops billing for this subscription.
27
+ sig { returns(T.nilable(Time)) }
28
+ attr_accessor :end_date
29
+
30
+ # User specified key-value pairs for the resource. If not present, this defaults
31
+ # to an empty dictionary. Individual keys can be removed by setting the value to
32
+ # `null`, and the entire metadata mapping can be cleared by setting `metadata` to
33
+ # `null`.
34
+ sig { returns(T::Hash[Symbol, String]) }
35
+ attr_accessor :metadata
36
+
37
+ # The name of the subscription.
38
+ sig { returns(String) }
39
+ attr_accessor :name
40
+
41
+ sig do
42
+ returns(T.nilable(Orb::Models::SubscriptionListSummaryResponse::Plan))
43
+ end
44
+ attr_reader :plan
45
+
46
+ sig do
47
+ params(
48
+ plan:
49
+ T.nilable(
50
+ Orb::Models::SubscriptionListSummaryResponse::Plan::OrHash
51
+ )
52
+ ).void
53
+ end
54
+ attr_writer :plan
55
+
56
+ # The date Orb starts billing for this subscription.
57
+ sig { returns(Time) }
58
+ attr_accessor :start_date
59
+
60
+ sig do
61
+ returns(
62
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
63
+ )
64
+ end
65
+ attr_accessor :status
66
+
67
+ # A subscription's own fields, with its plan and customer as references, as listed
68
+ # by List subscription summaries and carried in standard webhook payloads. Fetch
69
+ # the subscription for its price intervals, billing periods, plan phases and other
70
+ # derived fields.
71
+ sig do
72
+ params(
73
+ id: String,
74
+ created_at: Time,
75
+ customer: Orb::CustomerMinified::OrHash,
76
+ end_date: T.nilable(Time),
77
+ metadata: T::Hash[Symbol, String],
78
+ name: String,
79
+ plan:
80
+ T.nilable(
81
+ Orb::Models::SubscriptionListSummaryResponse::Plan::OrHash
82
+ ),
83
+ start_date: Time,
84
+ status: Orb::Models::SubscriptionListSummaryResponse::Status::OrSymbol
85
+ ).returns(T.attached_class)
86
+ end
87
+ def self.new(
88
+ id:,
89
+ created_at:,
90
+ customer:,
91
+ # The date Orb stops billing for this subscription.
92
+ end_date:,
93
+ # User specified key-value pairs for the resource. If not present, this defaults
94
+ # to an empty dictionary. Individual keys can be removed by setting the value to
95
+ # `null`, and the entire metadata mapping can be cleared by setting `metadata` to
96
+ # `null`.
97
+ metadata:,
98
+ # The name of the subscription.
99
+ name:,
100
+ plan:,
101
+ # The date Orb starts billing for this subscription.
102
+ start_date:,
103
+ status:
104
+ )
105
+ end
106
+
107
+ sig do
108
+ override.returns(
109
+ {
110
+ id: String,
111
+ created_at: Time,
112
+ customer: Orb::CustomerMinified,
113
+ end_date: T.nilable(Time),
114
+ metadata: T::Hash[Symbol, String],
115
+ name: String,
116
+ plan: T.nilable(Orb::Models::SubscriptionListSummaryResponse::Plan),
117
+ start_date: Time,
118
+ status:
119
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
120
+ }
121
+ )
122
+ end
123
+ def to_hash
124
+ end
125
+
126
+ class Plan < Orb::Internal::Type::BaseModel
127
+ OrHash =
128
+ T.type_alias do
129
+ T.any(
130
+ Orb::Models::SubscriptionListSummaryResponse::Plan,
131
+ Orb::Internal::AnyHash
132
+ )
133
+ end
134
+
135
+ sig { returns(T.nilable(String)) }
136
+ attr_accessor :id
137
+
138
+ # An optional user-defined ID for this plan resource, used throughout the system
139
+ # as an alias for this Plan. Use this field to identify a plan by an existing
140
+ # identifier in your system.
141
+ sig { returns(T.nilable(String)) }
142
+ attr_accessor :external_plan_id
143
+
144
+ sig { returns(T.nilable(String)) }
145
+ attr_accessor :name
146
+
147
+ sig do
148
+ params(
149
+ id: T.nilable(String),
150
+ external_plan_id: T.nilable(String),
151
+ name: T.nilable(String)
152
+ ).returns(T.attached_class)
153
+ end
154
+ def self.new(
155
+ id:,
156
+ # An optional user-defined ID for this plan resource, used throughout the system
157
+ # as an alias for this Plan. Use this field to identify a plan by an existing
158
+ # identifier in your system.
159
+ external_plan_id:,
160
+ name:
161
+ )
162
+ end
163
+
164
+ sig do
165
+ override.returns(
166
+ {
167
+ id: T.nilable(String),
168
+ external_plan_id: T.nilable(String),
169
+ name: T.nilable(String)
170
+ }
171
+ )
172
+ end
173
+ def to_hash
174
+ end
175
+ end
176
+
177
+ module Status
178
+ extend Orb::Internal::Type::Enum
179
+
180
+ TaggedSymbol =
181
+ T.type_alias do
182
+ T.all(Symbol, Orb::Models::SubscriptionListSummaryResponse::Status)
183
+ end
184
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
185
+
186
+ ACTIVE =
187
+ T.let(
188
+ :active,
189
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
190
+ )
191
+ ENDED =
192
+ T.let(
193
+ :ended,
194
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
195
+ )
196
+ UPCOMING =
197
+ T.let(
198
+ :upcoming,
199
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
200
+ )
201
+
202
+ sig do
203
+ override.returns(
204
+ T::Array[
205
+ Orb::Models::SubscriptionListSummaryResponse::Status::TaggedSymbol
206
+ ]
207
+ )
208
+ end
209
+ def self.values
210
+ end
211
+ end
212
+ end
213
+ end
214
+ end
data/rbi/orb/models.rbi CHANGED
@@ -813,6 +813,8 @@ module Orb
813
813
 
814
814
  SubscriptionListParams = Orb::Models::SubscriptionListParams
815
815
 
816
+ SubscriptionListSummaryParams = Orb::Models::SubscriptionListSummaryParams
817
+
816
818
  SubscriptionMinified = Orb::Models::SubscriptionMinified
817
819
 
818
820
  SubscriptionPlanChangedWebhookEvent =
@@ -187,8 +187,9 @@ module Orb
187
187
  # before invoice-level adjustments and credits) denominated in the alert's
188
188
  # currency exceeds predefined thresholds during the current billing cycle;
189
189
  # `price_filters` can scope which prices contribute. Each plan can have one
190
- # `cost_exceeded` alert and one `usage_exceeded` alert per metric that is a part
191
- # of the plan.
190
+ # `cost_exceeded` alert, one `usage_exceeded` alert per metric that is a part of
191
+ # the plan, and up to 50 `spend_exceeded` alerts, one per combination of currency
192
+ # and `price_filters`, so separate products can each have their own spend alert.
192
193
  sig do
193
194
  params(
194
195
  plan_id: String,
@@ -243,8 +244,10 @@ module Orb
243
244
  # spend (the pricing subtotal, before invoice-level adjustments and credits)
244
245
  # denominated in the alert's currency exceeds predefined thresholds during the
245
246
  # current billing cycle; `price_filters` can scope which prices contribute. Each
246
- # subscription can have one `cost_exceeded` alert and one `usage_exceeded` alert
247
- # per metric that is a part of the subscription.
247
+ # subscription can have one `cost_exceeded` alert, one `usage_exceeded` alert per
248
+ # metric that is a part of the subscription, and up to 50 `spend_exceeded` alerts,
249
+ # one per combination of currency and `price_filters`, so separate products can
250
+ # each have their own spend alert.
248
251
  sig do
249
252
  params(
250
253
  subscription_id: String,
@@ -923,6 +923,53 @@ module Orb
923
923
  )
924
924
  end
925
925
 
926
+ # This is a lighter-weight version of
927
+ # [List subscriptions](/api-reference/subscription/list-subscriptions), with the
928
+ # same filters, pagination and order. It returns each subscription's own fields,
929
+ # with its plan and customer as references, and leaves out price intervals,
930
+ # billing periods, plan phases and other derived fields, making it faster to
931
+ # respond. Fetch a subscription for those.
932
+ #
933
+ # This is the same summary of a subscription that standard
934
+ # [webhook payloads](/integrations-and-exports/webhook-payload-styles) carry.
935
+ sig do
936
+ params(
937
+ created_at_gt: T.nilable(Time),
938
+ created_at_gte: T.nilable(Time),
939
+ created_at_lt: T.nilable(Time),
940
+ created_at_lte: T.nilable(Time),
941
+ cursor: T.nilable(String),
942
+ customer_id: T.nilable(String),
943
+ external_customer_id: T.nilable(String),
944
+ external_plan_id: T.nilable(String),
945
+ limit: Integer,
946
+ plan_id: T.nilable(String),
947
+ status:
948
+ T.nilable(Orb::SubscriptionListSummaryParams::Status::OrSymbol),
949
+ request_options: Orb::RequestOptions::OrHash
950
+ ).returns(
951
+ Orb::Internal::Page[Orb::Models::SubscriptionListSummaryResponse]
952
+ )
953
+ end
954
+ def list_summary(
955
+ created_at_gt: nil,
956
+ created_at_gte: nil,
957
+ created_at_lt: nil,
958
+ created_at_lte: nil,
959
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
960
+ # from the initial request.
961
+ cursor: nil,
962
+ customer_id: nil,
963
+ external_customer_id: nil,
964
+ external_plan_id: nil,
965
+ # The number of items to fetch. Defaults to 20.
966
+ limit: nil,
967
+ plan_id: nil,
968
+ status: nil,
969
+ request_options: {}
970
+ )
971
+ end
972
+
926
973
  # This endpoint is used to add and edit subscription
927
974
  # [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By
928
975
  # making modifications to a subscription’s price intervals, you can
@@ -0,0 +1,90 @@
1
+ module Orb
2
+ module Models
3
+ type subscription_list_summary_params =
4
+ {
5
+ created_at_gt: Time?,
6
+ created_at_gte: Time?,
7
+ created_at_lt: Time?,
8
+ created_at_lte: Time?,
9
+ cursor: String?,
10
+ customer_id: String?,
11
+ external_customer_id: String?,
12
+ external_plan_id: String?,
13
+ limit: Integer,
14
+ plan_id: String?,
15
+ status: Orb::Models::SubscriptionListSummaryParams::status?
16
+ }
17
+ & Orb::Internal::Type::request_parameters
18
+
19
+ class SubscriptionListSummaryParams < Orb::Internal::Type::BaseModel
20
+ extend Orb::Internal::Type::RequestParameters::Converter
21
+ include Orb::Internal::Type::RequestParameters
22
+
23
+ attr_accessor created_at_gt: Time?
24
+
25
+ attr_accessor created_at_gte: Time?
26
+
27
+ attr_accessor created_at_lt: Time?
28
+
29
+ attr_accessor created_at_lte: Time?
30
+
31
+ attr_accessor cursor: String?
32
+
33
+ attr_accessor customer_id: String?
34
+
35
+ attr_accessor external_customer_id: String?
36
+
37
+ attr_accessor external_plan_id: String?
38
+
39
+ attr_reader limit: Integer?
40
+
41
+ def limit=: (Integer) -> Integer
42
+
43
+ attr_accessor plan_id: String?
44
+
45
+ attr_accessor status: Orb::Models::SubscriptionListSummaryParams::status?
46
+
47
+ def initialize: (
48
+ ?created_at_gt: Time?,
49
+ ?created_at_gte: Time?,
50
+ ?created_at_lt: Time?,
51
+ ?created_at_lte: Time?,
52
+ ?cursor: String?,
53
+ ?customer_id: String?,
54
+ ?external_customer_id: String?,
55
+ ?external_plan_id: String?,
56
+ ?limit: Integer,
57
+ ?plan_id: String?,
58
+ ?status: Orb::Models::SubscriptionListSummaryParams::status?,
59
+ ?request_options: Orb::request_opts
60
+ ) -> void
61
+
62
+ def to_hash: -> {
63
+ created_at_gt: Time?,
64
+ created_at_gte: Time?,
65
+ created_at_lt: Time?,
66
+ created_at_lte: Time?,
67
+ cursor: String?,
68
+ customer_id: String?,
69
+ external_customer_id: String?,
70
+ external_plan_id: String?,
71
+ limit: Integer,
72
+ plan_id: String?,
73
+ status: Orb::Models::SubscriptionListSummaryParams::status?,
74
+ request_options: Orb::RequestOptions
75
+ }
76
+
77
+ type status = :active | :ended | :upcoming
78
+
79
+ module Status
80
+ extend Orb::Internal::Type::Enum
81
+
82
+ ACTIVE: :active
83
+ ENDED: :ended
84
+ UPCOMING: :upcoming
85
+
86
+ def self?.values: -> ::Array[Orb::Models::SubscriptionListSummaryParams::status]
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,94 @@
1
+ module Orb
2
+ module Models
3
+ type subscription_list_summary_response =
4
+ {
5
+ id: String,
6
+ created_at: Time,
7
+ customer: Orb::CustomerMinified,
8
+ end_date: Time?,
9
+ metadata: ::Hash[Symbol, String],
10
+ name: String,
11
+ plan: Orb::Models::SubscriptionListSummaryResponse::Plan?,
12
+ start_date: Time,
13
+ status: Orb::Models::SubscriptionListSummaryResponse::status
14
+ }
15
+
16
+ class SubscriptionListSummaryResponse < Orb::Internal::Type::BaseModel
17
+ attr_accessor id: String
18
+
19
+ attr_accessor created_at: Time
20
+
21
+ attr_accessor customer: Orb::CustomerMinified
22
+
23
+ attr_accessor end_date: Time?
24
+
25
+ attr_accessor metadata: ::Hash[Symbol, String]
26
+
27
+ attr_accessor name: String
28
+
29
+ attr_accessor plan: Orb::Models::SubscriptionListSummaryResponse::Plan?
30
+
31
+ attr_accessor start_date: Time
32
+
33
+ attr_accessor status: Orb::Models::SubscriptionListSummaryResponse::status
34
+
35
+ def initialize: (
36
+ id: String,
37
+ created_at: Time,
38
+ customer: Orb::CustomerMinified,
39
+ end_date: Time?,
40
+ metadata: ::Hash[Symbol, String],
41
+ name: String,
42
+ plan: Orb::Models::SubscriptionListSummaryResponse::Plan?,
43
+ start_date: Time,
44
+ status: Orb::Models::SubscriptionListSummaryResponse::status
45
+ ) -> void
46
+
47
+ def to_hash: -> {
48
+ id: String,
49
+ created_at: Time,
50
+ customer: Orb::CustomerMinified,
51
+ end_date: Time?,
52
+ metadata: ::Hash[Symbol, String],
53
+ name: String,
54
+ plan: Orb::Models::SubscriptionListSummaryResponse::Plan?,
55
+ start_date: Time,
56
+ status: Orb::Models::SubscriptionListSummaryResponse::status
57
+ }
58
+
59
+ type plan = { id: String?, external_plan_id: String?, name: String? }
60
+
61
+ class Plan < Orb::Internal::Type::BaseModel
62
+ attr_accessor id: String?
63
+
64
+ attr_accessor external_plan_id: String?
65
+
66
+ attr_accessor name: String?
67
+
68
+ def initialize: (
69
+ id: String?,
70
+ external_plan_id: String?,
71
+ name: String?
72
+ ) -> void
73
+
74
+ def to_hash: -> {
75
+ id: String?,
76
+ external_plan_id: String?,
77
+ name: String?
78
+ }
79
+ end
80
+
81
+ type status = :active | :ended | :upcoming
82
+
83
+ module Status
84
+ extend Orb::Internal::Type::Enum
85
+
86
+ ACTIVE: :active
87
+ ENDED: :ended
88
+ UPCOMING: :upcoming
89
+
90
+ def self?.values: -> ::Array[Orb::Models::SubscriptionListSummaryResponse::status]
91
+ end
92
+ end
93
+ end
94
+ end
data/sig/orb/models.rbs CHANGED
@@ -687,6 +687,8 @@ module Orb
687
687
 
688
688
  class SubscriptionListParams = Orb::Models::SubscriptionListParams
689
689
 
690
+ class SubscriptionListSummaryParams = Orb::Models::SubscriptionListSummaryParams
691
+
690
692
  class SubscriptionMinified = Orb::Models::SubscriptionMinified
691
693
 
692
694
  class SubscriptionPlanChangedWebhookEvent = Orb::Models::SubscriptionPlanChangedWebhookEvent
@@ -113,6 +113,21 @@ module Orb
113
113
  ?request_options: Orb::request_opts
114
114
  ) -> Orb::Models::subscription_usage
115
115
 
116
+ def list_summary: (
117
+ ?created_at_gt: Time?,
118
+ ?created_at_gte: Time?,
119
+ ?created_at_lt: Time?,
120
+ ?created_at_lte: Time?,
121
+ ?cursor: String?,
122
+ ?customer_id: String?,
123
+ ?external_customer_id: String?,
124
+ ?external_plan_id: String?,
125
+ ?limit: Integer,
126
+ ?plan_id: String?,
127
+ ?status: Orb::Models::SubscriptionListSummaryParams::status?,
128
+ ?request_options: Orb::request_opts
129
+ ) -> Orb::Internal::Page[Orb::Models::SubscriptionListSummaryResponse]
130
+
116
131
  def price_intervals: (
117
132
  String subscription_id,
118
133
  ?add: ::Array[Orb::SubscriptionPriceIntervalsParams::Add],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orb-billing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.48.0
4
+ version: 1.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orb
@@ -510,6 +510,8 @@ files:
510
510
  - lib/orb/models/subscription_license_allocation_reset_webhook_event.rb
511
511
  - lib/orb/models/subscription_license_balance_threshold_reached_webhook_event.rb
512
512
  - lib/orb/models/subscription_list_params.rb
513
+ - lib/orb/models/subscription_list_summary_params.rb
514
+ - lib/orb/models/subscription_list_summary_response.rb
513
515
  - lib/orb/models/subscription_minified.rb
514
516
  - lib/orb/models/subscription_plan_change_scheduled_webhook_event.rb
515
517
  - lib/orb/models/subscription_plan_changed_webhook_event.rb
@@ -1144,6 +1146,8 @@ files:
1144
1146
  - rbi/orb/models/subscription_license_allocation_reset_webhook_event.rbi
1145
1147
  - rbi/orb/models/subscription_license_balance_threshold_reached_webhook_event.rbi
1146
1148
  - rbi/orb/models/subscription_list_params.rbi
1149
+ - rbi/orb/models/subscription_list_summary_params.rbi
1150
+ - rbi/orb/models/subscription_list_summary_response.rbi
1147
1151
  - rbi/orb/models/subscription_minified.rbi
1148
1152
  - rbi/orb/models/subscription_plan_change_scheduled_webhook_event.rbi
1149
1153
  - rbi/orb/models/subscription_plan_changed_webhook_event.rbi
@@ -1777,6 +1781,8 @@ files:
1777
1781
  - sig/orb/models/subscription_license_allocation_reset_webhook_event.rbs
1778
1782
  - sig/orb/models/subscription_license_balance_threshold_reached_webhook_event.rbs
1779
1783
  - sig/orb/models/subscription_list_params.rbs
1784
+ - sig/orb/models/subscription_list_summary_params.rbs
1785
+ - sig/orb/models/subscription_list_summary_response.rbs
1780
1786
  - sig/orb/models/subscription_minified.rbs
1781
1787
  - sig/orb/models/subscription_plan_change_scheduled_webhook_event.rbs
1782
1788
  - sig/orb/models/subscription_plan_changed_webhook_event.rbs