Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2025
v2026
2 changes: 1 addition & 1 deletion lib/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
require "stripe/singleton_api_resource"
require "stripe/webhook"
require "stripe/stripe_configuration"
require "stripe/event_notification"
require "stripe/resources/v2/core/event_notification"

# Named API resources
require "stripe/resources"
Expand Down
72 changes: 0 additions & 72 deletions lib/stripe/event_notification.rb

This file was deleted.

19 changes: 19 additions & 0 deletions lib/stripe/events/unknown_event_notification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require "stripe/resources/v2/core/event_notification"

module Stripe
module Events
class UnknownEventNotification < Stripe::V2::Core::EventNotification
attr_reader :related_object

def fetch_related_object
return nil if @related_object.nil?

resp = @client.raw_request(:get, related_object.url, opts: { stripe_context: context },
usage: ["fetch_related_object"])
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Stripe
module Events
# Occurs when a Meter has invalid async usage events.
class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event
class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.billing.meter.error_report_triggered"
end
Expand Down Expand Up @@ -101,7 +101,7 @@ def fetch_related_object
end

# Occurs when a Meter has invalid async usage events.
class V1BillingMeterErrorReportTriggeredEventNotification < Stripe::V2::EventNotification
class V1BillingMeterErrorReportTriggeredEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.billing.meter.error_report_triggered"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/events/v1_billing_meter_no_meter_found_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Stripe
module Events
# Occurs when a Meter's id is missing or invalid in async usage events.
class V1BillingMeterNoMeterFoundEvent < Stripe::V2::Event
class V1BillingMeterNoMeterFoundEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.billing.meter.no_meter_found"
end
Expand Down Expand Up @@ -91,7 +91,7 @@ def self.inner_class_types
end

# Occurs when a Meter's id is missing or invalid in async usage events.
class V1BillingMeterNoMeterFoundEventNotification < Stripe::V2::EventNotification
class V1BillingMeterNoMeterFoundEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.billing.meter.no_meter_found"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/events/v2_core_event_destination_ping_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Stripe
module Events
# A ping event used to test the connection to an EventDestination.
class V2CoreEventDestinationPingEvent < Stripe::V2::Event
class V2CoreEventDestinationPingEvent < Stripe::V2::Core::Event
def self.lookup_type
"v2.core.event_destination.ping"
end
Expand All @@ -22,7 +22,7 @@ def fetch_related_object
end

# A ping event used to test the connection to an EventDestination.
class V2CoreEventDestinationPingEventNotification < Stripe::V2::EventNotification
class V2CoreEventDestinationPingEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v2.core.event_destination.ping"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def self.v2_object_names_to_classes
V2::Billing::MeterEvent.object_name => V2::Billing::MeterEvent,
V2::Billing::MeterEventAdjustment.object_name => V2::Billing::MeterEventAdjustment,
V2::Billing::MeterEventSession.object_name => V2::Billing::MeterEventSession,
V2::Event.object_name => V2::Event,
V2::EventDestination.object_name => V2::EventDestination,
V2::Core::Event.object_name => V2::Core::Event,
V2::Core::EventDestination.object_name => V2::Core::EventDestination,
# v2 object classes: The end of the section generated from our OpenAPI spec
}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@
require "stripe/resources/v2/billing/meter_event"
require "stripe/resources/v2/billing/meter_event_adjustment"
require "stripe/resources/v2/billing/meter_event_session"
require "stripe/resources/v2/core/event"
require "stripe/resources/v2/core/event_destination"
require "stripe/resources/v2/deleted_object"
require "stripe/resources/v2/event"
require "stripe/resources/v2/event_destination"
require "stripe/resources/webhook_endpoint"
require "stripe/events/v1_billing_meter_error_report_triggered_event"
require "stripe/events/v1_billing_meter_no_meter_found_event"
Expand Down
67 changes: 67 additions & 0 deletions lib/stripe/resources/v2/core/event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module V2
module Core
# Events are generated to keep you informed of activity in your business account. APIs in the /v2 namespace generate [thin events](https://docs.stripe.com/event-destinations#benefits-of-thin-events) which have small, unversioned payloads that include a reference to the ID of the object that has changed. The Events v2 API returns these new thin events. [Retrieve the event object](https://docs.stripe.com/event-destinations#fetch-data) for additional data about the event. Use the related object ID in the event payload to [fetch the API resource](https://docs.stripe.com/event-destinations#retrieve-the-object-associated-with-thin-events) of the object associated with the event. Comparatively, events generated by most API v1 include a versioned snapshot of an API object in their payload.
class Event < APIResource
OBJECT_NAME = "v2.core.event"
def self.object_name
"v2.core.event"
end

