neetob 0.5.31 → 0.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/neetob/cli/cronitor/base.rb +24 -8
- data/lib/neetob/cli/cronitor/get_all_monitors.rb +2 -2
- data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/main.rb +6 -3
- data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_apps.rb +4 -3
- data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_help_center.rb +4 -3
- data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_landing_pages.rb +4 -3
- data/lib/neetob/cli/ui.rb +1 -1
- data/lib/neetob/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315137a3063a9384543accfc6d0c867ab9ef7cbb65f2276c8779cd35452e186f
|
4
|
+
data.tar.gz: 5a42415390bd8082a0bb8ae5311bb424ded01b63535c4c7d4e1c03361ea10be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e2a555d3c6b85713699ae105cfa334d8e8c7669715ad904315b87e19d2f3fe2db2195ac68f3a675c1a08387620e7a7cfe03887e20d80a83dc215aeb11964e51
|
7
|
+
data.tar.gz: 3c30f7697de99a9b77f52f5884f8630dc3d8d252f2094ffd138396f3eae94e88b22afdc4f4c00723160f8243531649f1556e63800dbf2ac070cb318b0e49eb41
|
data/Gemfile.lock
CHANGED
@@ -32,16 +32,32 @@ module Neetob
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get(username:, password:, headers: { "Accept" => "application/json" })
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
monitors = []
|
36
|
+
move_to_next_page = true
|
37
|
+
page = 1
|
38
|
+
while move_to_next_page
|
39
|
+
url_to_fetch_from = MONITORS_URL
|
40
|
+
url_to_fetch_from += "?page=#{page}" if page > 1
|
41
|
+
uri = URI(url_to_fetch_from)
|
42
|
+
request = Net::HTTP::Get.new(uri)
|
43
|
+
headers.each { |key, value| request[key] = value }
|
44
|
+
request.basic_auth(username, password)
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
|
47
|
+
http.request(request)
|
48
|
+
end
|
43
49
|
|
44
|
-
|
50
|
+
parsed_response = parse_response(response)
|
51
|
+
total_monitor_count = parsed_response[:total_monitor_count]
|
52
|
+
page_size = parsed_response[:page_size]
|
53
|
+
if total_monitor_count > (page * page_size)
|
54
|
+
page += 1
|
55
|
+
else
|
56
|
+
move_to_next_page = false
|
57
|
+
end
|
58
|
+
monitors += parsed_response[:monitors]
|
59
|
+
end
|
60
|
+
monitors
|
45
61
|
end
|
46
62
|
end
|
47
63
|
end
|
@@ -11,8 +11,8 @@ module Neetob
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
cronitor_one_monitors = get(username: ENV["CRONITOR_ONE_API_KEY"], password: "")
|
15
|
-
cronitor_three_monitors = get(username: ENV["CRONITOR_THREE_API_KEY"], password: "")
|
14
|
+
cronitor_one_monitors = get(username: ENV["CRONITOR_ONE_API_KEY"], password: "")
|
15
|
+
cronitor_three_monitors = get(username: ENV["CRONITOR_THREE_API_KEY"], password: "")
|
16
16
|
cronitor_one_monitors + cronitor_three_monitors
|
17
17
|
end
|
18
18
|
end
|
@@ -10,16 +10,19 @@ module Neetob
|
|
10
10
|
module InstancesAndAddons
|
11
11
|
module Cronitor
|
12
12
|
class Main < CLI::Base
|
13
|
+
attr_accessor :cumulative_monitors_data
|
14
|
+
|
13
15
|
def initialize
|
14
16
|
super()
|
17
|
+
@cumulative_monitors_data = Neetob::CLI::Cronitor::GetAllMonitors.new.run
|
15
18
|
end
|
16
19
|
|
17
20
|
def run
|
18
|
-
SetupCorrectlyForApps.new.run
|
21
|
+
SetupCorrectlyForApps.new(cumulative_monitors_data).run
|
19
22
|
ui.info "\n"
|
20
|
-
SetupCorrectlyForHelpCenter.new.run
|
23
|
+
SetupCorrectlyForHelpCenter.new(cumulative_monitors_data).run
|
21
24
|
ui.info "\n"
|
22
|
-
SetupCorrectlyForLandingPages.new.run
|
25
|
+
SetupCorrectlyForLandingPages.new(cumulative_monitors_data).run
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -8,15 +8,16 @@ module Neetob
|
|
8
8
|
module InstancesAndAddons
|
9
9
|
module Cronitor
|
10
10
|
class SetupCorrectlyForApps < CLI::Base
|
11
|
-
|
11
|
+
attr_reader :all_monitors
|
12
|
+
|
13
|
+
def initialize(cumulative_monitors_data)
|
12
14
|
super()
|
15
|
+
@all_monitors = cumulative_monitors_data
|
13
16
|
end
|
14
17
|
|
15
18
|
def run
|
16
19
|
ui.success "### 3.3.1. Checking whether Cronitor monitors are set up correctly for apps"
|
17
20
|
|
18
|
-
all_monitors = Neetob::CLI::Cronitor::GetAllMonitors.new.run
|
19
|
-
|
20
21
|
apps_data = [["App", "Monitor for Application present", "Monitor for Application enabled", "Comments",
|
21
22
|
"Audit Passed"]]
|
22
23
|
ui.info("\n", print_to_audit_log: false)
|
data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_help_center.rb
CHANGED
@@ -10,15 +10,16 @@ module Neetob
|
|
10
10
|
"NeetoTower"
|
11
11
|
]
|
12
12
|
|
13
|
-
|
13
|
+
attr_reader :all_monitors
|
14
|
+
|
15
|
+
def initialize(cumulative_monitors_data)
|
14
16
|
super()
|
17
|
+
@all_monitors = cumulative_monitors_data
|
15
18
|
end
|
16
19
|
|
17
20
|
def run
|
18
21
|
ui.success "### 3.3.2. Checking whether Cronitor monitors are set up correctly for Help Centers"
|
19
22
|
|
20
|
-
all_monitors = Neetob::CLI::Cronitor::GetAllMonitors.new.run
|
21
|
-
|
22
23
|
apps_data = [["App", "Monitor for Application help center present",
|
23
24
|
"Monitor for Application help center enabled", "Comments", "Audit Passed"]]
|
24
25
|
ui.info("\n", print_to_audit_log: false)
|
data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_landing_pages.rb
CHANGED
@@ -11,15 +11,16 @@ module Neetob
|
|
11
11
|
"NeetoTower"
|
12
12
|
]
|
13
13
|
|
14
|
-
|
14
|
+
attr_reader :all_monitors
|
15
|
+
|
16
|
+
def initialize(cumulative_monitors_data)
|
15
17
|
super()
|
18
|
+
@all_monitors = cumulative_monitors_data
|
16
19
|
end
|
17
20
|
|
18
21
|
def run
|
19
22
|
ui.success "### 3.3.3. Checking whether Cronitor monitors are set up correctly for landing pages"
|
20
23
|
|
21
|
-
all_monitors = Neetob::CLI::Cronitor::GetAllMonitors.new.run
|
22
|
-
|
23
24
|
apps_data = [["App", "Monitor for Application landing page present",
|
24
25
|
"Monitor for Application landing page enabled", "Comments", "Audit Passed"]]
|
25
26
|
ui.info("\n", print_to_audit_log: false)
|
data/lib/neetob/cli/ui.rb
CHANGED
@@ -69,7 +69,7 @@ module Neetob
|
|
69
69
|
markdown_table = "| " + header.map.with_index { |h, i| h.to_s.ljust(column_widths[i]) }.join(" | ") + " |\n"
|
70
70
|
markdown_table += "|-" + column_widths.map { |w| "-" * w }.join("-|-") + "-|\n"
|
71
71
|
rows.each do |row|
|
72
|
-
markdown_table += "| " + row.map.with_index { |cell, i| cell.to_s.ljust(column_widths[i]) }.join(" | ") + " |\n"
|
72
|
+
markdown_table += "| " + row.map.with_index { |cell, i| cell.to_s.gsub("\|", "\\|").ljust(column_widths[i]) }.join(" | ") + " |\n"
|
73
73
|
end
|
74
74
|
File.open(markdown_file, "a") do |f|
|
75
75
|
f.puts markdown_table
|
data/lib/neetob/version.rb
CHANGED