orb-billing 1.43.0 → 1.44.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/orb/client.rb +6 -0
- data/lib/orb/models/alert_create_for_plan_params.rb +156 -0
- data/lib/orb/models/dimensional_price_groups/price_create_params.rb +147 -0
- data/lib/orb/models/dimensional_price_groups/price_create_response.rb +19 -0
- data/lib/orb/models/dimensional_price_groups/price_list_params.rb +65 -0
- data/lib/orb/models/plan_created_webhook_event.rb +91 -0
- data/lib/orb/models/plan_edited_webhook_event.rb +131 -0
- data/lib/orb/models/tax_amount.rb +32 -1
- data/lib/orb/models/unwrap_webhook_event.rb +7 -1
- data/lib/orb/models/webhook_endpoint.rb +56 -0
- data/lib/orb/models/webhook_endpoint_create_params.rb +34 -0
- data/lib/orb/models/webhook_endpoint_delete_params.rb +20 -0
- data/lib/orb/models/webhook_endpoint_disable_params.rb +20 -0
- data/lib/orb/models/webhook_endpoint_enable_params.rb +20 -0
- data/lib/orb/models/webhook_endpoint_list_params.rb +34 -0
- data/lib/orb/models/webhook_endpoint_retrieve_params.rb +20 -0
- data/lib/orb/models/webhook_endpoint_update_params.rb +41 -0
- data/lib/orb/models/webhook_endpoint_with_secret.rb +65 -0
- data/lib/orb/models.rb +24 -0
- data/lib/orb/resources/alerts.rb +55 -0
- data/lib/orb/resources/dimensional_price_groups/prices.rb +87 -0
- data/lib/orb/resources/dimensional_price_groups.rb +4 -0
- data/lib/orb/resources/webhook_endpoints.rb +183 -0
- data/lib/orb/resources/webhooks.rb +1 -1
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +17 -0
- data/rbi/orb/client.rbi +5 -0
- data/rbi/orb/models/alert_create_for_plan_params.rbi +290 -0
- data/rbi/orb/models/dimensional_price_groups/price_create_params.rbi +298 -0
- data/rbi/orb/models/dimensional_price_groups/price_create_response.rbi +76 -0
- data/rbi/orb/models/dimensional_price_groups/price_list_params.rbi +134 -0
- data/rbi/orb/models/plan_created_webhook_event.rbi +140 -0
- data/rbi/orb/models/plan_edited_webhook_event.rbi +259 -0
- data/rbi/orb/models/tax_amount.rbi +41 -3
- data/rbi/orb/models/unwrap_webhook_event.rbi +2 -0
- data/rbi/orb/models/webhook_endpoint.rbi +71 -0
- data/rbi/orb/models/webhook_endpoint_create_params.rbi +53 -0
- data/rbi/orb/models/webhook_endpoint_delete_params.rbi +35 -0
- data/rbi/orb/models/webhook_endpoint_disable_params.rbi +35 -0
- data/rbi/orb/models/webhook_endpoint_enable_params.rbi +35 -0
- data/rbi/orb/models/webhook_endpoint_list_params.rbi +56 -0
- data/rbi/orb/models/webhook_endpoint_retrieve_params.rbi +35 -0
- data/rbi/orb/models/webhook_endpoint_update_params.rbi +59 -0
- data/rbi/orb/models/webhook_endpoint_with_secret.rbi +83 -0
- data/rbi/orb/models.rbi +24 -0
- data/rbi/orb/resources/alerts.rbi +59 -0
- data/rbi/orb/resources/dimensional_price_groups/prices.rbi +82 -0
- data/rbi/orb/resources/dimensional_price_groups.rbi +3 -0
- data/rbi/orb/resources/webhook_endpoints.rbi +116 -0
- data/rbi/orb/resources/webhooks.rbi +2 -0
- data/sig/orb/client.rbs +2 -0
- data/sig/orb/models/alert_create_for_plan_params.rbs +126 -0
- data/sig/orb/models/dimensional_price_groups/price_create_params.rbs +123 -0
- data/sig/orb/models/dimensional_price_groups/price_create_response.rbs +15 -0
- data/sig/orb/models/dimensional_price_groups/price_list_params.rbs +61 -0
- data/sig/orb/models/plan_created_webhook_event.rbs +72 -0
- data/sig/orb/models/plan_edited_webhook_event.rbs +116 -0
- data/sig/orb/models/tax_amount.rbs +31 -3
- data/sig/orb/models/unwrap_webhook_event.rbs +2 -0
- data/sig/orb/models/webhook_endpoint.rbs +40 -0
- data/sig/orb/models/webhook_endpoint_create_params.rbs +28 -0
- data/sig/orb/models/webhook_endpoint_delete_params.rbs +23 -0
- data/sig/orb/models/webhook_endpoint_disable_params.rbs +23 -0
- data/sig/orb/models/webhook_endpoint_enable_params.rbs +23 -0
- data/sig/orb/models/webhook_endpoint_list_params.rbs +30 -0
- data/sig/orb/models/webhook_endpoint_retrieve_params.rbs +23 -0
- data/sig/orb/models/webhook_endpoint_update_params.rbs +36 -0
- data/sig/orb/models/webhook_endpoint_with_secret.rbs +45 -0
- data/sig/orb/models.rbs +24 -0
- data/sig/orb/resources/alerts.rbs +12 -0
- data/sig/orb/resources/dimensional_price_groups/prices.rbs +28 -0
- data/sig/orb/resources/dimensional_price_groups.rbs +2 -0
- data/sig/orb/resources/webhook_endpoints.rbs +46 -0
- data/sig/orb/resources/webhooks.rbs +2 -0
- metadata +52 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookEndpointUpdateParams < 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::WebhookEndpointUpdateParams, Orb::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(String) }
|
|
15
|
+
attr_accessor :webhook_endpoint_id
|
|
16
|
+
|
|
17
|
+
# The webhook event types to send to this endpoint. Null sends all event types;
|
|
18
|
+
# omit to leave them unchanged.
|
|
19
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
20
|
+
attr_accessor :enabled_event_types
|
|
21
|
+
|
|
22
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
23
|
+
sig { returns(T.nilable(String)) }
|
|
24
|
+
attr_accessor :url
|
|
25
|
+
|
|
26
|
+
sig do
|
|
27
|
+
params(
|
|
28
|
+
webhook_endpoint_id: String,
|
|
29
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
30
|
+
url: T.nilable(String),
|
|
31
|
+
request_options: Orb::RequestOptions::OrHash
|
|
32
|
+
).returns(T.attached_class)
|
|
33
|
+
end
|
|
34
|
+
def self.new(
|
|
35
|
+
webhook_endpoint_id:,
|
|
36
|
+
# The webhook event types to send to this endpoint. Null sends all event types;
|
|
37
|
+
# omit to leave them unchanged.
|
|
38
|
+
enabled_event_types: nil,
|
|
39
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
40
|
+
url: nil,
|
|
41
|
+
request_options: {}
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
sig do
|
|
46
|
+
override.returns(
|
|
47
|
+
{
|
|
48
|
+
webhook_endpoint_id: String,
|
|
49
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
50
|
+
url: T.nilable(String),
|
|
51
|
+
request_options: Orb::RequestOptions
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
def to_hash
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookEndpointWithSecret < Orb::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Orb::WebhookEndpointWithSecret, Orb::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The Orb-assigned unique identifier for the webhook endpoint.
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
attr_accessor :id
|
|
14
|
+
|
|
15
|
+
# The time the webhook endpoint was created.
|
|
16
|
+
sig { returns(Time) }
|
|
17
|
+
attr_accessor :created_at
|
|
18
|
+
|
|
19
|
+
# Whether Orb sends webhook events to this endpoint.
|
|
20
|
+
sig { returns(T::Boolean) }
|
|
21
|
+
attr_accessor :enabled
|
|
22
|
+
|
|
23
|
+
# The webhook event types sent to this endpoint. If null, all event types are
|
|
24
|
+
# sent.
|
|
25
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
26
|
+
attr_accessor :enabled_event_types
|
|
27
|
+
|
|
28
|
+
# The secret used to sign the webhook events sent to this endpoint. Only returned
|
|
29
|
+
# when the endpoint is created.
|
|
30
|
+
sig { returns(String) }
|
|
31
|
+
attr_accessor :secret
|
|
32
|
+
|
|
33
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
34
|
+
sig { returns(String) }
|
|
35
|
+
attr_accessor :url
|
|
36
|
+
|
|
37
|
+
# A newly created webhook endpoint, along with the secret used to sign its webhook
|
|
38
|
+
# events.
|
|
39
|
+
sig do
|
|
40
|
+
params(
|
|
41
|
+
id: String,
|
|
42
|
+
created_at: Time,
|
|
43
|
+
enabled: T::Boolean,
|
|
44
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
45
|
+
secret: String,
|
|
46
|
+
url: String
|
|
47
|
+
).returns(T.attached_class)
|
|
48
|
+
end
|
|
49
|
+
def self.new(
|
|
50
|
+
# The Orb-assigned unique identifier for the webhook endpoint.
|
|
51
|
+
id:,
|
|
52
|
+
# The time the webhook endpoint was created.
|
|
53
|
+
created_at:,
|
|
54
|
+
# Whether Orb sends webhook events to this endpoint.
|
|
55
|
+
enabled:,
|
|
56
|
+
# The webhook event types sent to this endpoint. If null, all event types are
|
|
57
|
+
# sent.
|
|
58
|
+
enabled_event_types:,
|
|
59
|
+
# The secret used to sign the webhook events sent to this endpoint. Only returned
|
|
60
|
+
# when the endpoint is created.
|
|
61
|
+
secret:,
|
|
62
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
63
|
+
url:
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
sig do
|
|
68
|
+
override.returns(
|
|
69
|
+
{
|
|
70
|
+
id: String,
|
|
71
|
+
created_at: Time,
|
|
72
|
+
enabled: T::Boolean,
|
|
73
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
74
|
+
secret: String,
|
|
75
|
+
url: String
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
def to_hash
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
data/rbi/orb/models.rbi
CHANGED
|
@@ -18,6 +18,8 @@ module Orb
|
|
|
18
18
|
AlertCreateForExternalCustomerParams =
|
|
19
19
|
Orb::Models::AlertCreateForExternalCustomerParams
|
|
20
20
|
|
|
21
|
+
AlertCreateForPlanParams = Orb::Models::AlertCreateForPlanParams
|
|
22
|
+
|
|
21
23
|
AlertCreateForSubscriptionParams =
|
|
22
24
|
Orb::Models::AlertCreateForSubscriptionParams
|
|
23
25
|
|
|
@@ -668,11 +670,15 @@ module Orb
|
|
|
668
670
|
|
|
669
671
|
Plan = Orb::Models::Plan
|
|
670
672
|
|
|
673
|
+
PlanCreatedWebhookEvent = Orb::Models::PlanCreatedWebhookEvent
|
|
674
|
+
|
|
671
675
|
PlanCreateParams = Orb::Models::PlanCreateParams
|
|
672
676
|
|
|
673
677
|
PlanDefaultVersionSetWebhookEvent =
|
|
674
678
|
Orb::Models::PlanDefaultVersionSetWebhookEvent
|
|
675
679
|
|
|
680
|
+
PlanEditedWebhookEvent = Orb::Models::PlanEditedWebhookEvent
|
|
681
|
+
|
|
676
682
|
PlanFetchParams = Orb::Models::PlanFetchParams
|
|
677
683
|
|
|
678
684
|
PlanListParams = Orb::Models::PlanListParams
|
|
@@ -890,5 +896,23 @@ module Orb
|
|
|
890
896
|
|
|
891
897
|
UsageDiscountInterval = Orb::Models::UsageDiscountInterval
|
|
892
898
|
|
|
899
|
+
WebhookEndpoint = Orb::Models::WebhookEndpoint
|
|
900
|
+
|
|
901
|
+
WebhookEndpointCreateParams = Orb::Models::WebhookEndpointCreateParams
|
|
902
|
+
|
|
903
|
+
WebhookEndpointDeleteParams = Orb::Models::WebhookEndpointDeleteParams
|
|
904
|
+
|
|
905
|
+
WebhookEndpointDisableParams = Orb::Models::WebhookEndpointDisableParams
|
|
906
|
+
|
|
907
|
+
WebhookEndpointEnableParams = Orb::Models::WebhookEndpointEnableParams
|
|
908
|
+
|
|
909
|
+
WebhookEndpointListParams = Orb::Models::WebhookEndpointListParams
|
|
910
|
+
|
|
911
|
+
WebhookEndpointRetrieveParams = Orb::Models::WebhookEndpointRetrieveParams
|
|
912
|
+
|
|
913
|
+
WebhookEndpointUpdateParams = Orb::Models::WebhookEndpointUpdateParams
|
|
914
|
+
|
|
915
|
+
WebhookEndpointWithSecret = Orb::Models::WebhookEndpointWithSecret
|
|
916
|
+
|
|
893
917
|
WebhookUnwrapParams = Orb::Models::WebhookUnwrapParams
|
|
894
918
|
end
|
|
@@ -172,6 +172,65 @@ module Orb
|
|
|
172
172
|
)
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
+
# This endpoint is used to create alerts at the plan level. Plan level alerts are
|
|
176
|
+
# automatically propagated to all subscriptions associated with the plan. These
|
|
177
|
+
# alerts are scoped to a specific plan version; if no version is specified, the
|
|
178
|
+
# active plan version is used.
|
|
179
|
+
#
|
|
180
|
+
# Plan level alerts can be of three types: `usage_exceeded`, `cost_exceeded`, or
|
|
181
|
+
# `spend_exceeded`. A `usage_exceeded` alert is scoped to a particular metric and
|
|
182
|
+
# is triggered when the usage of that metric exceeds predefined thresholds during
|
|
183
|
+
# the current billing cycle. A `cost_exceeded` alert is triggered when the total
|
|
184
|
+
# amount due during the current billing cycle surpasses predefined thresholds.
|
|
185
|
+
# `cost_exceeded` alerts do not include burndown of pre-purchase credits. A
|
|
186
|
+
# `spend_exceeded` alert is triggered when the rated spend (the pricing subtotal,
|
|
187
|
+
# before invoice-level adjustments and credits) denominated in the alert's
|
|
188
|
+
# currency exceeds predefined thresholds during the current billing cycle;
|
|
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.
|
|
192
|
+
sig do
|
|
193
|
+
params(
|
|
194
|
+
plan_id: String,
|
|
195
|
+
thresholds: T::Array[Orb::Threshold::OrHash],
|
|
196
|
+
type: Orb::AlertCreateForPlanParams::Type::OrSymbol,
|
|
197
|
+
currency: T.nilable(String),
|
|
198
|
+
grouping_keys: T.nilable(T::Array[String]),
|
|
199
|
+
metric_id: T.nilable(String),
|
|
200
|
+
plan_version: T.nilable(Integer),
|
|
201
|
+
price_filters:
|
|
202
|
+
T.nilable(
|
|
203
|
+
T::Array[Orb::AlertCreateForPlanParams::PriceFilter::OrHash]
|
|
204
|
+
),
|
|
205
|
+
request_options: Orb::RequestOptions::OrHash
|
|
206
|
+
).returns(Orb::Alert)
|
|
207
|
+
end
|
|
208
|
+
def create_for_plan(
|
|
209
|
+
plan_id,
|
|
210
|
+
# The thresholds that define the values at which the alert will be triggered.
|
|
211
|
+
thresholds:,
|
|
212
|
+
# The type of alert to create. This must be a valid alert type.
|
|
213
|
+
type:,
|
|
214
|
+
# The case sensitive currency or custom pricing unit the alert is denominated in.
|
|
215
|
+
# Required for spend_exceeded alerts and when grouping_keys is set.
|
|
216
|
+
currency: nil,
|
|
217
|
+
# The property keys to group cost alerts by. Only applicable for cost_exceeded
|
|
218
|
+
# alerts.
|
|
219
|
+
grouping_keys: nil,
|
|
220
|
+
# The metric to track usage for.
|
|
221
|
+
metric_id: nil,
|
|
222
|
+
# The plan version to create alerts for. If not specified, the default will be the
|
|
223
|
+
# plan's active plan version.
|
|
224
|
+
plan_version: nil,
|
|
225
|
+
# Filters to scope which prices are included in alert evaluation. Supports
|
|
226
|
+
# filtering by price_id, item_id, or price_type with includes/excludes operators.
|
|
227
|
+
# Only applicable to spend_exceeded alerts and to cost_exceeded alerts with
|
|
228
|
+
# grouping_keys set.
|
|
229
|
+
price_filters: nil,
|
|
230
|
+
request_options: {}
|
|
231
|
+
)
|
|
232
|
+
end
|
|
233
|
+
|
|
175
234
|
# This endpoint is used to create alerts at the subscription level.
|
|
176
235
|
#
|
|
177
236
|
# Subscription level alerts can be one of three types: `usage_exceeded`,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
class DimensionalPriceGroups
|
|
6
|
+
class Prices
|
|
7
|
+
# Create prices in a dimensional price group. Every price shares `item_id`,
|
|
8
|
+
# `cadence`, `currency`, and `model_type`. Tiered prices also share tier
|
|
9
|
+
# boundaries; each row supplies its own amounts. The request is one transaction.
|
|
10
|
+
sig do
|
|
11
|
+
params(
|
|
12
|
+
dimensional_price_group_id: String,
|
|
13
|
+
cadence:
|
|
14
|
+
Orb::DimensionalPriceGroups::PriceCreateParams::Cadence::OrSymbol,
|
|
15
|
+
currency: String,
|
|
16
|
+
item_id: String,
|
|
17
|
+
model_type:
|
|
18
|
+
Orb::DimensionalPriceGroups::PriceCreateParams::ModelType::OrSymbol,
|
|
19
|
+
prices:
|
|
20
|
+
T::Array[
|
|
21
|
+
Orb::DimensionalPriceGroups::PriceCreateParams::Price::OrHash
|
|
22
|
+
],
|
|
23
|
+
tiers:
|
|
24
|
+
T.nilable(
|
|
25
|
+
T::Array[
|
|
26
|
+
Orb::DimensionalPriceGroups::PriceCreateParams::Tier::OrHash
|
|
27
|
+
]
|
|
28
|
+
),
|
|
29
|
+
request_options: Orb::RequestOptions::OrHash
|
|
30
|
+
).returns(Orb::Models::DimensionalPriceGroups::PriceCreateResponse)
|
|
31
|
+
end
|
|
32
|
+
def create(
|
|
33
|
+
dimensional_price_group_id,
|
|
34
|
+
# Billing cadence for every price
|
|
35
|
+
cadence:,
|
|
36
|
+
# An ISO 4217 currency string for every price.
|
|
37
|
+
currency:,
|
|
38
|
+
# The item for every price. Must be the group's billable metric item.
|
|
39
|
+
item_id:,
|
|
40
|
+
model_type:,
|
|
41
|
+
prices:,
|
|
42
|
+
# Shared tier boundaries. Required for tiered prices and omitted for unit prices.
|
|
43
|
+
tiers: nil,
|
|
44
|
+
request_options: {}
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# This endpoint returns the prices in a dimensional price group. Subscription
|
|
49
|
+
# overrides are omitted. Archived prices are omitted unless `status` is `archived`
|
|
50
|
+
# or `all`.
|
|
51
|
+
sig do
|
|
52
|
+
params(
|
|
53
|
+
dimensional_price_group_id: String,
|
|
54
|
+
cursor: T.nilable(String),
|
|
55
|
+
limit: Integer,
|
|
56
|
+
status:
|
|
57
|
+
Orb::DimensionalPriceGroups::PriceListParams::Status::OrSymbol,
|
|
58
|
+
request_options: Orb::RequestOptions::OrHash
|
|
59
|
+
).returns(Orb::Internal::Page[Orb::Price::Variants])
|
|
60
|
+
end
|
|
61
|
+
def list(
|
|
62
|
+
dimensional_price_group_id,
|
|
63
|
+
# Cursor for pagination. This can be populated by the `next_cursor` value returned
|
|
64
|
+
# from the initial request.
|
|
65
|
+
cursor: nil,
|
|
66
|
+
# The number of items to fetch. Defaults to 20.
|
|
67
|
+
limit: nil,
|
|
68
|
+
# active omits archived prices. archived returns only archived prices. all returns
|
|
69
|
+
# both.
|
|
70
|
+
status: nil,
|
|
71
|
+
request_options: {}
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @api private
|
|
76
|
+
sig { params(client: Orb::Client).returns(T.attached_class) }
|
|
77
|
+
def self.new(client:)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -10,6 +10,9 @@ module Orb
|
|
|
10
10
|
end
|
|
11
11
|
attr_reader :external_dimensional_price_group_id
|
|
12
12
|
|
|
13
|
+
sig { returns(Orb::Resources::DimensionalPriceGroups::Prices) }
|
|
14
|
+
attr_reader :prices
|
|
15
|
+
|
|
13
16
|
# A dimensional price group is used to partition the result of a billable metric
|
|
14
17
|
# by a set of dimensions. Prices in a price group must specify the partition used
|
|
15
18
|
# to derive their usage.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
# A webhook endpoint is an HTTPS URL that Orb sends
|
|
6
|
+
# [webhook events](/integrations-and-exports/webhooks) to.
|
|
7
|
+
class WebhookEndpoints
|
|
8
|
+
# This endpoint creates a webhook endpoint and returns the secret used to sign its
|
|
9
|
+
# webhook events. The secret isn't returned by any other endpoint. An account can
|
|
10
|
+
# have at most 20 webhook endpoints by default.
|
|
11
|
+
sig do
|
|
12
|
+
params(
|
|
13
|
+
url: String,
|
|
14
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
15
|
+
request_options: Orb::RequestOptions::OrHash
|
|
16
|
+
).returns(Orb::WebhookEndpointWithSecret)
|
|
17
|
+
end
|
|
18
|
+
def create(
|
|
19
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
20
|
+
url:,
|
|
21
|
+
# The webhook event types to send to this endpoint. If omitted or null, all event
|
|
22
|
+
# types are sent.
|
|
23
|
+
enabled_event_types: nil,
|
|
24
|
+
request_options: {}
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# This endpoint returns a webhook endpoint identified by its ID.
|
|
29
|
+
sig do
|
|
30
|
+
params(
|
|
31
|
+
webhook_endpoint_id: String,
|
|
32
|
+
request_options: Orb::RequestOptions::OrHash
|
|
33
|
+
).returns(Orb::WebhookEndpoint)
|
|
34
|
+
end
|
|
35
|
+
def retrieve(webhook_endpoint_id, request_options: {})
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# This endpoint updates a webhook endpoint's URL or the event types sent to it.
|
|
39
|
+
sig do
|
|
40
|
+
params(
|
|
41
|
+
webhook_endpoint_id: String,
|
|
42
|
+
enabled_event_types: T.nilable(T::Array[String]),
|
|
43
|
+
url: T.nilable(String),
|
|
44
|
+
request_options: Orb::RequestOptions::OrHash
|
|
45
|
+
).returns(Orb::WebhookEndpoint)
|
|
46
|
+
end
|
|
47
|
+
def update(
|
|
48
|
+
webhook_endpoint_id,
|
|
49
|
+
# The webhook event types to send to this endpoint. Null sends all event types;
|
|
50
|
+
# omit to leave them unchanged.
|
|
51
|
+
enabled_event_types: nil,
|
|
52
|
+
# The HTTPS URL that Orb sends webhook events to.
|
|
53
|
+
url: nil,
|
|
54
|
+
request_options: {}
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# This endpoint returns the account's webhook endpoints, ordered starting from the
|
|
59
|
+
# most recently created.
|
|
60
|
+
sig do
|
|
61
|
+
params(
|
|
62
|
+
cursor: T.nilable(String),
|
|
63
|
+
limit: Integer,
|
|
64
|
+
request_options: Orb::RequestOptions::OrHash
|
|
65
|
+
).returns(Orb::Internal::Page[Orb::WebhookEndpoint])
|
|
66
|
+
end
|
|
67
|
+
def list(
|
|
68
|
+
# Cursor for pagination. This can be populated by the `next_cursor` value returned
|
|
69
|
+
# from the initial request.
|
|
70
|
+
cursor: nil,
|
|
71
|
+
# The number of items to fetch. Defaults to 20.
|
|
72
|
+
limit: nil,
|
|
73
|
+
request_options: {}
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# This endpoint deletes a webhook endpoint. Orb stops sending webhook events to it
|
|
78
|
+
# immediately.
|
|
79
|
+
sig do
|
|
80
|
+
params(
|
|
81
|
+
webhook_endpoint_id: String,
|
|
82
|
+
request_options: Orb::RequestOptions::OrHash
|
|
83
|
+
).void
|
|
84
|
+
end
|
|
85
|
+
def delete(webhook_endpoint_id, request_options: {})
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# This endpoint disables a webhook endpoint, so Orb stops sending webhook events
|
|
89
|
+
# to it until it is enabled again.
|
|
90
|
+
sig do
|
|
91
|
+
params(
|
|
92
|
+
webhook_endpoint_id: String,
|
|
93
|
+
request_options: Orb::RequestOptions::OrHash
|
|
94
|
+
).returns(Orb::WebhookEndpoint)
|
|
95
|
+
end
|
|
96
|
+
def disable(webhook_endpoint_id, request_options: {})
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# This endpoint enables a webhook endpoint, so Orb resumes sending webhook events
|
|
100
|
+
# to it.
|
|
101
|
+
sig do
|
|
102
|
+
params(
|
|
103
|
+
webhook_endpoint_id: String,
|
|
104
|
+
request_options: Orb::RequestOptions::OrHash
|
|
105
|
+
).returns(Orb::WebhookEndpoint)
|
|
106
|
+
end
|
|
107
|
+
def enable(webhook_endpoint_id, request_options: {})
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# @api private
|
|
111
|
+
sig { params(client: Orb::Client).returns(T.attached_class) }
|
|
112
|
+
def self.new(client:)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -55,7 +55,9 @@ module Orb
|
|
|
55
55
|
Orb::MetricEventsDroppedByWatermarkWebhookEvent,
|
|
56
56
|
Orb::PaymentMethodCreatedWebhookEvent,
|
|
57
57
|
Orb::PaymentMethodDeletedWebhookEvent,
|
|
58
|
+
Orb::PlanCreatedWebhookEvent,
|
|
58
59
|
Orb::PlanDefaultVersionSetWebhookEvent,
|
|
60
|
+
Orb::PlanEditedWebhookEvent,
|
|
59
61
|
Orb::PlanVersionCreatedWebhookEvent,
|
|
60
62
|
Orb::PriceEditedWebhookEvent,
|
|
61
63
|
Orb::ResourceEventTestWebhookEvent,
|
data/sig/orb/client.rbs
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
module Orb
|
|
2
|
+
module Models
|
|
3
|
+
type alert_create_for_plan_params =
|
|
4
|
+
{
|
|
5
|
+
plan_id: String,
|
|
6
|
+
thresholds: ::Array[Orb::Threshold],
|
|
7
|
+
type: Orb::Models::AlertCreateForPlanParams::type_,
|
|
8
|
+
currency: String?,
|
|
9
|
+
grouping_keys: ::Array[String]?,
|
|
10
|
+
metric_id: String?,
|
|
11
|
+
plan_version: Integer?,
|
|
12
|
+
price_filters: ::Array[Orb::AlertCreateForPlanParams::PriceFilter]?
|
|
13
|
+
}
|
|
14
|
+
& Orb::Internal::Type::request_parameters
|
|
15
|
+
|
|
16
|
+
class AlertCreateForPlanParams < Orb::Internal::Type::BaseModel
|
|
17
|
+
extend Orb::Internal::Type::RequestParameters::Converter
|
|
18
|
+
include Orb::Internal::Type::RequestParameters
|
|
19
|
+
|
|
20
|
+
attr_accessor plan_id: String
|
|
21
|
+
|
|
22
|
+
attr_accessor thresholds: ::Array[Orb::Threshold]
|
|
23
|
+
|
|
24
|
+
attr_accessor type: Orb::Models::AlertCreateForPlanParams::type_
|
|
25
|
+
|
|
26
|
+
attr_accessor currency: String?
|
|
27
|
+
|
|
28
|
+
attr_accessor grouping_keys: ::Array[String]?
|
|
29
|
+
|
|
30
|
+
attr_accessor metric_id: String?
|
|
31
|
+
|
|
32
|
+
attr_accessor plan_version: Integer?
|
|
33
|
+
|
|
34
|
+
attr_accessor price_filters: ::Array[Orb::AlertCreateForPlanParams::PriceFilter]?
|
|
35
|
+
|
|
36
|
+
def initialize: (
|
|
37
|
+
plan_id: String,
|
|
38
|
+
thresholds: ::Array[Orb::Threshold],
|
|
39
|
+
type: Orb::Models::AlertCreateForPlanParams::type_,
|
|
40
|
+
?currency: String?,
|
|
41
|
+
?grouping_keys: ::Array[String]?,
|
|
42
|
+
?metric_id: String?,
|
|
43
|
+
?plan_version: Integer?,
|
|
44
|
+
?price_filters: ::Array[Orb::AlertCreateForPlanParams::PriceFilter]?,
|
|
45
|
+
?request_options: Orb::request_opts
|
|
46
|
+
) -> void
|
|
47
|
+
|
|
48
|
+
def to_hash: -> {
|
|
49
|
+
plan_id: String,
|
|
50
|
+
thresholds: ::Array[Orb::Threshold],
|
|
51
|
+
type: Orb::Models::AlertCreateForPlanParams::type_,
|
|
52
|
+
currency: String?,
|
|
53
|
+
grouping_keys: ::Array[String]?,
|
|
54
|
+
metric_id: String?,
|
|
55
|
+
plan_version: Integer?,
|
|
56
|
+
price_filters: ::Array[Orb::AlertCreateForPlanParams::PriceFilter]?,
|
|
57
|
+
request_options: Orb::RequestOptions
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type type_ = :usage_exceeded | :cost_exceeded | :spend_exceeded
|
|
61
|
+
|
|
62
|
+
module Type
|
|
63
|
+
extend Orb::Internal::Type::Enum
|
|
64
|
+
|
|
65
|
+
USAGE_EXCEEDED: :usage_exceeded
|
|
66
|
+
COST_EXCEEDED: :cost_exceeded
|
|
67
|
+
SPEND_EXCEEDED: :spend_exceeded
|
|
68
|
+
|
|
69
|
+
def self?.values: -> ::Array[Orb::Models::AlertCreateForPlanParams::type_]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
type price_filter =
|
|
73
|
+
{
|
|
74
|
+
field: Orb::Models::AlertCreateForPlanParams::PriceFilter::field,
|
|
75
|
+
operator: Orb::Models::AlertCreateForPlanParams::PriceFilter::operator,
|
|
76
|
+
values: ::Array[String]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class PriceFilter < Orb::Internal::Type::BaseModel
|
|
80
|
+
attr_accessor field: Orb::Models::AlertCreateForPlanParams::PriceFilter::field
|
|
81
|
+
|
|
82
|
+
attr_accessor operator: Orb::Models::AlertCreateForPlanParams::PriceFilter::operator
|
|
83
|
+
|
|
84
|
+
attr_accessor values: ::Array[String]
|
|
85
|
+
|
|
86
|
+
def initialize: (
|
|
87
|
+
field: Orb::Models::AlertCreateForPlanParams::PriceFilter::field,
|
|
88
|
+
operator: Orb::Models::AlertCreateForPlanParams::PriceFilter::operator,
|
|
89
|
+
values: ::Array[String]
|
|
90
|
+
) -> void
|
|
91
|
+
|
|
92
|
+
def to_hash: -> {
|
|
93
|
+
field: Orb::Models::AlertCreateForPlanParams::PriceFilter::field,
|
|
94
|
+
operator: Orb::Models::AlertCreateForPlanParams::PriceFilter::operator,
|
|
95
|
+
values: ::Array[String]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
type field =
|
|
99
|
+
:price_id | :item_id | :price_type | :currency | :pricing_unit_id
|
|
100
|
+
|
|
101
|
+
module Field
|
|
102
|
+
extend Orb::Internal::Type::Enum
|
|
103
|
+
|
|
104
|
+
PRICE_ID: :price_id
|
|
105
|
+
ITEM_ID: :item_id
|
|
106
|
+
PRICE_TYPE: :price_type
|
|
107
|
+
CURRENCY: :currency
|
|
108
|
+
PRICING_UNIT_ID: :pricing_unit_id
|
|
109
|
+
|
|
110
|
+
def self?.values: -> ::Array[Orb::Models::AlertCreateForPlanParams::PriceFilter::field]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
type operator = :includes | :excludes
|
|
114
|
+
|
|
115
|
+
module Operator
|
|
116
|
+
extend Orb::Internal::Type::Enum
|
|
117
|
+
|
|
118
|
+
INCLUDES: :includes
|
|
119
|
+
EXCLUDES: :excludes
|
|
120
|
+
|
|
121
|
+
def self?.values: -> ::Array[Orb::Models::AlertCreateForPlanParams::PriceFilter::operator]
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|