doggy 2.0.42 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Doggy
4
5
  module Models
@@ -26,9 +27,7 @@ module Doggy
26
27
  end
27
28
 
28
29
  def self.resource_url(id = nil)
29
- "https://app.datadoghq.com/api/v1/dash".tap do |base_url|
30
- base_url << "/#{ id }" if id
31
- end
30
+ "https://app.datadoghq.com/api/v1/dash/#{id}"
32
31
  end
33
32
 
34
33
  def managed?
@@ -37,12 +36,12 @@ module Doggy
37
36
 
38
37
  def ensure_managed_emoji!
39
38
  return unless managed?
40
- return if self.title =~ /\xF0\x9F\x90\xB6/
39
+ return if title =~ /\xF0\x9F\x90\xB6/
41
40
  self.title += " \xF0\x9F\x90\xB6"
42
41
  end
43
42
 
44
43
  def human_url
45
- "https://#{Doggy.base_human_url}/dash/#{ id }"
44
+ "https://#{Doggy.base_human_url}/dash/#{id}"
46
45
  end
47
46
 
48
47
  # Dashboards don't have a direct edit URL
@@ -50,4 +49,3 @@ module Doggy
50
49
  end # Dashboard
51
50
  end # Models
52
51
  end # Doggy
53
-
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Doggy
4
5
  module Models
@@ -38,7 +39,7 @@ module Doggy
38
39
 
39
40
  def ensure_read_only!
40
41
  if options
41
- self.options.locked = true
42
+ options.locked = true
42
43
  else
43
44
  self.options = Options.new(locked: true)
44
45
  end
@@ -46,16 +47,14 @@ module Doggy
46
47
 
47
48
  def refute_read_only!
48
49
  if options
49
- self.options.locked = false
50
+ options.locked = false
50
51
  else
51
52
  self.options = Options.new(locked: false)
52
53
  end
53
54
  end
54
55
 
55
56
  def self.resource_url(id = nil)
56
- "https://app.datadoghq.com/api/v1/monitor".tap do |base_url|
57
- base_url << "/#{ id }" if id
58
- end
57
+ "https://app.datadoghq.com/api/v1/monitor/#{id}"
59
58
  end
60
59
 
61
60
  def managed?
@@ -64,7 +63,7 @@ module Doggy
64
63
 
65
64
  def ensure_managed_emoji!
66
65
  return unless managed?
67
- return if self.name =~ /\xF0\x9F\x90\xB6/
66
+ return if name =~ /\xF0\x9F\x90\xB6/
68
67
  self.name += " \xF0\x9F\x90\xB6"
69
68
  end
70
69
 
@@ -72,9 +71,9 @@ module Doggy
72
71
  ensure_renotify_interval_valid
73
72
  end
74
73
 
75
- def toggle_mute!(action, body=nil)
76
- return unless ['mute', 'unmute'].include?(action) && id
77
- attributes = request(:post, "#{ resource_url(id) }/#{action}", body)
74
+ def toggle_mute!(action, body = nil)
75
+ return unless %w[mute unmute].include?(action) && id
76
+ attributes = request(:post, "#{resource_url(id)}/#{action}", body)
78
77
  if message = attributes['errors']
79
78
  Doggy.ui.error(message)
80
79
  else
@@ -87,11 +86,11 @@ module Doggy
87
86
  end
88
87
 
89
88
  def human_url
90
- "https://#{Doggy.base_human_url}/monitors##{ id }"
89
+ "https://#{Doggy.base_human_url}/monitors##{id}"
91
90
  end
92
91
 
93
92
  def human_edit_url
94
- "https://#{Doggy.base_human_url}/monitors##{ id }/edit"
93
+ "https://#{Doggy.base_human_url}/monitors##{id}/edit"
95
94
  end
96
95
 
97
96
  def to_h
@@ -101,14 +100,13 @@ module Doggy
101
100
  private
102
101
 
103
102
  def ensure_renotify_interval_valid
104
- return unless options && options.renotify_interval && options.renotify_interval.to_i > 0
103
+ return unless options&.renotify_interval && options.renotify_interval.to_i > 0
105
104
 
106
- allowed_renotify_intervals = [10,20,30,40,50,60,90,120,180,240,300,360,720,1440] # minutes
105
+ allowed_renotify_intervals = [10, 20, 30, 40, 50, 60, 90, 120, 180, 240, 300, 360, 720, 1440] # minutes
107
106
  best_matching_interval = allowed_renotify_intervals.min_by { |x| (x.to_f - options.renotify_interval).abs }
108
- puts "WARN: Monitor #{self.id} uses invalid escalation interval (renotify_interval) #{options.renotify_interval}, using #{best_matching_interval} instead"
107
+ puts "WARN: Monitor #{id} uses invalid escalation interval (renotify_interval) #{options.renotify_interval}, using #{best_matching_interval} instead"
109
108
  options.renotify_interval = best_matching_interval
110
109
  end
111
110
  end # Monitor
112
111
  end # Models
113
112
  end # Doggy
114
-
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Doggy
4
5
  module Models
@@ -27,9 +28,7 @@ module Doggy
27
28
  end
28
29
 
29
30
  def self.resource_url(id = nil)
30
- "https://app.datadoghq.com/api/v1/screen".tap do |base_url|
31
- base_url << "/#{ id }" if id
32
- end
31
+ "https://app.datadoghq.com/api/v1/screen/#{id}"
33
32
  end
34
33
 
35
34
  def managed?
@@ -38,12 +37,12 @@ module Doggy
38
37
 
39
38
  def ensure_managed_emoji!
40
39
  return unless managed?
