qabot 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dbclasses.rb +101 -21
  3. data/lib/qabot.rb +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a4a77bc1c0e5d1a1667b935df168d08e7d34e71
4
- data.tar.gz: d892ff34caba0b887d45396ac3aa6f49c5e28e21
3
+ metadata.gz: 2d7169ba997111a0d7ab4c391b3dbfc7aba16d9a
4
+ data.tar.gz: eb3a55ebc0b0dae3a9f4f726b77af25d18e8eff1
5
5
  SHA512:
6
- metadata.gz: 004704ab96d13f2ed72231a711d837be00bea93c7d341fbe5d2dc640d577620cd518e12f595636d7b9ecd55d199d95a297b2257e91062b9b5380d41d20c69579
7
- data.tar.gz: dbdff29081158455c92ed69be4ab107869e8744463ee2094d9d14cd303cf0969514c096808bc87f3b71822b26ed4988c98eb836d64b6e918a3ed3101b3d21fbd
6
+ metadata.gz: c12c4773922b7689cfa2d4f27a711c0057644e31615ffeccf38d234b6cdf13bfc418f6cfc5fe1403af1a6b782d27ddd87e7f1a4ab888f6c169734580fc04670c
7
+ data.tar.gz: 43598425a1f89b5b2e97e7d1858b6ab6110c7a8a81dd40a71ba44560c744810cee65b37a0b98160c77148710adbd68089eae775da00db99c531d31b12c917981
data/lib/dbclasses.rb CHANGED
@@ -99,7 +99,7 @@ module BlackStack
99
99
  # map the attributes of the hash `h` to this object.
100
100
  def parse(h)
101
101
  self.value = h[:value] == true
102
- self.value_red = h[:value_red] == true
102
+ self.trigger_red = h[:trigger_red] == true
103
103
  q = "
104
104
  UPDATE qaboolflag
105
105
  SET
@@ -155,12 +155,38 @@ module BlackStack
155
155
  g.name = h[:category]
156
156
  g.save
157
157
  end # g.nil?
158
+
158
159
  o = BlackStack::QABot::BoolFlag.new
159
- h[:id] = guid()
160
- h[:id_qacategory] = g.id
161
- h[:id_user] = u.id
162
- h[:create_time] = now()
163
- o.parse(h)
160
+ o.id = guid()
161
+ o.id_qacategory = g.id
162
+ o.id_user = u.id
163
+ o.create_time = now()
164
+ o.name = h[:name]
165
+ o.html_description = h[:html_description]
166
+ # how often run this qa check - what is the frequency to show the timeline -- ss, mi, hh, mm, dd, qq, yy
167
+ o.trace_frequency_period = h[:trace_frequency_period]
168
+ o.trace_frequency_units = h[:trace_frequency_units]
169
+ # show this flag public in the web
170
+ o.public = h[:public]
171
+ # what is the latest value reported
172
+ o.value = h[:value]
173
+ # what is the value to show red (true or false). Default value is `false`.
174
+ o.trigger_red = h[:trigger_red]
175
+ # each time the value is changed, you can show a comment about the last status.
176
+ o.alert_comments = h[:alert_comments]
177
+ # if it is currently red
178
+ o.stat_red = o.is_red?
179
+ # order to show it inside the category, in the dashboard
180
+ o.order = h[:order]
181
+ # sharing this with other people, so other people can add my alert on their dashboards.
182
+ o.share = h[:share]
183
+ # activate this flag to show in the flags column of the dashboard
184
+ o.show_as_flag = h[:show_as_flag]
185
+ # activate tis flag to show in the timelines column of the dashboard
186
+ o.show_as_timeline = h[:show_as_timeline]
187
+ # save
188
+ o.save
189
+ #
164
190
  o
165
191
  end # def create(h)
166
192
 
@@ -257,9 +283,9 @@ module BlackStack
257
283
  def parse(h)
258
284
  self.value = h[:value].to_i
259
285
  self.value_threshold = h[:value_threshold].to_i
260
- self.value_red = h[:value_red].to_i
286
+ self.trigger_red = h[:trigger_red].to_i
261
287
  q = "
262
- UPDATE qaboolflag
288
+ UPDATE qaintflag
263
289
  SET
264
290
  id_qacategory = '#{h[:id_qacategory]}',
265
291
  --create_time = '#{h[:create_time]}',
@@ -311,11 +337,38 @@ module BlackStack
311
337
  g.save
312
338
  end # g.nil?
313
339
  o = BlackStack::QABot::IntFlag.new
314
- h[:id] = guid()
315
- h[:id_qacategory] = g.id
316
- h[:id_user] = u.id
317
- h[:create_time] = now()
318
- o.parse(h)
340
+ o.id = guid()
341
+ o.id_qacategory = g.id
342
+ o.id_user = u.id
343
+ o.create_time = now()
344
+ o.name = h[:name]
345
+ o.html_description = h[:html_description]
346
+ # how often run this qa check - what is the frequency to show the timeline -- ss, mi, hh, mm, dd, qq, yy
347
+ o.trace_frequency_period = h[:trace_frequency_period]
348
+ o.trace_frequency_units = h[:trace_frequency_units]
349
+ # show this flag public in the web
350
+ o.public = h[:public]
351
+ # what is the latest value reported
352
+ o.value = h[:value]
353
+ # what is the value to decide to go green or red.
354
+ o.value_threshold = h[:value_threshold]
355
+ # what is the value to show red (true or false).
356
+ o.trigger_red = h[:trigger_red]
357
+ # each time the value is changed, you can show a comment about the last status.
358
+ o.alert_comments = h[:alert_comments]
359
+ # if it is currently red
360
+ o.stat_red = o.is_red?
361
+ # order to show it inside the category, in the dashboard
362
+ o.order = h[:order]
363
+ # sharing this with other people, so other people can add my alert on their dashboards.
364
+ o.share = h[:share]
365
+ # activate this flag to show in the flags column of the dashboard
366
+ o.show_as_flag = h[:show_as_flag]
367
+ # activate tis flag to show in the timelines column of the dashboard
368
+ o.show_as_timeline = h[:show_as_timeline]
369
+ # save
370
+ o.save
371
+ #
319
372
  o
