Skip to content

Commit

Permalink
Update generated code for v1187 (#1440)
Browse files Browse the repository at this point in the history
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
  • Loading branch information
stripe-openapi[bot] authored Aug 8, 2024
1 parent 4311405 commit 9c2a7b2
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1154
v1187
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def self.object_names_to_classes
Balance.object_name => Balance,
BalanceTransaction.object_name => BalanceTransaction,
BankAccount.object_name => BankAccount,
Billing::Alert.object_name => Billing::Alert,
Billing::Meter.object_name => Billing::Meter,
Billing::MeterEvent.object_name => Billing::MeterEvent,
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require "stripe/resources/balance"
require "stripe/resources/balance_transaction"
require "stripe/resources/bank_account"
require "stripe/resources/billing/alert"
require "stripe/resources/billing/meter"
require "stripe/resources/billing/meter_event"
require "stripe/resources/billing/meter_event_adjustment"
Expand Down
87 changes: 87 additions & 0 deletions lib/stripe/resources/billing/alert.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Billing
# A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
class Alert < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "billing.alert"
def self.object_name
"billing.alert"
end

# Reactivates this alert, allowing it to trigger again.
def activate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Reactivates this alert, allowing it to trigger again.
def self.activate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# Archives this alert, removing it from the list view and APIs. This is non-reversible.
def archive(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Archives this alert, removing it from the list view and APIs. This is non-reversible.
def self.archive(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# Creates a billing alert
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/billing/alerts", params: params, opts: opts)
end

# Deactivates this alert, preventing it from triggering.
def deactivate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Deactivates this alert, preventing it from triggering.
def self.deactivate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# Lists billing active and inactive alerts
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/billing/alerts", params: filters, opts: opts)
end
end
end
end

0 comments on commit 9c2a7b2

Please sign in to comment.