Skip to content

Commit

Permalink
Merge pull request #1122 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
API Updates for beta branch
  • Loading branch information
pakrym-stripe authored Aug 23, 2022
2 parents 2db4fd9 + 486bee1 commit 6711632
Show file tree
Hide file tree
Showing 102 changed files with 570 additions and 16 deletions.
17 changes: 5 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.3

Exclude:
# brandur: Exclude ephmeral script-like files that I use to try and
# reproduce problems with the library. If you know of a better way of doing
# this (e.g. exclude files not tracked by Git), feel free to change it.
- "example_*"

Layout/CaseIndentation:
EnforcedStyle: end

Expand All @@ -19,12 +13,6 @@ Layout/FirstArrayElementIndentation:
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent

# This can be re-enabled once we're 2.3+ only and can use the squiggly heredoc
# operator. Prior to that, Rubocop recommended bringing in a library like
# ActiveSupport to get heredoc indentation, which is just terrible.
Layout/HeredocIndentation:
Enabled: false

Layout/LineLength:
Exclude:
- "lib/stripe/object_types.rb"
Expand Down Expand Up @@ -56,6 +44,11 @@ Metrics/ModuleLength:
Style/AccessModifierDeclarations:
EnforcedStyle: inline

Style/AsciiComments:
AllowedChars:
-
-

Style/FrozenStringLiteralComment:
EnforcedStyle: always

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

