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

chore: Stop special implementation of Account.persons method. #1069

Merged
merged 2 commits into from
Jun 8, 2022
Merged
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
15 changes: 10 additions & 5 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Account < APIResource

OBJECT_NAME = "account"

custom_method :persons, http_verb: :get
custom_method :reject, http_verb: :post

nested_resource_class_methods :capability,
Expand All @@ -20,6 +21,15 @@ class Account < APIResource
nested_resource_class_methods :person,
operations: %i[create retrieve update delete list]

def persons(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/persons",
params: params,
opts: opts
)
end

def reject(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down Expand Up @@ -60,11 +70,6 @@ def self.retrieve(id = nil, opts = {})
super(id, opts)
end

def persons(params = {}, opts = {})
resp, opts = execute_resource_request(:get, resource_url + "/persons", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

# We are not adding a helper for capabilities here as the Account object
# already has a capabilities property which is a hash and not the sub-list
# of capabilities.
Expand Down