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 #1409

Merged
merged 15 commits into from
Jun 27, 2024
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: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ jobs:
run: make ci-test
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_SERVICE_NAME: github-action

publish:
name: Publish
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags
/.bundle/
coverage/
.idea/
.ruby-version
8 changes: 5 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"recommendations": [
"rebornix.ruby",
"misogi.ruby-rubocop",
"EditorConfig.editorconfig"
"EditorConfig.editorconfig", // default
"shopify.ruby-lsp", // intellisense-like support (if you get it working)
"sorbet.sorbet-vscode-extension", // typechecking, where applicable
"LoranKloeze.ruby-rubocop-revived", // linting
"SarahRidge.vscode-ruby-syntax" // Semantic syntax highlighting
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
// Show the repo name in the top window bar.
"window.title": "${rootName}${separator}${activeEditorMedium}",

"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,

Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
# Changelog

## 12.0.0 - 2024-06-24
* [#1418](https://github.com/stripe/stripe-ruby/pull/1418) Add missing static method for verify on BankAccount
* [#1419](https://github.com/stripe/stripe-ruby/pull/1419)

This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading.

### ⚠️ Breaking changes

* Singleton `retrieve` method now requires `params` to be passed as the first argument. Existing calls to singleton `retrieve` method with only `opts` argument will have to be updated to account for the addition of `params` argument.
```ruby
params = { expand: ["available"] }
opts = { stripe_account: "acct_123" }

# ❌ No longer works
Stripe::Balance.retrieve(opts)

# ✅ Correct way to call retrieve method
Stripe::Balance.retrieve(params, opts)
```

### Additions

* Add support for `finalize_amount` test helper method on resource `Issuing.Authorization`

## 11.7.0 - 2024-06-13
* [#1415](https://github.com/stripe/stripe-ruby/pull/1415) Deprecate StripeClient#request
* Add deprecation warning for `StripeClient#request`. This helper method will be removed in a future major version. To access response objects, use the `last_response` property on the returned resource instead. Refer to [Accessing a response object](https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object) in the README for usage details.

## 11.7.0-beta.1 - 2024-05-30
* [#1400](https://github.com/stripe/stripe-ruby/pull/1400) Update generated code for beta
* Keeping up with the changes from version 11.6.0

## 11.6.0 - 2024-05-30
* [#1404](https://github.com/stripe/stripe-ruby/pull/1404) Add method to list invoice line items
* Add methods `list_lines()` on the class `Invoice` to list the invoice line items

## 11.5.0 - 2024-05-23
* This release has no changes.

Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ source "https://rubygems.org"
gemspec

group :development do
gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1"
gem "mocha", "~> 1.16.0"
gem "rack", ">= 2.0.6"
gem "rake"
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1055
v1104
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
[![Build Status](https://github.com/stripe/stripe-ruby/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)

The Stripe Ruby library provides convenient access to the Stripe API from
applications written in the Ruby language. It includes a pre-defined set of
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Stripe
module ApiVersion
CURRENT = "2024-04-10"
PREVIEW = "2024-04-11.preview-v2"
CURRENT = "2024-06-20"
PREVIEW = "2024-05-23.preview-v2"
end
end
43 changes: 27 additions & 16 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module Stripe
# These bank accounts are payment methods on `Customer` objects.
#
# On the other hand [External Accounts](https://stripe.com/api#external_accounts) are transfer
# destinations on `Account` objects for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
# is `application`, which includes [Custom accounts](https://stripe.com/connect/custom-accounts).
# destinations on `Account` objects for connected accounts.
# They can be bank accounts or debit cards as well, and are documented in the links above.
#
# Related guide: [Bank debits and transfers](https://stripe.com/payments/bank-debits-transfers)
Expand All @@ -21,8 +20,21 @@ def self.object_name
end

def verify(params = {}, opts = {})
resp, opts = execute_resource_request(:post, resource_url + "/verify", params, opts)
initialize_from(resp.data, opts)
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end

def self.verify(customer, id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end

def resource_url
Expand Down Expand Up @@ -52,12 +64,12 @@ def self.retrieve(_id, _opts = nil)
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
raise NotImplementedError,
"Bank accounts cannot be deleted without a customer ID or an " \
"account ID. Delete a bank account using " \
"`Customer.delete_source('customer_id', 'bank_account_id')` " \
"or `Account.delete_external_account('account_id', " \
"'bank_account_id')`"
end

def delete(params = {}, opts = {})
Expand All @@ -70,12 +82,11 @@ def delete(params = {}, opts = {})
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
raise NotImplementedError,
"Bank accounts cannot be listed without a customer ID or an " \
"account ID. List bank accounts using " \
"`Customer.list_sources('customer_id')` " \
"or `Account.list_external_accounts('account_id')`"
end
end
end
22 changes: 10 additions & 12 deletions lib/stripe/resources/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def self.retrieve(_id, _opts = nil)
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
raise NotImplementedError,
"Card cannot be deleted without a customer ID or an account " \
"ID. Delete a card using `Customer.delete_source(" \
"'customer_id', 'card_id')` or " \
"`Account.delete_external_account('account_id', 'card_id')`"
end

def delete(params = {}, opts = {})
Expand All @@ -60,12 +59,11 @@ def delete(params = {}, opts = {})
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
raise NotImplementedError,
"Cards cannot be listed without a customer ID or an account " \
"ID. List cards using `Customer.list_sources(" \
"'customer_id')` or " \
"`Account.list_external_accounts('account_id')`"
end
end
end
4 changes: 2 additions & 2 deletions lib/stripe/resources/climate/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.object_name
"climate.order"
end

# Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
# provides 90 days advance notice and refunds the amount_total.
Expand All @@ -28,7 +28,7 @@ def cancel(params = {}, opts = {})
)
end

# Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
# provides 90 days advance notice and refunds the amount_total.
Expand Down
20 changes: 20 additions & 0 deletions lib/stripe/resources/issuing/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ def expire(params = {}, opts = {})
)
end

# Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
def self.finalize_amount(authorization, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/finalize_amount", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts
)
end

# Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
def finalize_amount(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/finalize_amount", { authorization: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end

# Increment a test-mode Authorization.
def self.increment(authorization, params = {}, opts = {})
request_stripe_object(
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/resources/margin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.object_name
"margin"
end

# Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
# Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/billing/margins", params: params, opts: opts)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/resources/setup_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.object_name

# You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
#
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can't cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand All @@ -47,7 +47,7 @@ def cancel(params = {}, opts = {})

# You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
#
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can't cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
def self.cancel(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down
6 changes: 3 additions & 3 deletions lib/stripe/resources/tax/calculation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.object_name
"tax.calculation"
end

# Calculates tax based on input and returns a Tax Calculation object.
# Calculates tax based on the input and returns a Tax Calculation object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand All @@ -24,7 +24,7 @@ def self.create(params = {}, opts = {})
)
end

# Retrieves the line items of a persisted tax calculation as a collection.
# Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
Expand All @@ -34,7 +34,7 @@ def list_line_items(params = {}, opts = {})
)
end

# Retrieves the line items of a persisted tax calculation as a collection.
# Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired.
def self.list_line_items(calculation, params = {}, opts = {})
request_stripe_object(
method: :get,
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/resources/tax/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.object_name
"tax.transaction"
end

# Creates a Tax Transaction from a calculation.
# Creates a Tax Transaction from a calculation, if that calculation hasn't expired. Calculations expire after 90 days.
def self.create_from_calculation(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down
6 changes: 5 additions & 1 deletion lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def connection_manager
# client = StripeClient.new
# charge, resp = client.request { Charge.create }
#

def request
@usage = ["stripe_client_request"]
old_stripe_client = self.class.current_thread_context.active_client
Expand All @@ -211,6 +212,9 @@ def request
self.class.current_thread_context.last_responses.delete(object_id)
end
end
deprecate :request, "the `last_response` property on the returned resource (see " \
"https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object " \
"for usage examples)", 2024, 6

def execute_request(method, path,
api_base: nil, api_key: nil,
Expand Down Expand Up @@ -365,7 +369,7 @@ class ThreadContext
# garbage in `Thread.current`.
attr_accessor :last_responses

# A map of connection mangers for the thread. Normally shared between
# A map of connection managers for the thread. Normally shared between
# all `StripeClient` objects on a particular thread, and created so as to
# minimize the number of open connections that an application needs.
def default_connection_managers
Expand Down
3 changes: 0 additions & 3 deletions sorbet/rbi/annotations/coveralls_reborn.rbi

This file was deleted.

2 changes: 1 addition & 1 deletion sorbet/rbi/gems/[email protected]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions sorbet/rbi/gems/[email protected]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading