Repository navigation
Deprecations - Warn on Domains#get_domain_stats and use one warning format - #405
Merged
Merged
Conversation
Mailgun's API docs mark GET /v3/{domain}/stats/total as deprecated in
favor of the Metrics API, but Domains#get_domain_stats called it without
a warning. Tags#get_tags and Events already warn for their deprecated
APIs.
- Warn on every get_domain_stats call and point to
Mailgun::Metrics#account_metrics
- Note the deprecation in the method comment
- Add a spec for the warning
The gem printed deprecation warnings in four formats, and some were unclear. All 8 Tags methods printed the same line without naming a replacement or the planned removal in 1.5. The Webhooks aliases said they "will be deprecated in future versions of Mailgun", although they are deprecated now and only the gem's old method names are going away. - Add Mailgun::Deprecation.warn, which prints DEPRECATION: "<old>" is deprecated [(<reason>)] [and will be removed in <version>]. Please use "<new>" instead. prefixed with the first caller outside the gem, so the warning points at the code to change rather than at the gem's internals - Use it for Domains#get_domain_stats, Events, all Tags methods, the Webhooks aliases and the MessageBuilder setters - Name each Tags method's replacement and the removal in mailgun-ruby 1.5 - Replace the deprecated MessageBuilder setters in docs/Snippets.md and name Logs#account_logs in docs/Events.md - Add specs for the helper and the Tags warnings; the MessageBuilder specs now check the printed warning instead of stubbing warn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the missing deprecation warning to
Domains#get_domain_stats, and moves every deprecation warning in the gem to one format that names the replacement and points at the caller's code.Missing warning
Mailgun's API docs deprecate three APIs the gem calls.
get_domain_statswas the only wrapper that didn't warn.Domains#get_domain_statsGET /v3/{domain}/stats/totalMetrics#account_metrics)Tags#get_tagsand the otherTagsmethodsGET /v3/{domain}/tagsAnalyticsTags)Events#get,#next,#previousGET /v3/{domain}/eventsLogs#account_logs)One warning format
The new
Mailgun::Deprecation.warnprints:ApiVersionCheckerwrappers, so it points at the line to change.Domains#get_domain_stats,Events, all 8Tagsmethods, the 7Webhooksaliases and the 7MessageBuildersetters. The two plainwarncalls left (the yes/no value hint and the API version check) aren't deprecations.Message changes
Tags: each method now names its replacement (AnalyticsTags#list,#update,#removeorMetrics#account_metrics) and says it will be removed in 1.5, as the existingTODO: remove in v 1.5plans. Before, all 8 printed the same line with no replacement.Webhooksaliases: "will be deprecated in future versions of Mailgun" is now "is deprecated and will be removed in a future version of mailgun-ruby". The aliases are already deprecated, and only the gem's old method names are going away, not the endpoints.MessageBuildersetters: same wording as theWebhooksaliases.Docs
docs/Snippets.mdused the deprecatedset_from_address,set_subject,set_text_bodyandset_message_id; it now usesfrom,subject,body_textandmessage_id.docs/Events.mdnamesLogs#account_logsas the replacement.Testing
Tagswarnings, which had no specs.MessageBuilderdeprecation specs check the printed warning instead of stubbingwarn; theWebhooksandDomainsspecs match the new wording.