320
373
  end # def parse(h)
321
374
 
@@ -412,9 +465,9 @@ module BlackStack
412
465
  def parse(h)
413
466
  self.value = h[:value].to_f
414
467
  self.value_threshold = h[:value_threshold].to_f
415
- self.value_red = h[:value_red].to_f
468
+ self.trigger_red = h[:trigger_red].to_f
416
469
  q = "
417
- UPDATE qaboolflag
470
+ UPDATE qafloatflag
418
471
  SET
419
472
  id_qacategory = '#{h[:id_qacategory]}',
420
473
  --create_time = '#{h[:create_time]}',
@@ -454,7 +507,7 @@ module BlackStack
454
507
  # create a new object.
455
508
  # map the attributes of the hash `h` to this object.
456
509
  # return such an object.
457
- def self.create(h)
510
+ def self.create(client, h)
458
511
  u = client.users.first # TODO: the email of the user should be included in the hash descriptor, and validate the user exists and is belonging this client.
459
512
  g = client.categories.select { |g| g.name == h[:category] }.first
460
513
  if g.nil?
@@ -466,11 +519,38 @@ module BlackStack
466
519
  g.save
467
520
  end # g.nil?
468
521
  o = BlackStack::QABot::FloatFlag.new
469
- h[:id] = guid()
470
- h[:id_qacategory] = g.id
471
- h[:id_user] = u.id
472
- h[:create_time] = now()
473
- o.parse(h)
522
+ o.id = guid()
523
+ o.id_qacategory = g.id
524
+ o.id_user = u.id
525
+ o.create_time = now()
526
+ o.name = h[:name]
527
+ o.html_description = h[:html_description]
528
+ # how often run this qa check - what is the frequency to show the timeline -- ss, mi, hh, mm, dd, qq, yy
529
+ o.trace_frequency_period = h[:trace_frequency_period]
530
+ o.trace_frequency_units = h[:trace_frequency_units]
531
+ # show this flag public in the web
532
+ o.public = h[:public]
533
+ # what is the latest value reported
534
+ o.value = h[:value]
535
+ # what is the value to decide to go green or red.
536
+ o.value_threshold = h[:value_threshold]
537
+ # what is the value to show red (true or false).
538
+ o.trigger_red = h[:trigger_red]
539
+ # each time the value is changed, you can show a comment about the last status.
540
+ o.alert_comments = h[:alert_comments]
541
+ # if it is currently red
542
+ o.stat_red = o.is_red?
543
+ # order to show it inside the category, in the dashboard
544
+ o.order = h[:order]
545
+ # sharing this with other people, so other people can add my alert on their dashboards.
546
+ o.share = h[:share]
547
+ # activate this flag to show in the flags column of the dashboard
548
+ o.show_as_flag = h[:show_as_flag]
549
+ # activate tis flag to show in the timelines column of the dashboard
550
+ o.show_as_timeline = h[:show_as_timeline]
551
+ # save
552
+ o.save
553
+ #
474
554
  o
475
555
  end # def parse(h)
476
556
 
data/lib/qabot.rb CHANGED
@@ -104,9 +104,9 @@ module BlackStack
104
104
  # VALIDATE: if `:type` is `INT` OR `FLOAT`, then `:trigger_red` must be beloning `trigger_red_values`
105
105
  errors << "Invalid trigger_red: #{h[:trigger_red]}. Must be one of #{trigger_red_values.to_s}" if (h[:type] == BlackStack::QABot::INT || h[:type] == BlackStack::QABot::FLOAT) && !trigger_red_values.include?(h[:trigger_red])
106
106
  # VALIDATE: if `:type` is 'INT', then `:value_threshold` must ba an integer.
107
- errors << "Invalid trigger_red: #{h[:value_threshold]}. Must be integer." if h[:type] == BlackStack::QABot::INT && !h[:value_threshold].is_a?(Integer)
107
+ errors << "Invalid value_threshold: #{h[:value_threshold]}. Must be integer." if h[:type] == BlackStack::QABot::INT && !h[:value_threshold].is_a?(Integer)
108
108
  # VALIDATE: if `:ty[e` is `FLOAT`, then `:trigger_red` must be a float.
109
- errors << "Invalid trigger_red: #{h[:value_threshold]}. Must be float." if h[:type] == BlackStack::QABot::FLOAT && !h[:value_threshold].is_a?(Float)
109
+ errors << "Invalid value_threshold: #{h[:value_threshold]}. Must be float." if h[:type] == BlackStack::QABot::FLOAT && !h[:value_threshold].is_a?(Float)
110
110
  # return errors
111
111
  errors
112
112
  end # def self.validate_descriptor_parameters_except_functions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qabot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-23 00:00:00.000000000 Z
11
+ date: 2022-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json