Skip to content
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

Add validate endpoint to dogapi-rb #127

Merged
merged 2 commits into from
May 1, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/dogapi/v1/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def get_all_monitors(options = {})
request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor", extra_params, nil, false)
end

def monitor_validate(type, query, options = {})
body = {
'type' => type,
'query' => query,
}.merge options

request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/validate", nil, body, true)
end

def mute_monitors
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/mute_all", nil, nil, false)
end
Expand Down
6 changes: 6 additions & 0 deletions spec/integration/monitor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
:get, '/monitor', group_states: %w(custom all), tags: ['test', 'key:value'], name: 'test'
end

describe '#validate_monitor' do
it_behaves_like 'an api method with options',
:monitor, [MONITOR_TYPE, MONITOR_QUERY],
:post, '/monitor', 'type' => MONITOR_TYPE, 'query' => MONITOR_QUERY
end

describe '#mute_monitors' do
it_behaves_like 'an api method',
:mute_monitors, [],
Expand Down