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

Reorder methods with lexographical sort #1347

Merged
merged 3 commits into from
Mar 7, 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
138 changes: 69 additions & 69 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,49 @@ def self.object_name
nested_resource_class_methods :login_link, operations: %i[create]
nested_resource_class_methods :person, operations: %i[create retrieve update delete list]

# 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

# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
def persons(params = {}, opts = {})
request_stripe_object(
Expand All @@ -39,6 +82,16 @@ def persons(params = {}, opts = {})
)
end

# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
def self.persons(account, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
params: params,
opts: opts
)
end

# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
Expand All @@ -51,23 +104,31 @@ def reject(params = {}, opts = {})
)
end

# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
def self.persons(account, params = {}, opts = {})
# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
def self.reject(account, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
method: :post,
path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(account) }),
params: params,
opts: opts
)
end

# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
# 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.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
def self.reject(account, params = {}, opts = {})
# 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/%<account>s/reject", { account: CGI.escape(account) }),
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
Expand Down Expand Up @@ -196,66 +257,5 @@ 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
8 changes: 4 additions & 4 deletions lib/stripe/resources/apple_pay_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ def self.object_name
"apple_pay_domain"
end

def self.resource_url
"/v1/apple_pay/domains"
end

# Create an apple pay domain.
def self.create(params = {}, opts = {})
request_stripe_object(
Expand Down Expand Up @@ -56,5 +52,9 @@ def self.list(filters = {}, opts = {})
opts: opts
)
end

def self.resource_url
"/v1/apple_pay/domains"
end
end
end
10 changes: 5 additions & 5 deletions lib/stripe/resources/apps/secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def self.object_name
"apps.secret"
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

# Deletes a secret from the secret store by name and scope.
def self.delete_where(params = {}, opts = {})
request_stripe_object(
Expand All @@ -41,11 +46,6 @@ def self.find(params = {}, 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)
Expand Down
42 changes: 21 additions & 21 deletions lib/stripe/resources/checkout/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ def self.object_name
"checkout.session"
end

# A Session can be expired when it is in one of these statuses: open
#
# After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
def expire(params = {}, opts = {})
# Creates a Session object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(self["id"]) }),
path: "/v1/checkout/sessions",
params: params,
opts: opts
)
end

# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
# A Session can be expired when it is in one of these statuses: open
#
# After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
def expire(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
method: :post,
path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
Expand All @@ -60,32 +60,32 @@ def self.expire(session, params = {}, opts = {})
)
end

# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(session, params = {}, opts = {})
# Returns a list of Checkout Sessions.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
params: params,
path: "/v1/checkout/sessions",
params: filters,
opts: opts
)
end

# Creates a Session object.
def self.create(params = {}, opts = {})
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/checkout/sessions",
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Returns a list of Checkout Sessions.
def self.list(filters = {}, opts = {})
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(session, params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/checkout/sessions",
params: filters,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
params: params,
opts: opts
)
end
Expand Down
70 changes: 35 additions & 35 deletions lib/stripe/resources/credit_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,27 @@ def self.object_name
"credit_note"
end

# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def void_credit_note(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
# Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces
# its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result
# in any combination of the following:
#
#
# Refund: create a new refund (using refund_amount) or link an existing refund (using refund).
# Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
# Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
#
#
# For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.
#
# You may issue multiple credit notes for an invoice. Each credit note will increment the invoice's pre_payment_credit_notes_amount
# or post_payment_credit_notes_amount depending on its status at the time of credit note creation.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/credit_notes", params: params, opts: opts)
end

# Returns a list of credit notes.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/credit_notes", params: filters, opts: opts)
end

# When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
Expand All @@ -45,44 +58,31 @@ def self.preview(params = {}, opts = {})
)
end

# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def self.void_credit_note(id, params = {}, opts = {})
# Updates an existing credit note.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
path: format("/v1/credit_notes/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end

# Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces
# its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result
# in any combination of the following:
#
#
# Refund: create a new refund (using refund_amount) or link an existing refund (using refund).
# Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
# Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
#
#
# For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.
#
# You may issue multiple credit notes for an invoice. Each credit note will increment the invoice's pre_payment_credit_notes_amount
# or post_payment_credit_notes_amount depending on its status at the time of credit note creation.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/credit_notes", params: params, opts: opts)
end

# Returns a list of credit notes.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/credit_notes", params: filters, opts: opts)
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def void_credit_note(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

# Updates an existing credit note.
def self.update(id, params = {}, opts = {})
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def self.void_credit_note(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s", { id: CGI.escape(id) }),
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
Expand Down
Loading
Loading