class Reason < Stripe::StripeObject
class Request < Stripe::StripeObject
# ID of the API request that caused the event.
attr_reader :id
# The idempotency key transmitted during the request.
attr_reader :idempotency_key

def self.inner_class_types
@inner_class_types = {}
end

def self.field_remappings
@field_remappings = {}
end
end
# Event reason type.
attr_reader :type
# Information on the API request that instigated the event.
attr_reader :request

def self.inner_class_types
@inner_class_types = { request: Request }
end

def self.field_remappings
@field_remappings = {}
end
end
# Authentication context needed to fetch the event or related object.
attr_reader :context
# Time at which the object was created.
attr_reader :created
# Unique identifier for the event.
attr_reader :id
# String representing the object's type. Objects of the same type share the same value of the object field.
attr_reader :object
# Reason for the event.
attr_reader :reason
# The type of the event.
attr_reader :type
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode

def self.inner_class_types
@inner_class_types = { reason: Reason }
end

def self.field_remappings
@field_remappings = {}
end
end
end
end
end
119 changes: 119 additions & 0 deletions lib/stripe/resources/v2/core/event_destination.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module V2
module Core
# Set up an event destination to receive events from Stripe across multiple destination types, including [webhook endpoints](https://docs.stripe.com/webhooks) and [Amazon EventBridge](https://docs.stripe.com/event-destinations/eventbridge). Event destinations support receiving [thin events](https://docs.stripe.com/api/v2/events) and [snapshot events](https://docs.stripe.com/api/events).
class EventDestination < APIResource
OBJECT_NAME = "v2.core.event_destination"
def self.object_name
"v2.core.event_destination"
end

class StatusDetails < Stripe::StripeObject
class Disabled < Stripe::StripeObject
# Reason event destination has been disabled.
attr_reader :reason

def self.inner_class_types
@inner_class_types = {}
end

def self.field_remappings
@field_remappings = {}
end
end
# Details about why the event destination has been disabled.
attr_reader :disabled

def self.inner_class_types
@inner_class_types = { disabled: Disabled }
end

def self.field_remappings
@field_remappings = {}
end
end

class AmazonEventbridge < Stripe::StripeObject
# The AWS account ID.
attr_reader :aws_account_id
# The ARN of the AWS event source.
attr_reader :aws_event_source_arn
# The state of the AWS event source.
attr_reader :aws_event_source_status

def self.inner_class_types
@inner_class_types = {}
end

def self.field_remappings
@field_remappings = {}
end
end

class WebhookEndpoint < Stripe::StripeObject
# The signing secret of the webhook endpoint, only includable on creation.
attr_reader :signing_secret
# The URL of the webhook endpoint, includable.
attr_reader :url

def self.inner_class_types
@inner_class_types = {}
end

def self.field_remappings
@field_remappings = {}
end
end
# Time at which the object was created.
attr_reader :created
# An optional description of what the event destination is used for.
attr_reader :description
# The list of events to enable for this endpoint.
attr_reader :enabled_events
# Payload type of events being subscribed to.
attr_reader :event_payload
# Where events should be routed from.
attr_reader :events_from
# Unique identifier for the object.
attr_reader :id
# Metadata.
attr_reader :metadata
# Event destination name.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value of the object field.
attr_reader :object
# If using the snapshot event payload, the API version events are rendered as.
attr_reader :snapshot_api_version
# Status. It can be set to either enabled or disabled.
attr_reader :status
# Additional information about event destination status.
attr_reader :status_details
# Event destination type.
attr_reader :type
# Time at which the object was last updated.
attr_reader :updated
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Amazon EventBridge configuration.
attr_reader :amazon_eventbridge
# Webhook endpoint configuration.
attr_reader :webhook_endpoint

def self.inner_class_types
@inner_class_types = {
status_details: StatusDetails,
amazon_eventbridge: AmazonEventbridge,
webhook_endpoint: WebhookEndpoint,
}
end

def self.field_remappings
@field_remappings = {}
end
end
end
end
end
Loading