dogapi 1.38.0 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.azure-pipelines/all.yml +43 -12
  3. data/.github/CODEOWNERS +10 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +77 -0
  7. data/.github/labeler.yml +5 -0
  8. data/.github/workflows/labeler.yml +11 -0
  9. data/.github/workflows/stale.yml +39 -0
  10. data/.rubocop_todo.yml +30 -32
  11. data/CHANGELOG.md +28 -0
  12. data/CONTRIBUTING.md +111 -0
  13. data/DEVELOPMENT.md +11 -0
  14. data/Gemfile +1 -1
  15. data/Gemfile_1.9 +0 -1
  16. data/LICENSE +21 -20
  17. data/LICENSE-3rdparty.csv +6 -0
  18. data/README.rdoc +14 -0
  19. data/RELEASING.md +46 -0
  20. data/SUPPORT.md +9 -0
  21. data/dogapi.gemspec +2 -0
  22. data/examples/custom_metric.rb +1 -1
  23. data/lib/capistrano/README.md +4 -1
  24. data/lib/capistrano/datadog.rb +8 -4
  25. data/lib/capistrano/datadog/v2.rb +9 -1
  26. data/lib/capistrano/datadog/v3.rb +10 -1
  27. data/lib/dogapi.rb +4 -0
  28. data/lib/dogapi/common.rb +70 -12
  29. data/lib/dogapi/event.rb +4 -0
  30. data/lib/dogapi/facade.rb +99 -8
  31. data/lib/dogapi/metric.rb +4 -0
  32. data/lib/dogapi/v1.rb +6 -0
  33. data/lib/dogapi/v1/alert.rb +4 -0
  34. data/lib/dogapi/v1/aws_integration.rb +4 -0
  35. data/lib/dogapi/v1/aws_logs.rb +4 -0
  36. data/lib/dogapi/v1/azure_integration.rb +4 -0
  37. data/lib/dogapi/v1/comment.rb +4 -0
  38. data/lib/dogapi/v1/dash.rb +10 -4
  39. data/lib/dogapi/v1/dashboard.rb +16 -0
  40. data/lib/dogapi/v1/dashboard_list.rb +4 -0
  41. data/lib/dogapi/v1/embed.rb +4 -0
  42. data/lib/dogapi/v1/event.rb +4 -0
  43. data/lib/dogapi/v1/gcp_integration.rb +4 -0
  44. data/lib/dogapi/v1/hosts.rb +4 -0
  45. data/lib/dogapi/v1/integration.rb +4 -0
  46. data/lib/dogapi/v1/metadata.rb +4 -0
  47. data/lib/dogapi/v1/metric.rb +4 -0
  48. data/lib/dogapi/v1/monitor.rb +6 -2
  49. data/lib/dogapi/v1/screenboard.rb +4 -0
  50. data/lib/dogapi/v1/search.rb +4 -0
  51. data/lib/dogapi/v1/service_check.rb +4 -0
  52. data/lib/dogapi/v1/service_level_objective.rb +113 -0
  53. data/lib/dogapi/v1/snapshot.rb +4 -0
  54. data/lib/dogapi/v1/synthetics.rb +80 -0
  55. data/lib/dogapi/v1/tag.rb +4 -0
  56. data/lib/dogapi/v1/usage.rb +4 -0
  57. data/lib/dogapi/v1/user.rb +4 -0
  58. data/lib/dogapi/v2.rb +4 -0
  59. data/lib/dogapi/v2/dashboard_list.rb +4 -0
  60. data/lib/dogapi/version.rb +5 -1
  61. data/spec/integration/alert_spec.rb +4 -0
  62. data/spec/integration/aws_integration_spec.rb +4 -0
  63. data/spec/integration/aws_logs_spec.rb +4 -0
  64. data/spec/integration/azure_integration_spec.rb +4 -0
  65. data/spec/integration/comment_spec.rb +5 -0
  66. data/spec/integration/common_spec.rb +4 -0
  67. data/spec/integration/dash_spec.rb +7 -1
  68. data/spec/integration/dashboard_list_spec.rb +4 -0
  69. data/spec/integration/dashboard_spec.rb +15 -1
  70. data/spec/integration/embed_spec.rb +4 -0
  71. data/spec/integration/event_spec.rb +5 -0
  72. data/spec/integration/gcp_integration_spec.rb +4 -0
  73. data/spec/integration/integration_spec.rb +4 -0
  74. data/spec/integration/metadata_spec.rb +4 -0
  75. data/spec/integration/metric_spec.rb +4 -0
  76. data/spec/integration/monitor_spec.rb +15 -0
  77. data/spec/integration/screenboard_spec.rb +4 -0
  78. data/spec/integration/search_spec.rb +4 -0
  79. data/spec/integration/service_check_spec.rb +4 -0
  80. data/spec/integration/service_level_objective_spec.rb +73 -0
  81. data/spec/integration/snapshot_spec.rb +4 -0
  82. data/spec/integration/synthetics_spec.rb +131 -0
  83. data/spec/integration/tag_spec.rb +4 -0
  84. data/spec/integration/usage_spec.rb +4 -0
  85. data/spec/integration/user_spec.rb +4 -0
  86. data/spec/spec_helper.rb +17 -1
  87. data/spec/unit/capistrano_spec.rb +4 -0
  88. data/spec/unit/common_spec.rb +50 -0
  89. data/spec/unit/facade_spec.rb +4 -0
  90. metadata +24 -7
@@ -0,0 +1,113 @@
1
+ require 'dogapi'
2
+
3
+ module Dogapi
4
+ class V1 # for namespacing
5
+
6
+ # Implements Service Level Objectives endpoints
7
+ class ServiceLevelObjectiveService < Dogapi::APIService
8
+
9
+ API_VERSION = 'v1'
10
+
11
+ def create_service_level_objective(type, slo_name, thresholds, options = {})
12
+ body = {
13
+ type: type,
14
+ name: slo_name,
15
+ thresholds: thresholds
16
+ }
17
+
18
+ symbolized_options = Dogapi.symbolized_access(options)
19
+ if type.to_s == 'metric'
20
+ body[:query] = {
21
+ numerator: symbolized_options[:numerator],
22
+ denominator: symbolized_options[:denominator]
23
+ }
24
+ else
25
+ body[:monitor_search] = symbolized_options[:monitor_search] if symbolized_options[:monitor_search]
26
+ body[:monitor_ids] = symbolized_options[:monitor_ids] if symbolized_options[:monitor_ids]
27
+ body[:groups] = symbolized_options[:groups] if symbolized_options[:groups]
28
+ end
29
+ body[:tags] = symbolized_options[:tags] if symbolized_options[:tags]
30
+ body[:description] = symbolized_options[:description] if symbolized_options[:description]
31
+
32
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/slo", nil, body, true)
33
+ end
34
+
35
+ def update_service_level_objective(slo_id, type, options = {})
36
+ body = {
37
+ type: type
38
+ }
39
+
40
+ symbolized_options = Dogapi.symbolized_access(options)
41
+ if type == 'metric'
42
+ if symbolized_options[:numerator] && symbolized_options[:denominator]
43
+ body[:query] = {
44
+ numerator: symbolized_options[:numerator],
45
+ denominator: symbolized_options[:denominator]
46
+ }
47
+ end
48
+ else
49
+ body[:monitor_search] = symbolized_options[:monitor_search] if symbolized_options[:monitor_search]
50
+ body[:monitor_ids] = symbolized_options[:monitor_ids] if symbolized_options[:monitor_ids]
51
+ body[:groups] = symbolized_options[:groups] if symbolized_options[:groups]
52
+ end
53
+ [:name, :thresholds, :tags, :description].each do |a|
54
+ body[a] = symbolized_options[a] if symbolized_options[a]
55
+ end
56
+
57
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/slo/#{slo_id}", nil, body, true)
58
+ end
59
+
60
+ def get_service_level_objective(slo_id)
61
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}", nil, nil, false)
62
+ end
63
+
64
+ def search_service_level_objective(slo_ids, query, offset, limit)
65
+ params = {}
66
+ params[:offset] = offset unless offset.nil?
67
+ params[:limit] = limit unless limit.nil?
68
+ if !slo_ids.nil?
69
+ params[:ids] = slo_ids.join(',')
70
+ else
71
+ params[:query] = query
72
+ end
73
+
74
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/", params, nil, false)
75
+ end
76
+
77
+ def delete_service_level_objective(slo_id)
78
+ request(Net::HTTP::Delete, "/api/#{API_VERSION}/slo/#{slo_id}", nil, nil, false)
79
+ end
80
+
81
+ def delete_many_service_level_objective(slo_ids)
82
+ body = {
83
+ ids: slo_ids
84
+ }
85
+ request(Net::HTTP::Delete, "/api/#{API_VERSION}/slo/", nil, body, true)
86
+ end
87
+
88
+ def delete_timeframes_service_level_objective(ops)
89
+ # ops is a hash of slo_id: [<timeframe>] to delete
90
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/slo/bulk_delete", nil, ops, true)
91
+ end
92
+
93
+ def get_service_level_objective_history(slo_id, from_ts, to_ts)
94
+ params = {
95
+ from_ts: from_ts,
96
+ to_ts: to_ts
97
+ }
98
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}/history", params, nil, false)
99
+ end
100
+
101
+ def can_delete_service_level_objective(slo_ids)
102
+ params = {}
103
+ params[:ids] = if slo_ids.is_a? Array
104
+ slo_ids.join(',')
105
+ else
106
+ slo_ids
107
+ end
108
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/can_delete", params, nil, false)
109
+ end
110
+
111
+ end
112
+ end
113
+ end
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -0,0 +1,80 @@
1
+ require 'dogapi'
2
+
3
+ module Dogapi
4
+ class V1 # for namespacing
5
+ # SyntheticsService is the class responsible for dealing with the synthetics
6
+ class SyntheticsService < Dogapi::APIService
7
+
8
+ API_VERSION = 'v1'
9
+
10
+ # Create a synthetics test: POST /v1/synthetics/tests/
11
+ def create_synthetics_test(type, config, options = {})
12
+ body = {
13
+ 'type' => type,
14
+ 'config' => config
15
+ }.merge(options)
16
+
17
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/synthetics/tests", nil, body, true)
18
+ end
19
+
20
+ # Edit a synthetics test: PUT /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>
21
+ def update_synthetics_test(test_id, type, config, options = {})
22
+ body = {
23
+ 'type' => type,
24
+ 'config' => config
25
+ }.merge(options)
26
+
27
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/synthetics/tests/#{test_id}", nil, body, true)
28
+ end
29
+
30
+ # Delete synthetics tests
31
+ def delete_synthetics_tests(test_ids)
32
+ body = {
33
+ 'public_ids' => test_ids
34
+ }
35
+ request(Net::HTTP::Post, "/api/#{API_VERSION}/synthetics/tests/delete", nil, body, true)
36
+ end
37
+
38
+ # Start of pause a synthetics test: POST /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/status
39
+ def start_pause_synthetics_test(test_id, new_status)
40
+ body = {
41
+ 'new_status' => new_status
42
+ }
43
+ request(Net::HTTP::Put, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/status", nil, body, true)
44
+ end
45
+
46
+ # Get all synthetics tests: GET /v1/synthetics/tests
47
+ def get_all_synthetics_tests
48
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests", nil, nil, false)
49
+ end
50
+
51
+ # Get info on a synthetics test: GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>
52
+ def get_synthetics_test(test_id)
53
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}", nil, nil, false)
54
+ end
55
+
56
+ # Get the most recent results for a synthetics test: GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/results
57
+ def get_synthetics_results(test_id)
58
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/results", nil, nil, false)
59
+ end
60
+
61
+ # Get a specific result for a synthetics test:
62
+ # GET /v1/synthetics/tests/<SYNTHETICS_TEST_PUBLIC_ID>/results/<RESULT_ID>
63
+ def get_synthetics_result(test_id, result_id)
64
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/tests/#{test_id}/results/#{result_id}", nil, nil, false)
65
+ end
66
+
67
+ # Get devices for browser checks: GET /v1/synthetics/browser/devices
68
+ def get_synthetics_devices
69
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/browser/devices", nil, nil, false)
70
+ end
71
+
72
+ # Get available locations: GET /v1/synthetics/locations
73
+ def get_synthetics_locations
74
+ request(Net::HTTP::Get, "/api/#{API_VERSION}/synthetics/locations", nil, nil, false)
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+ end
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1 +1,5 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi/v2/dashboard_list'
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'dogapi'
2
6
 
3
7
  module Dogapi
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  module Dogapi
2
- VERSION = '1.38.0'
6
+ VERSION = '1.43.0'
3
7
  end
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,4 +1,9 @@
1
1
  # encoding: utf-8
2
+
3
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
4
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
5
+ # Copyright 2011-Present Datadog, Inc.
6
+
2
7
  require_relative '../spec_helper'
3
8
 
4
9
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::APIService do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -19,12 +23,14 @@ describe Dogapi::Client do
19
23
  'prefix' => 'host',
20
24
  'default' => 'host:my-host'
21
25
  }].freeze
26
+ READ_ONLY = false
22
27
 
23
28
  DASH_BODY = {
24
29
  title: TITLE,
25
30
  description: DESCRIPTION,
26
31
  graphs: GRAPHS,
27
- template_variables: TEMPLATE_VARIABLES
32
+ template_variables: TEMPLATE_VARIABLES,
33
+ read_only: READ_ONLY
28
34
  }.freeze
29
35
  DASH_ARGS = DASH_BODY.values
30
36
 
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -22,6 +26,15 @@ describe Dogapi::Client do
22
26
  'prefix' => 'host',
23
27
  'default' => 'my-host'
24
28
  }].freeze
29
+ TEMPLATE_VARIABLE_PRESETS = [{
30
+ 'name' => 'preset1',
31
+ 'template_variables' => [
32
+ {
33
+ 'name' => 'host1',
34
+ 'value' => 'my-host'
35
+ }
36
+ ]
37
+ }].freeze
25
38
 
26
39
  REQUIRED_ARGS = {
27
40
  title: TITLE,
@@ -33,7 +46,8 @@ describe Dogapi::Client do
33
46
  description: DESCRIPTION,
34
47
  is_read_only: IS_READ_ONLY,
35
48
  notify_list: NOTIFY_LIST,
36
- template_variables: TEMPLATE_VARIABLES
49
+ template_variables: TEMPLATE_VARIABLES,
50
+ template_variable_presets: TEMPLATE_VARIABLE_PRESETS
37
51
  }
38
52
  DASHBOARD_ARGS = REQUIRED_ARGS.values + [OPTIONS]
39
53
  DASHBOARD_PAYLOAD = REQUIRED_ARGS.merge(OPTIONS)
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,4 +1,9 @@
1
1
  # encoding: utf-8
2
+
3
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
4
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
5
+ # Copyright 2011-Present Datadog, Inc.
6
+
2
7
  require_relative '../spec_helper'
3
8
 
4
9
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require_relative '../spec_helper'
2
6
 
3
7
  describe Dogapi::Client do
@@ -47,6 +51,17 @@ describe Dogapi::Client do
47
51
  :delete, "/monitor/#{MONITOR_ID}"
48
52
  end
49
53
 
54
+ describe '#delete_monitor with options' do
55
+ it 'queries the api with options' do
56
+ url = api_url + "/monitor/#{MONITOR_ID}?force=true"
57
+ options = { 'force' => true }
58
+ stub_request(:delete, url).to_return(body: '{}').then.to_raise(StandardError)
59
+ expect(dog.send(:delete_monitor, MONITOR_ID, options)).to eq ['200', {}]
60
+
61
+ expect(WebMock).to have_requested(:delete, url)
62
+ end
63
+ end
64
+
50
65
  describe '#get_all_monitors' do
51
66
  it_behaves_like 'an api method with optional params',
52
67
  :get_all_monitors, [],