agent_q 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/agent_q.rb +13 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fda52aa812035d3d622792a184bf5aa4a92e1d75
4
- data.tar.gz: fb80df451351361654d2572b79e519ebbfd0fdc9
3
+ metadata.gz: dd933c0cf5f220c80fb898458cbe01cd42ca6bb1
4
+ data.tar.gz: 2e62592b9951f5d8b64a525ff46defd7b10b8094
5
5
  SHA512:
6
- metadata.gz: e19eaca2f54f442291ada1c426c384a53fd8a5284d051e601073664b02159688a9e5571b94c132d075c405bdf9b7fa252be4184b9e2b6469cd3bfb63a3ecd136
7
- data.tar.gz: 3f7c180e2be7ba1aa97890626700e86ffa29a3ea8c900d09bc47d7816ca2322b0c9f804c7479cc8ae0c36b2bb2c0ebace266fcab612228d273432674e48111dc
6
+ metadata.gz: 05ce32b721df4718be84c64d8265f37a48b8b228d0daaa88eb9201ea5ea54afb3af26527eb9e49c45ddc3d8a37a069a2c3917cd07ce2c3100d3bfa3ea0e1c956
7
+ data.tar.gz: 2d76e126f187fad56937a1813c890da67344f48b94b0b54af4c30fe564e8ed6abbf9dc16b32d94d579c61c5ef9d46e837ba0d0cd90fb87af6a0b2391198a15c7
data/lib/agent_q.rb CHANGED
@@ -22,7 +22,8 @@ class AgentQ
22
22
 
23
23
  def run
24
24
 
25
-
25
+ # we go direct to the case, which then prompts the login process. That way we only
26
+ # score the requested case
26
27
  visit("/case/#{@quepid_case}/try/0")
27
28
  #save_screenshot('quepid.png')
28
29
  fill_in('Email', with: @username)
@@ -38,22 +39,27 @@ class AgentQ
38
39
  #save_screenshot('quepid_dashboard.png')
39
40
 
40
41
  visit "/api/cases/#{@quepid_case}/scores/all.json"
42
+ html = page.html
43
+ json = html[html.index('{')..html.rindex('}')]
44
+ case_results = JSON.parse(json)
41
45
 
46
+ visit "/api/cases/#{@quepid_case}.json"
42
47
  html = page.html
43
48
  json = html[html.index('{')..html.rindex('}')]
49
+ case_details = JSON.parse(json)
44
50
 
45
- results = JSON.parse(json)
51
+ case_name = case_details["caseName"]
46
52
 
47
- if results['message']
48
- puts "Error checking case #{@quepid_case}: #{results['message']}"
53
+ if case_results['message']
54
+ puts "Error checking case #{@quepid_case}: #{case_results['message']}"
49
55
  exit 1
50
56
  else
51
- score = results['scores'].first['score']
57
+ score = case_results['scores'].first['score']
52
58
  if score.to_i > @threshold_score.to_i
53
- puts "Case #{@quepid_case} scored (#{score}) above threshold of #{@threshold_score}"
59
+ puts "Case #{case_name} (#{@quepid_case}) scored #{score}, \e[32mwhich is above the threshold of #{@threshold_score}\e[0m"
54
60
  exit 0
55
61
  else
56
- puts "Case #{@quepid_case} scored (#{score}) below threshold of #{@threshold_score}"
62
+ puts "Case #{case_name} (#{@quepid_case}) scored #{score}, \e[31mwhich is below the threshold of #{@threshold_score}\e[0m"
57
63
  exit 1
58
64
  end
59
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agent_q
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Pugh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-01 00:00:00.000000000 Z
12
+ date: 2017-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara