Skip to content

Commit

Permalink
Bcon/make query optional monitor update (#192)
Browse files Browse the repository at this point in the history
* make query optional

* updated query param as it is optional

* fix some linting errors

* better expression

* new linting problem

* updated version

* removed warn

* version bump

* updated default params and warn message

* oops put the warn in the wrong spot
  • Loading branch information
unclebconnor authored Oct 18, 2019
1 parent 82510d6 commit 07358ed
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/dogapi/v1/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ def monitor(type, query, options = {})
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor", nil, body, true)
end

def update_monitor(monitor_id, query, options)
body = {
'query' => query,
}.merge options
def update_monitor(monitor_id, query = nil, options = {})
body = {}.merge options
unless query.nil?
body = {
'query' => query
}.merge body
warn '[DEPRECATION] query param is not required anymore and should be set to nil.'\
' To update the query, set it in the options parameter instead'
end

request(Net::HTTP::Put, "/api/#{API_VERSION}/monitor/#{monitor_id}", nil, body, true)
end
Expand Down

0 comments on commit 07358ed

Please sign in to comment.