41
- return if self.board_title =~ /\xF0\x9F\x90\xB6/
40
+ return if board_title =~ /\xF0\x9F\x90\xB6/
42
41
  self.board_title += " \xF0\x9F\x90\xB6"
43
42
  end
44
43
 
45
44
  def human_url
46
- "https://#{Doggy.base_human_url}/screen/#{ id }"
45
+ "https://#{Doggy.base_human_url}/screen/#{id}"
47
46
  end
48
47
 
49
48
  # Screens don't have a direct edit URL
@@ -51,4 +50,3 @@ module Doggy
51
50
  end # Screen
52
51
  end # Models
53
52
  end # Doggy
54
-
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Doggy
4
- VERSION = '2.0.42'
5
+ VERSION = '2.1.0'
5
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doggy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.42
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky
@@ -9,120 +9,106 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-01-31 00:00:00.000000000 Z
12
+ date: 2019-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: json
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: 1.8.3
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: 1.8.3
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: parallel
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
- - - "~>"
18
+ - - ">="
33
19
  - !ruby/object:Gem::Version
34
- version: 1.6.1
20
+ version: '0'
35
21
  type: :runtime
36
22
  prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
- - - "~>"
25
+ - - ">="
40
26
  - !ruby/object:Gem::Version
41
- version: 1.6.1
27
+ version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: thor
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
- - - "~>"
32
+ - - ">="
47
33
  - !ruby/object:Gem::Version
48
- version: 0.19.1
34
+ version: '0'
49
35
  type: :runtime
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - "~>"
39
+ - - ">="
54
40
  - !ruby/object:Gem::Version
55
- version: 0.19.1
41
+ version: '0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: virtus
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
- - - "~>"
46
+ - - ">="
61
47
  - !ruby/object:Gem::Version
62
- version: 1.0.5
48
+ version: '0'
63
49
  type: :runtime
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - "~>"
53
+ - - ">="
68
54
  - !ruby/object:Gem::Version
69
- version: 1.0.5
55
+ version: '0'
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: rugged
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
- - - "~>"
60
+ - - ">="
75
61
  - !ruby/object:Gem::Version
76
- version: 0.23.2
62
+ version: '0'
77
63
  type: :runtime
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - "~>"
67
+ - - ">="
82
68
  - !ruby/object:Gem::Version
83
- version: 0.23.2
69
+ version: '0'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: activesupport
86
72
  requirement: !ruby/object:Gem::Requirement
87
73
  requirements:
88
- - - "~>"
74
+ - - ">="
89
75
  - !ruby/object:Gem::Version
90
- version: '4'
76
+ version: '0'
91
77
  type: :runtime
92
78
  prerelease: false
93
79
  version_requirements: !ruby/object:Gem::Requirement
94
80
  requirements:
95
- - - "~>"
81
+ - - ">="
96
82
  - !ruby/object:Gem::Version
97
- version: '4'
83
+ version: '0'
98
84
  - !ruby/object:Gem::Dependency
99
85
  name: bundler
100
86
  requirement: !ruby/object:Gem::Requirement
101
87
  requirements:
102
- - - "~>"
88
+ - - ">="
103
89
  - !ruby/object:Gem::Version
104
- version: '1.10'
90
+ version: '0'
105
91
  type: :development
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
- - - "~>"
95
+ - - ">="
110
96
  - !ruby/object:Gem::Version
111
- version: '1.10'
97
+ version: '0'
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: rake
114
100
  requirement: !ruby/object:Gem::Requirement
115
101
  requirements:
116
- - - "~>"
102
+ - - ">="
117
103
  - !ruby/object:Gem::Version
118
- version: '10.0'
104
+ version: '0'
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
108
  requirements:
123
- - - "~>"
109
+ - - ">="
124
110
  - !ruby/object:Gem::Version
125
- version: '10.0'
111
+ version: '0'
126
112
  - !ruby/object:Gem::Dependency
127
113
  name: minitest
128
114
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +123,34 @@ dependencies:
137
123
  - - ">="
138
124
  - !ruby/object:Gem::Version
139
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: pry
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  description: Syncs and manages DataDog dashboards, alerts, screenboards, and monitors.
141
155
  email:
142
156
  - v@gor.io
@@ -147,7 +161,8 @@ extensions: []
147
161
  extra_rdoc_files: []
148
162
  files:
149
163
  - ".gitignore"
150
- - ".ruby-version"
164
+ - ".rubocop-http---shopify-github-io-ruby-style-guide-rubocop-yml"
165
+ - ".rubocop.yml"
151
166
  - ".travis.yml"
152
167
  - CODE_OF_CONDUCT.md
153
168
  - Gemfile
@@ -157,6 +172,7 @@ files:
157
172
  - Rakefile
158
173
  - bin/console
159
174
  - bin/setup
175
+ - dev.yml
160
176
  - doggy.gemspec
161
177
  - exe/doggy
162
178
  - lib/doggy.rb
@@ -185,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
201
  requirements:
186
202
  - - "~>"
187
203
  - !ruby/object:Gem::Version
188
- version: '2.0'
204
+ version: '2.5'
189
205
  required_rubygems_version: !ruby/object:Gem::Requirement
190
206
  requirements:
191
207
  - - ">="
@@ -193,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
209
  version: '0'
194
210
  requirements: []
195
211
  rubyforge_project:
196
- rubygems_version: 2.6.14
212
+ rubygems_version: 2.7.6
197
213
  signing_key:
198
214
  specification_version: 4
199
215
  summary: Syncs DataDog dashboards, alerts, screenboards, and monitors.
@@ -1 +0,0 @@
1
- 2.3.1