Merge pull request #1477 from stripe/latest-codegen-beta

Update generated code for beta
This commit is contained in:
stripe-openapi[bot] 2024-10-29 16:03:53 -07:00 committed by GitHub
commit f8d2d6d808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 195 additions and 8 deletions

View File

@ -1,9 +1,16 @@
# Changelog
## 13.1.0 - 2024-10-29
* [#1472](https://github.com/stripe/stripe-ruby/pull/1472) Update generated code
* Add support for `submit_card` test helper method on resource `Issuing.Card`
* Add support for new resource `V2.EventDestinations`
* Add support for `create`, `retrieve`, `update`, `list`, `delete`, `disable`, `enable` and `ping` methods on resource `V2.EventDestinations`
* [#1476](https://github.com/stripe/stripe-ruby/pull/1476) Fix APIResource#retrieve bug not returning instance of custom resources
* Fix bug in APIResource#refresh and APIResource#retrieve where they returned an instance of `StripeObject` for custom resources. They should now return the instance of the custom resource.
## 13.1.0-beta.3 - 2024-10-18
* [#1469](https://github.com/stripe/stripe-ruby/pull/1469) Update generated code for beta
## 13.1.0-beta.2 - 2024-10-08
* [#1468](https://github.com/stripe/stripe-ruby/pull/1468) Update generated code for beta
* Add support for `submit_card` test helper method on resource `Issuing.Card`
@ -23,6 +30,17 @@
charge = client.deserialize(resp.data)
```
## 13.0.2 - 2024-10-23
* [#1473](https://github.com/stripe/stripe-ruby/pull/1473) Always return the result of APIResource#refresh in APIResource.retrieve
* Fix bug where we would not return the mutated `self` object when calling `APIResource.retrieve`
## 13.0.1 - 2024-10-18
* [#1471](https://github.com/stripe/stripe-ruby/pull/1471) update object tags for meter-related classes
- fixes a bug where the `object` property of the `MeterEvent`, `MeterEventAdjustment`, and `MeterEventSession` didn't match the server.
* [#1470](https://github.com/stripe/stripe-ruby/pull/1470) Cleaned up examples and added documentation
## 13.0.0 - 2024-10-01
* [#1458](https://github.com/stripe/stripe-ruby/pull/1458) Support for APIs in the new API version 2024-09-30.acacia

View File

@ -1 +1 @@
v1314
v1319

View File

@ -367,7 +367,7 @@ background terminal ([stripe-mock's README][stripe-mock] also contains
instructions for installing via Homebrew and other methods):
```sh
go get -u github.com/stripe/stripe-mock
go install github.com/stripe/stripe-mock@latest
stripe-mock
```

View File

@ -98,7 +98,14 @@ module Stripe
"It is not possible to refresh v2 objects. Please retrieve the object using the StripeClient instead."
end
@requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params)
@obj = @requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params)
initialize_from(
@obj.last_response.data,
@obj.instance_variable_get(:@opts),
@obj.last_response,
api_mode: :v1,
requestor: @requestor
)
end
def self.retrieve(id, opts = {})
@ -110,7 +117,6 @@ module Stripe
opts = Util.normalize_opts(opts)
instance = new(id, opts)
instance.refresh
instance
end
def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})

View File

@ -3,6 +3,6 @@
module Stripe
module ApiVersion
CURRENT = "2024-09-30.acacia"
CURRENT = "2024-10-28.acacia"
end
end

View File

@ -175,6 +175,7 @@ module Stripe
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 object classes: The end of the section generated from our OpenAPI spec
}
end

View File

@ -153,6 +153,7 @@ 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/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"

View File

@ -316,6 +316,26 @@ module Stripe
search(params, opts).auto_paging_each(&blk)
end
# Trigger an external action on a PaymentIntent.
def trigger_action(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test/payment_intents/%<intent>s/trigger_action", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Trigger an external action on a PaymentIntent.
def self.trigger_action(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test/payment_intents/%<intent>s/trigger_action", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Updates properties on a PaymentIntent object without confirming.
#
# Depending on which properties you update, you might need to confirm the

View File

@ -0,0 +1,13 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module V2
class EventDestination < APIResource
OBJECT_NAME = "v2.core.event_destination"
def self.object_name
"v2.core.event_destination"
end
end
end
end

View File

@ -197,6 +197,7 @@ require "stripe/services/v2/billing/meter_event_service"
require "stripe/services/v2/billing/meter_event_session_service"
require "stripe/services/v2/billing/meter_event_stream_service"
require "stripe/services/v2/billing_service"
require "stripe/services/v2/core/event_destination_service"
require "stripe/services/v2/core/event_service"
require "stripe/services/v2/core_service"
require "stripe/services/v2_services"

View File

@ -3,7 +3,7 @@
module Stripe
class AccountLoginLinkService < StripeService
# Creates a single-use login link for a connected account to access the Express Dashboard.
# Creates a login link for a connected account to access the Express Dashboard.
#
# You can only create login links for accounts that use the [Express Dashboard](https://stripe.com/connect/express-dashboard) and are connected to your platform.
def create(account, params = {}, opts = {})

View File

@ -199,6 +199,17 @@ module Stripe
)
end
# Trigger an external action on a PaymentIntent.
def trigger_action(intent, params = {}, opts = {})
request(
method: :post,
path: format("/v1/test/payment_intents/%<intent>s/trigger_action", { intent: CGI.escape(intent) }),
params: params,
opts: opts,
base_address: :api
)
end
# Updates properties on a PaymentIntent object without confirming.
#
# Depending on which properties you update, you might need to confirm the

View File

@ -0,0 +1,98 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module V2
module Core
class EventDestinationService < StripeService
# Create a new event destination.
def create(params = {}, opts = {})
request(
method: :post,
path: "/v2/core/event_destinations",
params: params,
opts: opts,
base_address: :api
)
end
# Delete an event destination.
def delete(id, params = {}, opts = {})
request(
method: :delete,
path: format("/v2/core/event_destinations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
# Disable an event destination.
def disable(id, params = {}, opts = {})
request(
method: :post,
path: format("/v2/core/event_destinations/%<id>s/disable", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
# Enable an event destination.
def enable(id, params = {}, opts = {})
request(
method: :post,
path: format("/v2/core/event_destinations/%<id>s/enable", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
# Lists all event destinations.
def list(params = {}, opts = {})
request(
method: :get,
path: "/v2/core/event_destinations",
params: params,
opts: opts,
base_address: :api
)
end
# Send a `ping` event to an event destination.
def ping(id, params = {}, opts = {})
request(
method: :post,
path: format("/v2/core/event_destinations/%<id>s/ping", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
# Retrieves the details of an event destination.
def retrieve(id, params = {}, opts = {})
request(
method: :get,
path: format("/v2/core/event_destinations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
# Update the details of an event destination.
def update(id, params = {}, opts = {})
request(
method: :post,
path: format("/v2/core/event_destinations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts,
base_address: :api
)
end
end
end
end
end

View File

@ -4,10 +4,11 @@
module Stripe
module V2
class CoreService < StripeService
attr_reader :events
attr_reader :event_destinations, :events
def initialize(requestor)
super(requestor)
@event_destinations = Stripe::V2::Core::EventDestinationService.new(@requestor)
@events = Stripe::V2::Core::EventService.new(@requestor)
end
end

View File

@ -932,6 +932,23 @@ module Stripe
end
end
class CustomStripeObject < APIResource
def self.resource_url
"/v1/custom_stripe_object"
end
end
context "custom class extending APIResource" do
should "return StripeObject instance when calling retrieve" do
stub_request(:get, "#{Stripe.api_base}/v1/custom_stripe_object/id")
.to_return(body: JSON.generate({ id: "id", object: "custom_stripe_object", result: "hello" }))
custom_stripe_object = CustomStripeObject.retrieve("id")
assert_instance_of CustomStripeObject, custom_stripe_object
assert_equal "hello", custom_stripe_object.result
end
end
@@fixtures = {} # rubocop:disable Style/ClassVars
setup do
if @@fixtures.empty?