Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #1474

Open
wants to merge 7 commits into
base: beta
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## 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`
Expand All @@ -23,6 +22,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

Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1314
v1318
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
1 change: 0 additions & 1 deletion lib/stripe/api_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def self.retrieve(id, opts = {})
opts = Util.normalize_opts(opts)
instance = new(id, opts)
instance.refresh
instance
end

def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Stripe
module ApiVersion
CURRENT = "2024-09-30.acacia"
CURRENT = "2024-10-28.acacia"
end
end
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def self.v2_object_names_to_classes
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
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
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"
20 changes: 20 additions & 0 deletions lib/stripe/resources/payment_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,26 @@ def self.search_auto_paging_each(params = {}, opts = {}, &blk)
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
Expand Down
13 changes: 13 additions & 0 deletions lib/stripe/resources/v2/event_destination.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions lib/stripe/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
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"
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/services/account_login_link_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
11 changes: 11 additions & 0 deletions lib/stripe/services/payment_intent_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ def search(params = {}, opts = {})
)
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
Expand Down
98 changes: 98 additions & 0 deletions lib/stripe/services/v2/core/event_destination_service.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion lib/stripe/services/v2/core_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions test/stripe/api_resource_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,23 @@ def self.object_name
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 Stripe::StripeObject, custom_stripe_object
assert_equal "hello", custom_stripe_object.result
end
end

@@fixtures = {} # rubocop:disable Style/ClassVars
setup do
if @@fixtures.empty?
Expand Down
Loading