-
Notifications
You must be signed in to change notification settings - Fork 555
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
New custom_method DSL for defining custom API request methods as static methods #754
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2de8786
to
9883454
Compare
Made the requested changes, ptal @brandur-stripe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome OB! Looks great to me.
@remi-stripe Want to take over the branch to check that I haven't missed any custom methods and add the tests that are missing? |
@ob-stripe Also pushed changes to the tests. |
@ob-stripe I just realized we forgot to do all the namespaced resources like terminal and such too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-assigning to ob to finish reviewing and release
6135b24
to
f063abb
Compare
@ob-stripe turns out I only messed up 2 of them!!!! Re-assigning to you again :p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Released as 4.12.0. |
r? @brandur-stripe @remi-stripe
This PR adds a new
custom_method
DSL that can be used in API resources to define a class method for custom API request methods.custom_method
takes 3 parameters:For instance, on
Stripe::Charge
:is equivalent to:
This should make it easier to transition to static methods and deprecate instance methods (cf. #752).
I've added
custom_method
everywhere where it should apply (though I may have missed some), and added tests for some (not all) of the new methods.I've also added a
Stripe::Discount
class fordiscount
objects.