Skip to content

Commit

Permalink
Avoid a breaking change by keeping expires_on and deprecate it instead
Browse files Browse the repository at this point in the history
  • Loading branch information
duduribeiro committed Jun 8, 2020
1 parent d2c96ba commit 0892766
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/dnsimple/struct/domain.rb
Expand Up @@ -36,7 +36,20 @@ class Domain < Base

# @return [String] When the domain was last updated in DNSimple.
attr_accessor :updated_at
end

# @deprecated Please use #expires_at instead.
# @return [String] The date the domain will expire.
def expires_on
warn "[DEPRECATION] Domain#expires_on is deprecated. Please use `expires_at` instead."
Date.parse(expires_at).to_s if expires_at
end

# @deprecated Please use #expires_at= instead.
# @param expiration_date The date the domain will expire
def expires_on=(expiration_date)
warn "[DEPRECATION] Domain#expires_on= is deprecated. Please use `expires_at=` instead."
expires_at = DateTime.parse(expiration_date) if expiration_date
end
end
end
end
1 change: 1 addition & 0 deletions spec/dnsimple/client/domains_spec.rb
Expand Up @@ -153,6 +153,7 @@
expect(result.auto_renew).to be(false)
expect(result.private_whois).to be(false)
expect(result.expires_at).to eq("2021-06-05T02:15:00Z")
expect(result.expires_on).to eq("2021-06-05")
expect(result.created_at).to eq("2020-06-04T19:15:14Z")
expect(result.updated_at).to eq("2020-06-04T19:15:21Z")
end
Expand Down

0 comments on commit 0892766

Please sign in to comment.