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

Merged
merged 5 commits into from
Feb 8, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* Add support for `create` method on resource `Event`
* Add support for `create` and `list` methods on resource `Feature`

## 10.7.1 - 2024-02-05
* [#1320](https://github.com/stripe/stripe-ruby/pull/1320) Remove spurious _search deprecation messages (https://github.com/stripe/stripe-ruby/issues/1319)

## 10.7.0 - 2024-02-01
* [#1317](https://github.com/stripe/stripe-ruby/pull/1317) Remove list method in child resources
* Removes list method mixin from child resources, as these methods always return `InvalidRequestError` and never succeed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gemspec

group :development do
gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1"
gem "mocha", "~> 0.13.2"
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 @@
v808
v810
62 changes: 61 additions & 1 deletion lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Stripe
# account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions),
# some properties are only returned for Custom accounts. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
class Account < APIResource
extend Gem::Deprecate
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
Expand Down Expand Up @@ -195,5 +194,66 @@ def deauthorize(client_id = nil, opts = {})
end
update_hash
end

# With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
# To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
#
# If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
# creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
# You can prefill any information on the account.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts)
end

# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/accounts/%<account>s", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/accounts", params: filters, opts: opts)
end

# Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
# left unchanged.
#
# For Custom accounts, you can update any information on the account. For other accounts, you can update all information until that
# account has started to go through Connect Onboarding. Once you create an [Account Link or <a href="/docs/api/account_sessions">Account Session](https://stripe.com/docs/api/account_links),
# some properties can only be changed or updated for Custom accounts.
#
# To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
# [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
5 changes: 5 additions & 0 deletions lib/stripe/resources/account_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ class AccountLink < APIResource
extend Stripe::APIOperations::Create

OBJECT_NAME = "account_link"

# Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/account_links", params: params, opts: opts)
end
end
end
15 changes: 15 additions & 0 deletions lib/stripe/resources/account_notice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,20 @@ class AccountNotice < APIResource
include Stripe::APIOperations::Save

OBJECT_NAME = "account_notice"

# Retrieves a list of AccountNotice objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/account_notices", params: filters, opts: opts)
end

# Updates an AccountNotice object.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/account_notices/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
5 changes: 5 additions & 0 deletions lib/stripe/resources/account_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ class AccountSession < APIResource
extend Stripe::APIOperations::Create

OBJECT_NAME = "account_session"

# Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/account_sessions", params: params, opts: opts)
end
end
end
40 changes: 40 additions & 0 deletions lib/stripe/resources/apple_pay_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,45 @@ class ApplePayDomain < APIResource
def self.resource_url
"/v1/apple_pay/domains"
end

# Create an apple pay domain.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/apple_pay/domains",
params: params,
opts: opts
)
end

# Delete an apple pay domain.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/apple_pay/domains/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# Delete an apple pay domain.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# List apple pay domains.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/apple_pay/domains",
params: filters,
opts: opts
)
end
end
end
5 changes: 5 additions & 0 deletions lib/stripe/resources/application_fee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ class ApplicationFee < APIResource
OBJECT_NAME = "application_fee"

nested_resource_class_methods :refund, operations: %i[create retrieve update list]

# Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/application_fees", params: filters, opts: opts)
end
end
end
10 changes: 10 additions & 0 deletions lib/stripe/resources/apps/secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def self.find(params = {}, opts = {})
opts: opts
)
end

# Create or replace a secret in the secret store.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
end

# List all secrets stored on the given scope.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/apps/secrets", params: filters, opts: opts)
end
end
end
end
12 changes: 12 additions & 0 deletions lib/stripe/resources/balance_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@ class BalanceTransaction < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "balance_transaction"

# Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
#
# Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/balance_transactions",
params: filters,
opts: opts
)
end
end
end
27 changes: 27 additions & 0 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,32 @@ def self.retrieve(_id, _opts = nil)
"or `Account.retrieve_external_account('account_id', " \
"'bank_account_id')`"
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end

def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: params,
opts: opts
)
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
end
end
end
30 changes: 30 additions & 0 deletions lib/stripe/resources/billing_portal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@ class Configuration < APIResource
include Stripe::APIOperations::Save

OBJECT_NAME = "billing_portal.configuration"

# Creates a configuration that describes the functionality and behavior of a PortalSession
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing_portal/configurations",
params: params,
opts: opts
)
end

# Returns a list of configurations that describe the functionality of the customer portal.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/billing_portal/configurations",
params: filters,
opts: opts
)
end

# Updates a configuration that describes the functionality of the customer portal.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing_portal/configurations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
end
10 changes: 10 additions & 0 deletions lib/stripe/resources/billing_portal/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ class Session < APIResource
extend Stripe::APIOperations::Create

OBJECT_NAME = "billing_portal.session"

# Creates a session of the customer portal.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing_portal/sessions",
params: params,
opts: opts
)
end
end
end
end
10 changes: 10 additions & 0 deletions lib/stripe/resources/capital/financing_offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ def self.mark_delivered(financing_offer, params = {}, opts = {})
opts: opts
)
end

# Retrieves the financing offers available for Connected accounts that belong to your platform.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/capital/financing_offers",
params: filters,
opts: opts
)
end
end
end
end
11 changes: 11 additions & 0 deletions lib/stripe/resources/capital/financing_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ class FinancingTransaction < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "capital.financing_transaction"

# Returns a list of financing transactions. The transactions are returned in sorted order,
# with the most recent transactions appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/capital/financing_transactions",
params: filters,
opts: opts
)
end
end
end
end
27 changes: 27 additions & 0 deletions lib/stripe/resources/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,32 @@ def self.retrieve(_id, _opts = nil)
"'customer_id', 'card_id')` or " \
"`Account.retrieve_external_account('account_id', 'card_id')`"
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end

def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: params,
opts: opts
)
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
end
end
end
Loading
Loading