## 7.1.0 - 2022-08-19
* [#1116](https://github.com/stripe/stripe-ruby/pull/1116) API Updates
* Add support for new resource `CustomerCashBalanceTransaction`
* [#1118](https://github.com/stripe/stripe-ruby/pull/1118) Update AllowedChars in rubocop config
* [#1117](https://github.com/stripe/stripe-ruby/pull/1117) Refresh rubocop config.
* [#1115](https://github.com/stripe/stripe-ruby/pull/1115) Add a support section to the readme

## 7.1.0-beta.2 - 2022-08-11
* [#1113](https://github.com/stripe/stripe-ruby/pull/1113) API Updates for beta branch
- Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v178
v184
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ The library also provides other features. For example:
- Built-in mechanisms for the serialization of parameters according to the
expectations of Stripe's API.

## Support

New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

## Documentation

See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
Expand Down
4 changes: 1 addition & 3 deletions lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

module Stripe
module ApiVersion
# rubocop:disable Layout/LineLength
CURRENT = "2022-08-01; server_side_confirmation_beta=v1; orders_beta=v4; terminal_interac_refunds_beta=v1"
# rubocop:enable Layout/LineLength
CURRENT = "2022-08-01"
end
end
2 changes: 2 additions & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def self.object_names_to_classes
# business objects
Account::OBJECT_NAME => Account,
AccountLink::OBJECT_NAME => AccountLink,
AccountSession::OBJECT_NAME => AccountSession,
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
ApplicationFee::OBJECT_NAME => ApplicationFee,
ApplicationFeeRefund::OBJECT_NAME => ApplicationFeeRefund,
Expand All @@ -34,6 +35,7 @@ def self.object_names_to_classes
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
Customer::OBJECT_NAME => Customer,
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
CustomerCashBalanceTransaction::OBJECT_NAME => CustomerCashBalanceTransaction,
Discount::OBJECT_NAME => Discount,
Dispute::OBJECT_NAME => Dispute,
EphemeralKey::OBJECT_NAME => EphemeralKey,
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

require "stripe/resources/account"
require "stripe/resources/account_link"
require "stripe/resources/account_session"
require "stripe/resources/apple_pay_domain"
require "stripe/resources/application_fee"
require "stripe/resources/application_fee_refund"
Expand All @@ -23,6 +24,7 @@
require "stripe/resources/credit_note_line_item"
require "stripe/resources/customer"
require "stripe/resources/customer_balance_transaction"
require "stripe/resources/customer_cash_balance_transaction"
require "stripe/resources/discount"
require "stripe/resources/dispute"
require "stripe/resources/ephemeral_key"
Expand Down
6 changes: 6 additions & 0 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# frozen_string_literal: true

module Stripe
# This is an object representing a Stripe account. You can retrieve it to see
# properties on the account like its current e-mail address or if the account is
# enabled yet to make live charges.
#
# Some properties, marked below, are available only to platforms that want to
# [create and manage Express or Custom accounts](https://stripe.com/docs/connect/accounts).
class Account < APIResource
extend Gem::Deprecate
extend Stripe::APIOperations::Create
Expand Down
4 changes: 4 additions & 0 deletions lib/stripe/resources/account_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# frozen_string_literal: true

module Stripe
# Account Links are the means by which a Connect platform grants a connected account permission to access
# Stripe-hosted applications, such as Connect Onboarding.
#
# Related guide: [Connect Onboarding](https://stripe.com/docs/connect/connect-onboarding).
class AccountLink < APIResource
extend Stripe::APIOperations::Create

Expand Down
17 changes: 17 additions & 0 deletions lib/stripe/resources/account_session.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
# An AccountSession allows a Connect platform to grant access to a connected account in Connect Elements.
#
# We recommend that you create an AccountSession each time you need to display an embedded UI
# to your user. Do not save AccountSessions to your database as they expire relatively
# quickly, and cannot be used more than once.
#
# Related guide: [Connect Elements](https://stripe.com/docs/connect/get-started-connect-elements).
class AccountSession < APIResource
extend Stripe::APIOperations::Create

OBJECT_NAME = "account_session"
end
end
5 changes: 5 additions & 0 deletions lib/stripe/resources/application_fee_refund.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# frozen_string_literal: true

module Stripe
# `Application Fee Refund` objects allow you to refund an application fee that
# has previously been created but not yet refunded. Funds will be refunded to
# the Stripe account from which the fee was originally collected.
#
# Related guide: [Refunding Application Fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee).
class ApplicationFeeRefund < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
Expand Down
9 changes: 9 additions & 0 deletions lib/stripe/resources/apps/secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

module Stripe
module Apps
# Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.
#
# The primary resource in Secret Store is a `secret`. Other apps can't view secrets created by an app. Additionally, secrets are scoped to provide further permission control.
#
# All Dashboard users and the app backend share `account` scoped secrets. Use the `account` scope for secrets that don't change per-user, like a third-party API key.
#
# A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
#
# Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects).
class Secret < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
11 changes: 11 additions & 0 deletions lib/stripe/resources/balance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
# frozen_string_literal: true

module Stripe
# This is an object representing your Stripe balance. You can retrieve it to see
# the balance currently on your Stripe account.
#
# You can also retrieve the balance history, which contains a list of
# [transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance
# (charges, payouts, and so forth).
#
# The available and pending amounts for each currency are broken down further by
# payment source types.
#
# Related guide: [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances).
class Balance < SingletonAPIResource
OBJECT_NAME = "balance"
end
Expand Down
4 changes: 4 additions & 0 deletions lib/stripe/resources/balance_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# frozen_string_literal: true

module Stripe
# Balance transactions represent funds moving through your Stripe account.
# They're created for every type of transaction that comes into or flows out of your Stripe account balance.
#
# Related guide: [Balance Transaction Types](https://stripe.com/docs/reports/balance-transaction-types).
class BalanceTransaction < APIResource
extend Stripe::APIOperations::List

Expand Down
7 changes: 7 additions & 0 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# frozen_string_literal: true

module Stripe
# These bank accounts are payment methods on `Customer` objects.
#
# On the other hand [External Accounts](https://stripe.com/docs/api#external_accounts) are transfer
# destinations on `Account` objects for [Custom accounts](https://stripe.com/docs/connect/custom-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/docs/payments/bank-debits-transfers).
class BankAccount < APIResource
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources/billing_portal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

module Stripe
module BillingPortal
# A portal configuration describes the functionality and behavior of a portal session.
class Configuration < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
14 changes: 14 additions & 0 deletions lib/stripe/resources/billing_portal/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@

module Stripe
module BillingPortal
# The Billing customer portal is a Stripe-hosted UI for subscription and
# billing management.
#
# A portal configuration describes the functionality and features that you
# want to provide to your customers through the portal.
#
# A portal session describes the instantiation of the customer portal for
# a particular customer. By visiting the session's URL, the customer
# can manage their subscriptions and billing details. For security reasons,
# sessions are short-lived and will expire if the customer does not visit the URL.
# Create sessions on-demand when customers intend to manage their subscriptions
# and billing details.
#
# Learn more in the [integration guide](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal).
class Session < APIResource
extend Stripe::APIOperations::Create

Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources/capability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

module Stripe
# This is an object representing a capability for a Stripe account.
#
# Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities).
class Capability < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
Expand Down
5 changes: 5 additions & 0 deletions lib/stripe/resources/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# frozen_string_literal: true

module Stripe
# You can store multiple cards on a customer in order to charge the customer
# later. You can also store multiple debit cards on a recipient in order to
# transfer to those cards later.
#
# Related guide: [Card Payments with Sources](https://stripe.com/docs/sources/cards).
class Card < APIResource
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources/cash_balance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

module Stripe
# A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
class CashBalance < APIResource
OBJECT_NAME = "cash_balance"

Expand Down
5 changes: 5 additions & 0 deletions lib/stripe/resources/charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# frozen_string_literal: true

module Stripe
# To charge a credit or a debit card, you create a `Charge` object. You can
# retrieve and refund individual charges as well as list all charges. Charges
# are identified by a unique, random ID.
#
# Related guide: [Accept a payment with the Charges API](https://stripe.com/docs/payments/accept-a-payment-charges).
class Charge < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
14 changes: 14 additions & 0 deletions lib/stripe/resources/checkout/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@

module Stripe
module Checkout
# A Checkout Session represents your customer's session as they pay for
# one-time purchases or subscriptions through [Checkout](https://stripe.com/docs/payments/checkout)
# or [Payment Links](https://stripe.com/docs/payments/payment-links). We recommend creating a
# new Session each time your customer attempts to pay.
#
# Once payment is successful, the Checkout Session will contain a reference
# to the [Customer](https://stripe.com/docs/api/customers), and either the successful
# [PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
# [Subscription](https://stripe.com/docs/api/subscriptions).
#
# You can create a Checkout Session on your server and pass its ID to the
# client to begin Checkout.
#
# Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
class Session < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
6 changes: 6 additions & 0 deletions lib/stripe/resources/country_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# frozen_string_literal: true

module Stripe
# Stripe needs to collect certain pieces of information about each account
# created. These requirements can differ depending on the account's country. The
# Country Specs API makes these rules available to your integration.
#
# You can also view the information from this API call as [an online
# guide](https://stripe.com/docs/connect/required-verification-information).
class CountrySpec < APIResource
extend Stripe::APIOperations::List

Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources/coupon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

module Stripe
# A coupon contains information about a percent-off or amount-off discount you
# might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
# [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
class Coupon < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources/credit_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

module Stripe
# Issue a credit note to adjust an invoice's amount after the invoice is finalized.
#
# Related guide: [Credit Notes](https://stripe.com/docs/billing/invoices/credit-notes).
class CreditNote < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
Expand Down
5 changes: 5 additions & 0 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

module Stripe
# This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.
#
# Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment).
class Customer < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
Expand All @@ -14,6 +17,8 @@ class Customer < APIResource

nested_resource_class_methods :balance_transaction,
operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction,
operations: %i[retrieve list]
nested_resource_class_methods :tax_id,
operations: %i[create retrieve delete list]

Expand Down
6 changes: 6 additions & 0 deletions lib/stripe/resources/customer_balance_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# frozen_string_literal: true

module Stripe
# Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
# which denotes a debit or credit that's automatically applied to their next invoice upon finalization.
# You may modify the value directly by using the [update customer API](https://stripe.com/docs/api/customers/update),
# or by creating a Customer Balance Transaction, which increments or decrements the customer's `balance` by the specified `amount`.
#
# Related guide: [Customer Balance](https://stripe.com/docs/billing/customer/balance) to learn more.
class CustomerBalanceTransaction < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
Expand Down
14 changes: 14 additions & 0 deletions lib/stripe/resources/customer_cash_balance_transaction.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
# Customers with certain payments enabled have a cash balance, representing funds that were paid
# by the customer to a merchant, but have not yet been allocated to a payment. Cash Balance Transactions
# represent when funds are moved into or out of this balance. This includes funding by the customer, allocation
# to payments, and refunds to the customer.
class CustomerCashBalanceTransaction < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "customer_cash_balance_transaction"
end
end
Loading

0 comments on commit 6711632

Please sign in to comment.