-
Notifications
You must be signed in to change notification settings - Fork 52
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
Deprecate Domain expires_on
in favor of expires_at
#186
Conversation
We deprecated expires_on attribute in our documentation in favor of expires_at. This commit introcuces the new field and removes the old one. It also updates to use the new fixtures.
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.
Please do not make it a breaking changes. We can easily have expires_on
being a getter/setter that reads and writes expires_at, and prints out a warning.
No need to break a client and make it a major bump (especially as we just went through another major bump a few weeks ago).
@duduribeiro my review is not required here, it's not business critical and we've plenty of team members familiar with Ruby. Once the changes I suggested are implemented, feel free to tag someone else as reviewer. As a general rule, the less breaking changes we introduce, the easier will be to merge and ship changes. Otherwise this PR would have had to sit here for long time until we shipped another major review (shipping 2 majors in a month would be a bit unreasonable). |
Removing myself as reviewer until requested changes are implemented. |
@duduribeiro the approach you took of adding the deprecation warnings in the attribute getter and setter triggers the warning building an domain from the response because we are still returning
Is that intended? |
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.
@duduribeiro after looking into this with a fresh 🧠 this morning here are my conclusions:
-
We need to keep both
expires_on
andexpires_on=
. However I would not change their behaviour. That is, I would simply redefine them to add the warning in you introduced on the first place in 0892766. The getter should still return@expires_on
. The setter should still set@expires_on
. They should NOT touch@expires_at
. -
We need to overwrite the initializer in
Dnsimple::Struct::Domain
so we set@expires_on
based on the value ofexpires_at
and so we never callexpires_on=
(first implementation that comes to mind):def initialize(attributes = {}) attributes.delete("expires_on") super @expires_on = Date.parse(expires_at).to_s if expires_at end
With that ☝️ we no longer depend on the value returned from the server and, essentially, we have the same behaviour that we have today, with the extra deprecation warnings.
@@ -16,7 +16,7 @@ module Domains | |||
# client.domains.list(1010, page: 2) | |||
# | |||
# @example List domains, provide a sorting policy | |||
# client.domains.list(1010, sort: "expires_on:asc") | |||
# client.domains.list(1010, sort: "expiration:asc") |
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.
👍
Removing myself as reviewer as there are already 2, though I will keep an eye on the conversation. |
I removed the |
We deprecated expires_on attribute in our documentation in favor of
expires_at. This commit introduces the new field and deprecates the old
one. It also updates to use the new fixtures.
This is not a breaking change, since both old methods still exists.