neetob 0.5.32 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdc4b3fcccf8922a0af4103b623e59450fe925a70895acb4775e2529d43c62a5
4
- data.tar.gz: d6174c39ae93a4d3b02269c33783b066084b8fd313e9990aeb49cdbe0e6f7070
3
+ metadata.gz: 315137a3063a9384543accfc6d0c867ab9ef7cbb65f2276c8779cd35452e186f
4
+ data.tar.gz: 5a42415390bd8082a0bb8ae5311bb424ded01b63535c4c7d4e1c03361ea10be0
5
5
  SHA512:
6
- metadata.gz: 36c2cecc7209321eeea50e5f1567483156717719e2230aa12fc49cfd7b67e44801766c061b6c7a7473c300d59d14d234f975ad64778af30d31b2787a31911b1c
7
- data.tar.gz: b03fcafed7e88cc22f0608e10c3a9259fee735f3801394ece26deee34cf402722cb3731f1060a3c4daf44f5fec6049d9d39f668c761ae949a3484535bd4aff48
6
+ metadata.gz: 9e2a555d3c6b85713699ae105cfa334d8e8c7669715ad904315b87e19d2f3fe2db2195ac68f3a675c1a08387620e7a7cfe03887e20d80a83dc215aeb11964e51
7
+ data.tar.gz: 3c30f7697de99a9b77f52f5884f8630dc3d8d252f2094ffd138396f3eae94e88b22afdc4f4c00723160f8243531649f1556e63800dbf2ac070cb318b0e49eb41
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.5.32)
4
+ neetob (0.5.33)
5
5
  brakeman (~> 5.0)
6
6
  chronic
7
7
  dotenv (~> 2.8.1)
@@ -32,16 +32,32 @@ module Neetob
32
32
  end
33
33
 
34
34
  def get(username:, password:, headers: { "Accept" => "application/json" })
35
- uri = URI(MONITORS_URL)
36
- request = Net::HTTP::Get.new(uri)
37
- headers.each { |key, value| request[key] = value }
38
- request.basic_auth(username, password)
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
- response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
41
- http.request(request)
42
- end
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
- parse_response(response)
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: "")[:monitors]
15
- cronitor_three_monitors = get(username: ENV["CRONITOR_THREE_API_KEY"], password: "")[:monitors]
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
- def initialize
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)
@@ -10,15 +10,16 @@ module Neetob
10
10
  "NeetoTower"
11
11
  ]
12
12
 
13
- def initialize
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)
@@ -11,15 +11,16 @@ module Neetob
11
11
  "NeetoTower"
12
12
  ]
13
13
 
14
- def initialize
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.5.32"
4
+ VERSION = "0.5.33"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.32
4
+ version: 0.5.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta