-
Notifications
You must be signed in to change notification settings - Fork 14
Fix monitor delete method #31
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
Conversation
|
|
||
| monitors = opts[:monitors] || [opts] | ||
| url = "https://cronitor.io/api/monitors" | ||
| url = Cronitor::Monitor::API_URL |
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.
It works in this class method because the string is hardcoded in here.
| attr_reader :key, :api_key, :api_version, :env | ||
|
|
||
| PING_RETRY_THRESHOLD = 3 | ||
| API_URL = 'https://cronitor.io/api/monitors'.freeze |
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.
Is there a need to make this configurable? Something for internal testing/usage for example.
| "https://cronitor.io/p/#{api_key}/#{key}" | ||
| end | ||
|
|
||
| def monitor_api_url |
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.
No longer needed since instance and class methods now just utilize the constant.
|
Anything else needed here? |
|
Hi @nickhammond thanks so much for bringing this up, and my apologies for the slow reply, I had accidentally disabled notifications for this repo. I just released version 5.2.2 which addresses this. However, the intention originally was that .delete should be an instance method not a class method (this aligns with the pattern that the rest of our SDKs follow), so the real bug was that it had been created as a class method. I've fixed that, and will work as documented now. I'm going to close this out, but thank you again for bringing this to my attention! |
|
@aflanagan No worries, thanks for releasing the new version with this fix! |
.deleteis a class method andmonitor_api_urlisn't defined on the class or the config, just on an instance of a monitor. I moved the API URL up to a constant and removed the instance method so that it can be utilized from a class or instance method.You can see the failing call to
deletewhen you run specs locally with an API key, you'll get: