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

Make CardError's code parameter named instead of positional #816

Merged
merged 1 commit into from
Jul 30, 2019
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: 1 addition & 2 deletions lib/stripe/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class APIError < StripeError
class CardError < StripeError
attr_reader :param

# TODO: make code a keyword arg in next major release
def initialize(message, param, code, http_status: nil, http_body: nil,
def initialize(message, param, code: nil, http_status: nil, http_body: nil,
json_body: nil, http_headers: nil)
super(message, http_status: http_status, http_body: http_body,
json_body: json_body, http_headers: http_headers,
Expand Down
5 changes: 1 addition & 4 deletions lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,8 @@ def execute_request(method, path,
when 401
AuthenticationError.new(error_data[:message], opts)
when 402
# TODO: modify CardError constructor to make code a keyword argument
# so we don't have to delete it from opts
opts.delete(:code)
CardError.new(
error_data[:message], error_data[:param], error_data[:code],
error_data[:message], error_data[:param],
opts
)
when 403
Expand Down