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

Safer attribute assignment #327

Open
brandur opened this issue Oct 8, 2015 · 3 comments
Open

Safer attribute assignment #327

brandur opened this issue Oct 8, 2015 · 3 comments
Labels

Comments

@brandur
Copy link
Contributor

brandur commented Oct 8, 2015

When someone assigns to a StripeObject's attributes with an accessor:

account.email = ...

Or with a mass assignment:

account.update_attributes(
  email: ...
)

We should make an effort to determine that the property assigned is actually one that exists on the resource. This will prevent such problems as a buggy programs assigning to misspelled properties, and then only realizing the mistake much later.

This will probably be done via some kind of machine-readable API manifest as with the testing stubs in #243. Marking as "future".

@brandur brandur added the future label Oct 8, 2015
@kyleconroy
Copy link
Contributor

Agreed with the future tag here, as this is something that we cannot do today. I hesitate to add this feature as it ties stripe-ruby directly to a specific API version. This is probably a larger conversation that we need to have.

@brandur
Copy link
Contributor Author

brandur commented Oct 8, 2015

Agreed with the future tag here, as this is something that we cannot do today. I hesitate to add this feature as it ties stripe-ruby directly to a specific API version. This is probably a larger conversation that we need to have.

+1.

One other thing to consider along the same lines is that if we start programmatically generating methods that map to API calls, we will also run into the same issue. You could have a Ruby method for a call that isn't actually available on your account if your gem is newer than your anchored API version, or vice versa.

One possible approach that would solve both problems is to ship SDKs with a built-in version override so that they always talk to the API version that they're related to.

Definitely part of a larger conversation though!

@brandur
Copy link
Contributor Author

brandur commented Oct 8, 2015

Aside: it's interesting to note as well that the unofficial .NET Stripe SDK already took the approach of pegging an API version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants